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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,7 @@ android {
18
18
  minSdkVersion 16
19
19
  targetSdkVersion 31
20
20
  versionCode 1
21
- versionName '3.10.0-beta.3'
21
+ versionName '3.10.0-beta.5'
22
22
  }
23
23
  lintOptions {
24
24
  abortOnError false
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.3",
6
+ "version": "3.10.0-beta.5",
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<RadarAddressCallback>;
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,42 @@ 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: RadarTrackingOptionsDesiredAccuracy;
18
+ stopDuration: number;
19
+ stopDistance: number;
20
+ sync: "all" | "stopsAndExits" | "none";
21
+ replay: "all" | "stops" | "none";
22
+ useStoppedGeofence: boolean;
23
+ showBlueBar?: boolean;
24
+ startTrackingAfter?: number;
25
+ stopTrackingAfter?: number;
26
+ stoppedGeofenceRadius: number;
27
+ useMovingGeofence: boolean;
28
+ movingGeofenceRadius: number;
29
+ syncGeofences: boolean;
30
+ useVisits?: boolean;
31
+ useSignificantLocationChanges?: boolean;
32
+ beacons: boolean;
33
+ syncGeofencesLimit?: number;
34
+ foregroundServiceEnabled?: boolean;
35
+ }
36
+ export interface RadarMockTrackingOptions {
37
+ origin: Location;
38
+ destination: Location;
39
+ mode: RadarRouteMode;
40
+ steps: number;
41
+ interval: number;
42
+ }
7
43
  export interface RadarGetDistanceOptions {
8
44
  origin?: Location;
9
45
  destination?: Location;
@@ -24,10 +60,64 @@ export interface RadarStartTripOptions {
24
60
  tripOptions: RadarTripOptions;
25
61
  trackingOptions?: RadarTrackingOptions;
26
62
  }
27
- export interface RadarLocationCallback {
28
- status: string;
29
- location?: Location;
30
- stopped: boolean;
63
+ export interface RadarSearchGeofencesOptions {
64
+ near?: Location;
65
+ radius?: number;
66
+ metadata?: RadarMetadata;
67
+ tags?: string[];
68
+ limit?: number;
69
+ }
70
+ export interface RadarTrackingOptionsForegroundServiceOptions {
71
+ text?: string;
72
+ title?: string;
73
+ updatesOnly: boolean;
74
+ activity?: string;
75
+ importance?: number;
76
+ id?: number;
77
+ channelName?: string;
78
+ iconString?: string;
79
+ iconColor?: string;
80
+ }
81
+ export interface RadarSearchPlacesOptions {
82
+ near?: Location;
83
+ radius?: number;
84
+ chains?: string[];
85
+ chainMetadata?: RadarMetadata;
86
+ categories?: string[];
87
+ groups?: string[];
88
+ limit?: number;
89
+ }
90
+ export interface RadarAutocompleteOptions {
91
+ query: string;
92
+ near?: Location;
93
+ layers?: string[];
94
+ limit: number;
95
+ country?: string;
96
+ /** @deprecated this is always true, regardless of the value passed here */
97
+ expandUnits?: boolean;
98
+ mailable?: boolean;
99
+ }
100
+ export interface RadarNotificationOptions {
101
+ iconString?: string;
102
+ iconColor?: string;
103
+ foregroundServiceIconString?: string;
104
+ foregroundServiceIconColor?: string;
105
+ eventIconString?: string;
106
+ eventIconColor?: string;
107
+ }
108
+ export interface RadarLogConversionOptions {
109
+ name: string;
110
+ revenue?: number;
111
+ metadata?: RadarMetadata;
112
+ }
113
+ export interface RadarTripOptions {
114
+ externalId: string;
115
+ metadata?: RadarMetadata;
116
+ destinationGeofenceTag?: string;
117
+ destinationGeofenceExternalId?: string;
118
+ mode?: RadarRouteMode;
119
+ scheduledArrivalAt?: Date;
120
+ approachingThreshold?: number;
31
121
  }
32
122
  export interface RadarTrackCallback {
33
123
  status: string;
@@ -35,12 +125,10 @@ export interface RadarTrackCallback {
35
125
  user?: RadarUser;
36
126
  events?: RadarEvent[];
37
127
  }
38
- export type RadarPermissionsStatus = "GRANTED_FOREGROUND" | "GRANTED_FOREGROUND" | "DENIED" | "NOT_DETERMINED" | "UNKNOWN";
39
- export type Event = "clientLocation" | "location" | "error" | "events" | "log";
40
- export type RadarLogLevel = "info" | "debug" | "warning" | "error" | "none";
41
- export interface RadarTrackTokenCallback {
128
+ export interface RadarLocationCallback {
42
129
  status: string;
43
- token?: String;
130
+ location?: Location;
131
+ stopped: boolean;
44
132
  }
45
133
  export interface RadarTripCallback {
46
134
  status: string;
@@ -62,58 +150,73 @@ export interface RadarSearchGeofencesCallback {
62
150
  location?: Location;
63
151
  geofences?: RadarGeofence[];
64
152
  }
65
- export interface RadarSearchGeofencesOptions {
66
- near?: Location;
67
- radius?: number;
68
- metadata?: RadarMetadata;
69
- tags?: string[];
70
- limit?: number;
71
- }
72
153
  export interface RadarAddressCallback {
73
154
  status: string;
74
155
  addresses?: RadarAddress[];
75
156
  }
157
+ export interface RadarIPGeocodeCallback {
158
+ status: string;
159
+ address?: RadarAddress;
160
+ proxy?: boolean;
161
+ }
76
162
  export interface RadarValidateAddressCallback {
77
163
  status: string;
78
164
  address?: RadarAddress;
79
- verificationStatus?: RadarAddressVerificationStatus;
165
+ verificationStatus?: RadarVerificationStatus;
80
166
  }
81
167
  export interface RadarIPGeocodeCallback {
82
168
  status: string;
83
169
  address?: RadarAddress;
84
170
  proxy?: boolean;
85
171
  }
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
172
  export interface RadarRouteCallback {
98
173
  status: string;
99
174
  routes?: RadarRoutes;
100
175
  }
101
176
  export interface RadarLogConversionCallback {
102
177
  status: string;
103
- event: RadarEvent;
178
+ event?: RadarEvent;
104
179
  }
105
- export interface RadarRouteMatrix {
180
+ export interface RadarTrackTokenCallback {
106
181
  status: string;
107
- matrix?: object[];
182
+ token?: string;
108
183
  }
109
- export interface RadarSearchPlacesOptions {
110
- near?: Location;
111
- radius?: number;
112
- chains?: string[];
113
- chainMetadata?: RadarMetadata;
114
- categories?: string[];
115
- groups?: string[];
116
- limit?: number;
184
+ export interface RadarEventUpdate {
185
+ user?: RadarUser;
186
+ events: RadarEvent[];
187
+ }
188
+ export interface RadarEventUpdateCallback {
189
+ (args: RadarEventUpdate): void;
190
+ }
191
+ export interface RadarLocationUpdate {
192
+ location: Location;
193
+ user: RadarUser;
194
+ }
195
+ export interface RadarLocationUpdateCallback {
196
+ (args: RadarLocationUpdate): void;
197
+ }
198
+ export interface RadarClientLocationUpdate {
199
+ location: Location;
200
+ stopped: boolean;
201
+ source: RadarLocationSource;
202
+ }
203
+ export interface RadarClientLocationUpdateCallback {
204
+ (args: RadarClientLocationUpdate): void;
205
+ }
206
+ export interface RadarErrorCallback {
207
+ (status: string): void;
208
+ }
209
+ export interface RadarLogUpdateCallback {
210
+ (status: string): void;
211
+ }
212
+ export type RadarListenerCallback = RadarEventUpdateCallback | RadarLocationUpdateCallback | RadarClientLocationUpdateCallback | RadarErrorCallback | RadarLogUpdateCallback;
213
+ export type RadarPermissionsStatus = "GRANTED_FOREGROUND" | "GRANTED_BACKGROUND" | "DENIED" | "NOT_DETERMINED" | "UNKNOWN";
214
+ export type RadarLocationSource = "FOREGROUND_LOCATION" | "BACKGROUND_LOCATION" | "MANUAL_LOCATION" | "VISIT_ARRIVAL" | "VISIT_DEPARTURE" | "GEOFENCE_ENTER" | "GEOFENCE_DWELL" | "GEOFENCE_EXIT" | "MOCK_LOCATION" | "BEACON_ENTER" | "BEACON_EXIT" | "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];
@@ -170,9 +265,9 @@ export interface RadarTrip {
170
265
  metadata?: RadarMetadata;
171
266
  destinationGeofenceTag?: string;
172
267
  destinationGeofenceExternalId?: string;
173
- mode?: string;
268
+ mode?: RadarRouteMode;
174
269
  eta?: RadarTripEta;
175
- status: string;
270
+ status: RadarTripStatus;
176
271
  scheduledArrivalAt?: Date;
177
272
  destinationLocation: Location;
178
273
  }
@@ -226,7 +321,7 @@ export interface RadarGeofence {
226
321
  tag?: string;
227
322
  externalId?: string;
228
323
  metadata?: RadarMetadata;
229
- type?: string;
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
- formattedAddress?: string;
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
- export type RadarRouteMode = "foot" | "bike" | "car";
388
- export interface RadarTrackingStatus {
389
- isTracking: string;
390
- }
431
+ export type RadarRouteMode = "foot" | "bike" | "car" | "truck" | "motorbike";
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; } });
@@ -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 = { ...defaultAutocompleteOptions, ...options };
59
+ const config = Object.assign(Object.assign({}, defaultAutocompleteOptions), options);
51
60
  const style = config.style || {};
52
- const fetchResults = (0, react_1.useCallback)(async (searchQuery) => {
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 = await index_native_1.default.autocomplete(params);
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 }) => (<react_native_1.Pressable style={({ pressed }) => [
106
- {
107
- ...styles.resultItem,
108
- backgroundColor: pressed
109
- ? styles.resultItem.pressedBackgroundColor
110
- : styles.resultItem.backgroundColor,
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?.placeLabel}
127
+ {item.addressLabel || (item === null || item === void 0 ? void 0 : item.placeLabel)}
120
128
  </react_native_1.Text>
121
- {item?.formattedAddress.length > 0 && (<react_native_1.Text numberOfLines={1} style={styles.addressSubtext}>
122
- {item?.formattedAddress?.replace(`${item?.addressLabel || item?.placeLabel}, `, "")}
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,
@@ -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 = async (style = DEFAULT_STYLE) => {
43
- const host = await (0, helpers_1.getHost)();
44
- const publishableKey = await (0, helpers_1.getPublishableKey)();
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?.mapStyle || DEFAULT_STYLE).then((result) => {
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
- if (result?.location?.latitude && result?.location?.longitude) {
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?.longitude !== undefined ? [
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?.onRegionDidChange ? mapOptions.onRegionDidChange : null} styleURL={styleURL}>
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.3",
6
+ "version": "3.10.0-beta.5",
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<RadarAddressCallback>;
89
+ ipGeocode: () => Promise<RadarIPGeocodeCallback>;
89
90
  getDistance: (option: RadarGetDistanceOptions) => Promise<RadarRouteCallback>;
90
91
  getMatrix: (option: RadarGetMatrixOptions) => Promise<RadarRouteMatrix>;
91
92
  logConversion: (
@@ -6,6 +6,44 @@ 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: RadarTrackingOptionsDesiredAccuracy;
20
+ stopDuration: number;
21
+ stopDistance: number;
22
+ sync: "all" | "stopsAndExits" | "none";
23
+ replay: "all" | "stops" | "none";
24
+ useStoppedGeofence: boolean;
25
+ showBlueBar?: boolean;
26
+ startTrackingAfter?: number;
27
+ stopTrackingAfter?: number;
28
+ stoppedGeofenceRadius: number;
29
+ useMovingGeofence: boolean;
30
+ movingGeofenceRadius: number;
31
+ syncGeofences: boolean;
32
+ useVisits?: boolean;
33
+ useSignificantLocationChanges?: boolean;
34
+ beacons: boolean;
35
+ syncGeofencesLimit?: number;
36
+ foregroundServiceEnabled?: boolean;
37
+ }
38
+
39
+ export interface RadarMockTrackingOptions {
40
+ origin: Location;
41
+ destination: Location;
42
+ mode: RadarRouteMode;
43
+ steps: number;
44
+ interval: number;
45
+ }
46
+
9
47
  export interface RadarGetDistanceOptions {
10
48
  origin?: Location;
11
49
  destination?: Location;
@@ -30,10 +68,70 @@ export interface RadarStartTripOptions {
30
68
  trackingOptions?: RadarTrackingOptions;
31
69
  }
32
70
 
33
- export interface RadarLocationCallback {
34
- status: string;
35
- location?: Location;
36
- stopped: boolean;
71
+ export interface RadarSearchGeofencesOptions {
72
+ near?: Location;
73
+ radius?: number;
74
+ metadata?: RadarMetadata;
75
+ tags?: string[];
76
+ limit?: number;
77
+ }
78
+
79
+ export interface RadarTrackingOptionsForegroundServiceOptions {
80
+ text?: string;
81
+ title?: string;
82
+ updatesOnly: boolean;
83
+ activity?: string;
84
+ importance?: number;
85
+ id?: number;
86
+ channelName?: string;
87
+ iconString?: string;
88
+ iconColor?: string;
89
+ }
90
+
91
+ export interface RadarSearchPlacesOptions {
92
+ near?: Location;
93
+ radius?: number;
94
+ chains?: string[];
95
+ chainMetadata?: RadarMetadata;
96
+ categories?: string[];
97
+ groups?: string[];
98
+ limit?: number;
99
+ }
100
+
101
+ export interface RadarAutocompleteOptions {
102
+ query: string;
103
+ near?: Location;
104
+ layers?: string[];
105
+ limit: number;
106
+ country?: string;
107
+ /** @deprecated this is always true, regardless of the value passed here */
108
+ expandUnits?: boolean;
109
+ mailable?: boolean;
110
+ }
111
+
112
+ export interface RadarNotificationOptions {
113
+ iconString?: string;
114
+ iconColor?: string;
115
+ foregroundServiceIconString?: string;
116
+ foregroundServiceIconColor?: string;
117
+ eventIconString?: string;
118
+ eventIconColor?: string;
119
+ }
120
+
121
+ export interface RadarLogConversionOptions {
122
+ name: string;
123
+ revenue?: number;
124
+ metadata?: RadarMetadata;
125
+ }
126
+
127
+ export interface RadarTripOptions {
128
+ externalId: string;
129
+ metadata?: RadarMetadata;
130
+ destinationGeofenceTag?: string;
131
+ destinationGeofenceExternalId?: string;
132
+ mode?: RadarRouteMode;
133
+ scheduledArrivalAt?: Date;
134
+ approachingThreshold?: number;
37
135
  }
38
136
 
39
137
  export interface RadarTrackCallback {
@@ -43,20 +141,10 @@ export interface RadarTrackCallback {
43
141
  events?: RadarEvent[];
44
142
  }
45
143
 
46
- export type RadarPermissionsStatus =
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 {
144
+ export interface RadarLocationCallback {
58
145
  status: string;
59
- token?: String;
146
+ location?: Location;
147
+ stopped: boolean;
60
148
  }
61
149
 
62
150
  export interface RadarTripCallback {
@@ -83,23 +171,21 @@ export interface RadarSearchGeofencesCallback {
83
171
  geofences?: RadarGeofence[];
84
172
  }
85
173
 
86
- export interface RadarSearchGeofencesOptions {
87
- near?: Location;
88
- radius?: number;
89
- metadata?: RadarMetadata;
90
- tags?: string[];
91
- limit?: number;
92
- }
93
-
94
174
  export interface RadarAddressCallback {
95
175
  status: string;
96
176
  addresses?: RadarAddress[];
97
177
  }
98
178
 
179
+ export interface RadarIPGeocodeCallback {
180
+ status: string;
181
+ address?: RadarAddress;
182
+ proxy?: boolean;
183
+ }
184
+
99
185
  export interface RadarValidateAddressCallback {
100
186
  status: string;
101
187
  address?: RadarAddress;
102
- verificationStatus?: RadarAddressVerificationStatus;
188
+ verificationStatus?: RadarVerificationStatus;
103
189
  }
104
190
 
105
191
  export interface RadarIPGeocodeCallback {
@@ -108,18 +194,6 @@ export interface RadarIPGeocodeCallback {
108
194
  proxy?: boolean;
109
195
  }
110
196
 
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
197
  export interface RadarRouteCallback {
124
198
  status: string;
125
199
  routes?: RadarRoutes;
@@ -127,22 +201,85 @@ export interface RadarRouteCallback {
127
201
 
128
202
  export interface RadarLogConversionCallback {
129
203
  status: string;
130
- event: RadarEvent;
204
+ event?: RadarEvent;
131
205
  }
132
206
 
133
- export interface RadarRouteMatrix {
207
+ export interface RadarTrackTokenCallback {
134
208
  status: string;
135
- matrix?: object[];
209
+ token?: string;
136
210
  }
137
211
 
138
- export interface RadarSearchPlacesOptions {
139
- near?: Location;
140
- radius?: number;
141
- chains?: string[];
142
- chainMetadata?: RadarMetadata;
143
- categories?: string[];
144
- groups?: string[];
145
- limit?: number;
212
+ export interface RadarEventUpdate {
213
+ user?: RadarUser;
214
+ events: RadarEvent[];
215
+ }
216
+
217
+ export interface RadarEventUpdateCallback {
218
+ (args: RadarEventUpdate): void;
219
+ }
220
+
221
+ export interface RadarLocationUpdate {
222
+ location: Location;
223
+ user: RadarUser;
224
+ }
225
+
226
+ export interface RadarLocationUpdateCallback {
227
+ (args: RadarLocationUpdate): void;
228
+ }
229
+
230
+ export interface RadarClientLocationUpdate {
231
+ location: Location;
232
+ stopped: boolean;
233
+ source: RadarLocationSource;
234
+ }
235
+
236
+ export interface RadarClientLocationUpdateCallback {
237
+ (args: RadarClientLocationUpdate): void;
238
+ }
239
+
240
+ export interface RadarErrorCallback {
241
+ (status: string): void;
242
+ }
243
+
244
+ export interface RadarLogUpdateCallback {
245
+ (status: string): void;
246
+ }
247
+
248
+ export type RadarListenerCallback =
249
+ | RadarEventUpdateCallback
250
+ | RadarLocationUpdateCallback
251
+ | RadarClientLocationUpdateCallback
252
+ | RadarErrorCallback
253
+ | RadarLogUpdateCallback;
254
+
255
+ export type RadarPermissionsStatus =
256
+ | "GRANTED_FOREGROUND"
257
+ | "GRANTED_BACKGROUND"
258
+ | "DENIED"
259
+ | "NOT_DETERMINED"
260
+ | "UNKNOWN";
261
+
262
+ export type RadarLocationSource =
263
+ | "FOREGROUND_LOCATION"
264
+ | "BACKGROUND_LOCATION"
265
+ | "MANUAL_LOCATION"
266
+ | "VISIT_ARRIVAL"
267
+ | "VISIT_DEPARTURE"
268
+ | "GEOFENCE_ENTER"
269
+ | "GEOFENCE_DWELL"
270
+ | "GEOFENCE_EXIT"
271
+ | "MOCK_LOCATION"
272
+ | "BEACON_ENTER"
273
+ | "BEACON_EXIT"
274
+ | "UNKNOWN";
275
+
276
+ export type Event = "clientLocation" | "location" | "error" | "events" | "log";
277
+
278
+ export type RadarLogLevel = "info" | "debug" | "warning" | "error" | "none";
279
+
280
+ export interface RadarRouteMatrix {
281
+ status: string;
282
+ matrix?: RadarRoute[][];
146
283
  }
147
284
 
148
285
  export interface Location {
@@ -182,14 +319,6 @@ export interface RadarUser {
182
319
  debug?: boolean;
183
320
  fraud?: RadarFraud;
184
321
  }
185
- export interface RadarAutocompleteOptions {
186
- query: string;
187
- near?: Location;
188
- layers?: string[];
189
- limit: number;
190
- country?: string;
191
- expandUnits?: boolean;
192
- }
193
322
 
194
323
  export interface RadarCoordinate {
195
324
  type: string;
@@ -215,9 +344,9 @@ export interface RadarTrip {
215
344
  metadata?: RadarMetadata;
216
345
  destinationGeofenceTag?: string;
217
346
  destinationGeofenceExternalId?: string;
218
- mode?: string;
347
+ mode?: RadarRouteMode;
219
348
  eta?: RadarTripEta;
220
- status: string;
349
+ status: RadarTripStatus;
221
350
  scheduledArrivalAt?: Date;
222
351
  destinationLocation: Location;
223
352
  }
@@ -306,9 +435,10 @@ export interface RadarGeofence {
306
435
  tag?: string;
307
436
  externalId?: string;
308
437
  metadata?: RadarMetadata;
309
- type?: string;
438
+ type?: "Circle" | "Polygon";
310
439
  geometryRadius?: number;
311
440
  geometryCenter?: RadarCoordinate;
441
+ // only available for geofences of type "Polygon"
312
442
  coordinates?: number[][];
313
443
  }
314
444
 
@@ -350,41 +480,39 @@ export interface RadarRegion {
350
480
  flag?: string;
351
481
  }
352
482
 
353
- export interface RadarLocationPermissionsCallback {
354
- status: string;
355
- }
356
-
357
483
  export interface RadarAddress {
358
- latitude: number;
359
- longitude: number;
360
- placeLabel?: string;
361
484
  addressLabel?: string;
362
- formattedAddress?: string;
485
+ borough?: string;
486
+ city?: string;
487
+ confidence?: string;
363
488
  country?: string;
364
489
  countryCode?: string;
365
490
  countryFlag?: string;
366
- state?: string;
367
- stateCode?: string;
368
- postalCode?: string;
369
- city?: string;
370
- borough?: string;
371
491
  county?: string;
492
+ distance?: number;
493
+ dma?: string;
494
+ dmaCode?: string;
495
+ formattedAddress?: string;
496
+ latitude: number;
497
+ layer?: string;
498
+ longitude: number;
499
+ metadata?: RadarMetadata;
372
500
  neighborhood?: string;
373
501
  number?: string;
502
+ placeLabel?: string;
503
+ plus4?: string;
504
+ postalCode?: string;
505
+ state?: string;
506
+ stateCode?: string;
374
507
  street?: string;
375
508
  unit?: string;
376
- distance?: number;
377
- confidence?: string;
378
- layer?: string;
379
- plus4?: string;
380
- dmaCode?: string;
381
- dma?: string;
382
- metadata?: RadarMetadata;
383
509
  }
384
510
 
385
- export interface RadarAddressVerificationStatus {
386
- status: string;
387
- }
511
+ export type RadarVerificationStatus =
512
+ | "verified"
513
+ | "partially verified"
514
+ | "ambiguous"
515
+ | "unverified";
388
516
 
389
517
  export interface RadarRoutes {
390
518
  geodesic?: RadarRouteDistance;
@@ -411,15 +539,6 @@ export interface RadarRouteDistance {
411
539
  text: string;
412
540
  }
413
541
 
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
542
  export interface RadarRouteDuration {
424
543
  value: number;
425
544
  text: string;
@@ -440,56 +559,11 @@ export interface RadarFraud {
440
559
  jumped: boolean;
441
560
  }
442
561
 
443
- export interface RadarMockTrackingOptions {
444
- origin: Location;
445
- destination: Location;
446
- mode: RadarRouteMode;
447
- steps: number;
448
- interval: number;
449
- }
450
-
451
562
  export type RadarTrackingOptionsReplay = "all" | "stops" | "none";
452
563
 
453
564
  export type RadarTrackingOptionsSync = "none" | "stopsAndExits" | "all";
454
565
 
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
- export type RadarRouteMode = "foot" | "bike" | "car";
489
-
490
- export interface RadarTrackingStatus {
491
- isTracking: string;
492
- }
566
+ export type RadarRouteMode = "foot" | "bike" | "car" | "truck" | "motorbike";
493
567
 
494
568
  export interface RadarTrackingOptionsForegroundService {
495
569
  text?: string;
@@ -502,16 +576,6 @@ export interface RadarTrackingOptionsForegroundService {
502
576
  channelName?: string;
503
577
  }
504
578
 
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
579
  export type RadarTripStatus =
516
580
  | "unknown"
517
581
  | "started"
@@ -520,46 +584,3 @@ export type RadarTripStatus =
520
584
  | "expired"
521
585
  | "completed"
522
586
  | "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;
@@ -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> => NativeModules.RNRadar.getMetadata();
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
- // Take a closer look?
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<RadarAddressCallback> =>
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: RadarGetMatrixOptions
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
- // if (Platform.OS === "web") {
9
- // module = require("./index.web").default;
10
- // } else {
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";