react-native-radar 3.15.0 → 3.17.0

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.
Files changed (61) hide show
  1. package/README.md +10 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/io/radar/react/RNRadarModule.java +20 -8
  4. package/app.plugin.js +1 -0
  5. package/dist/{src/ui → ui}/autocomplete.d.ts +2 -1
  6. package/dist/{src/ui → ui}/autocomplete.js +1 -1
  7. package/dist/{src/ui → ui}/map.d.ts +2 -1
  8. package/ios/Cartfile.resolved +1 -1
  9. package/ios/RNRadar.m +13 -5
  10. package/package.json +18 -11
  11. package/plugin/build/index.d.ts +3 -0
  12. package/plugin/build/index.js +6 -0
  13. package/plugin/build/types.d.ts +11 -0
  14. package/plugin/build/types.js +2 -0
  15. package/plugin/build/withRadar.d.ts +4 -0
  16. package/plugin/build/withRadar.js +26 -0
  17. package/plugin/build/withRadarAndroid.d.ts +3 -0
  18. package/plugin/build/withRadarAndroid.js +110 -0
  19. package/plugin/build/withRadarIOS.d.ts +3 -0
  20. package/plugin/build/withRadarIOS.js +75 -0
  21. package/react-native-radar.podspec +1 -1
  22. package/dist/package.json +0 -84
  23. package/src/@types/RadarNativeInterface.ts +0 -106
  24. package/src/@types/types.ts +0 -784
  25. package/src/helpers.js +0 -15
  26. package/src/index.native.ts +0 -298
  27. package/src/index.ts +0 -22
  28. package/src/index.web.js +0 -410
  29. package/src/ui/autocomplete.jsx +0 -323
  30. package/src/ui/back.png +0 -0
  31. package/src/ui/close.png +0 -0
  32. package/src/ui/images.js +0 -5
  33. package/src/ui/map-logo.png +0 -0
  34. package/src/ui/map.jsx +0 -122
  35. package/src/ui/marker.png +0 -0
  36. package/src/ui/radar-logo.png +0 -0
  37. package/src/ui/search.png +0 -0
  38. package/src/ui/styles.js +0 -125
  39. /package/dist/{src/@types → @types}/RadarNativeInterface.d.ts +0 -0
  40. /package/dist/{src/@types → @types}/RadarNativeInterface.js +0 -0
  41. /package/dist/{src/@types → @types}/types.d.ts +0 -0
  42. /package/dist/{src/@types → @types}/types.js +0 -0
  43. /package/dist/{src/helpers.d.ts → helpers.d.ts} +0 -0
  44. /package/dist/{src/helpers.js → helpers.js} +0 -0
  45. /package/dist/{src/index.d.ts → index.d.ts} +0 -0
  46. /package/dist/{src/index.js → index.js} +0 -0
  47. /package/dist/{src/index.native.d.ts → index.native.d.ts} +0 -0
  48. /package/dist/{src/index.native.js → index.native.js} +0 -0
  49. /package/dist/{src/index.web.d.ts → index.web.d.ts} +0 -0
  50. /package/dist/{src/index.web.js → index.web.js} +0 -0
  51. /package/dist/{src/ui → ui}/back.png +0 -0
  52. /package/dist/{src/ui → ui}/close.png +0 -0
  53. /package/dist/{src/ui → ui}/images.d.ts +0 -0
  54. /package/dist/{src/ui → ui}/images.js +0 -0
  55. /package/dist/{src/ui → ui}/map-logo.png +0 -0
  56. /package/dist/{src/ui → ui}/map.js +0 -0
  57. /package/dist/{src/ui → ui}/marker.png +0 -0
  58. /package/dist/{src/ui → ui}/radar-logo.png +0 -0
  59. /package/dist/{src/ui → ui}/search.png +0 -0
  60. /package/dist/{src/ui → ui}/styles.d.ts +0 -0
  61. /package/dist/{src/ui → ui}/styles.js +0 -0
package/src/helpers.js DELETED
@@ -1,15 +0,0 @@
1
- import { NativeModules, Platform } from 'react-native';
2
-
3
- if (!NativeModules.RNRadar && (Platform.OS === 'ios' || Platform.OS === 'android')) {
4
- throw new Error('NativeModules.RNRadar is undefined');
5
- }
6
-
7
- const getHost = () => (
8
- NativeModules.RNRadar.getHost()
9
- );
10
-
11
- const getPublishableKey = () => (
12
- NativeModules.RNRadar.getPublishableKey()
13
- );
14
-
15
- export { getHost, getPublishableKey };
@@ -1,298 +0,0 @@
1
- import { NativeEventEmitter, NativeModules, Platform } from "react-native";
2
- import { version } from "../package.json";
3
- import { RadarNativeInterface } from "./@types/RadarNativeInterface";
4
- import {
5
- Location,
6
- RadarAutocompleteOptions,
7
- RadarContextCallback,
8
- RadarAddressCallback,
9
- RadarEventChannel,
10
- RadarGeocodeOptions,
11
- RadarGetDistanceOptions,
12
- RadarLocationCallback,
13
- RadarLogConversionCallback,
14
- RadarLogConversionOptions,
15
- RadarLogLevel,
16
- RadarMockTrackingOptions,
17
- RadarNotificationOptions,
18
- RadarPermissionsStatus,
19
- RadarReverseGeocodeOptions,
20
- RadarRouteCallback,
21
- RadarRouteMatrix,
22
- RadarSearchGeofencesCallback,
23
- RadarSearchGeofencesOptions,
24
- RadarSearchPlacesCallback,
25
- RadarSearchPlacesOptions,
26
- RadarStartTripOptions,
27
- RadarTrackCallback,
28
- RadarTrackOnceOptions,
29
- RadarTrackingOptions,
30
- RadarTrackingOptionsDesiredAccuracy,
31
- RadarTrackingOptionsForegroundService,
32
- RadarTripCallback,
33
- RadarTripOptions,
34
- RadarUpdateTripOptions,
35
- RadarVerifiedTrackingOptions,
36
- RadarListenerCallback,
37
- RadarGetMatrixOptions,
38
- RadarMetadata,
39
- RadarIPGeocodeCallback,
40
- RadarTrackVerifiedOptions,
41
- RadarTrackVerifiedCallback,
42
- } from "./@types/types";
43
-
44
- if (
45
- !NativeModules.RNRadar &&
46
- (Platform.OS === "ios" || Platform.OS === "android")
47
- ) {
48
- throw new Error("NativeModules.RNRadar is undefined");
49
- }
50
-
51
- const eventEmitter = new NativeEventEmitter(NativeModules.RNRadar);
52
-
53
- const initialize = (publishableKey: string, fraud: boolean = false): void => {
54
- NativeModules.RNRadar.initialize(publishableKey, fraud);
55
- };
56
-
57
- const setLogLevel = (level: RadarLogLevel): void => {
58
- NativeModules.RNRadar.setLogLevel(level);
59
- };
60
-
61
- const setUserId = (userId: string): void => {
62
- NativeModules.RNRadar.setUserId(userId);
63
- };
64
-
65
- const getUserId = (): Promise<string> => NativeModules.RNRadar.getUserId();
66
-
67
- const setDescription = (description: string): void => {
68
- NativeModules.RNRadar.setDescription(description);
69
- };
70
-
71
- const getDescription = (): Promise<string> =>
72
- NativeModules.RNRadar.getDescription();
73
-
74
- const setMetadata = (metadata: RadarMetadata): void => {
75
- NativeModules.RNRadar.setMetadata(metadata);
76
- };
77
-
78
- const getMetadata = (): Promise<RadarMetadata> =>
79
- NativeModules.RNRadar.getMetadata();
80
-
81
- const setAnonymousTrackingEnabled = (enabled: boolean): void =>
82
- NativeModules.RNRadar.setAnonymousTrackingEnabled(enabled);
83
-
84
- const getPermissionsStatus = (): Promise<RadarPermissionsStatus> =>
85
- NativeModules.RNRadar.getPermissionsStatus();
86
-
87
- const requestPermissions = (
88
- background: boolean
89
- ): Promise<RadarPermissionsStatus> =>
90
- NativeModules.RNRadar.requestPermissions(background);
91
-
92
- const getLocation = (
93
- desiredAccuracy?: RadarTrackingOptionsDesiredAccuracy
94
- ): Promise<RadarLocationCallback> =>
95
- NativeModules.RNRadar.getLocation(desiredAccuracy);
96
-
97
- const trackOnce = (
98
- options?: RadarTrackOnceOptions | Location
99
- ): Promise<RadarTrackCallback> => {
100
- let backCompatibleOptions = options;
101
- if (options && "latitude" in options) {
102
- backCompatibleOptions = {
103
- location: {
104
- ...options,
105
- },
106
- };
107
- }
108
- return NativeModules.RNRadar.trackOnce(backCompatibleOptions);
109
- };
110
-
111
- const trackVerified = (
112
- options?: RadarTrackVerifiedOptions
113
- ): Promise<RadarTrackVerifiedCallback> =>
114
- NativeModules.RNRadar.trackVerified(options);
115
-
116
- const getVerifiedLocationToken = (): Promise<RadarTrackVerifiedCallback> =>
117
- NativeModules.RNRadar.getVerifiedLocationToken();
118
-
119
- const startTrackingEfficient = (): void =>
120
- NativeModules.RNRadar.startTrackingEfficient();
121
-
122
- const startTrackingResponsive = (): void =>
123
- NativeModules.RNRadar.startTrackingResponsive();
124
-
125
- const startTrackingContinuous = (): void =>
126
- NativeModules.RNRadar.startTrackingContinuous();
127
-
128
- const startTrackingCustom = (options: RadarTrackingOptions): void =>
129
- NativeModules.RNRadar.startTrackingCustom(options);
130
-
131
- const startTrackingVerified = (options?: RadarVerifiedTrackingOptions): void =>
132
- NativeModules.RNRadar.startTrackingVerified(options);
133
-
134
- const mockTracking = (options: RadarMockTrackingOptions): void =>
135
- NativeModules.RNRadar.mockTracking(options);
136
-
137
- const stopTracking = (): void => NativeModules.RNRadar.stopTracking();
138
-
139
- const stopTrackingVerified = (): void =>
140
- NativeModules.RNRadar.stopTrackingVerified();
141
-
142
- const getTrackingOptions = (): Promise<RadarTrackingOptions> =>
143
- NativeModules.RNRadar.getTrackingOptions();
144
-
145
- const isUsingRemoteTrackingOptions = (): Promise<boolean> =>
146
- NativeModules.RNRadar.isUsingRemoteTrackingOptions();
147
-
148
- const isTracking = (): Promise<boolean> => NativeModules.RNRadar.isTracking();
149
-
150
- const setForegroundServiceOptions = (
151
- options: RadarTrackingOptionsForegroundService
152
- ): void => NativeModules.RNRadar.setForegroundServiceOptions(options);
153
-
154
- const setNotificationOptions = (options: RadarNotificationOptions): void =>
155
- NativeModules.RNRadar.setNotificationOptions(options);
156
-
157
- const getTripOptions = (): Promise<RadarTripOptions> =>
158
- NativeModules.RNRadar.getTripOptions();
159
-
160
- const startTrip = (
161
- options: RadarStartTripOptions
162
- ): Promise<RadarTripCallback> => NativeModules.RNRadar.startTrip(options);
163
-
164
- const completeTrip = (): Promise<RadarTripCallback> =>
165
- NativeModules.RNRadar.completeTrip();
166
-
167
- const cancelTrip = (): Promise<RadarTripCallback> =>
168
- NativeModules.RNRadar.cancelTrip();
169
-
170
- const updateTrip = (
171
- options: RadarUpdateTripOptions
172
- ): Promise<RadarTripCallback> => NativeModules.RNRadar.updateTrip(options);
173
-
174
- const acceptEvent = (eventId: string, verifiedPlaceId: string): void =>
175
- NativeModules.RNRadar.acceptEvent(eventId, verifiedPlaceId);
176
-
177
- const rejectEvent = (eventId: string): void =>
178
- NativeModules.RNRadar.rejectEvent(eventId);
179
-
180
- const getContext = (location?: Location): Promise<RadarContextCallback> =>
181
- NativeModules.RNRadar.getContext(location);
182
-
183
- const searchPlaces = (
184
- options: RadarSearchPlacesOptions
185
- ): Promise<RadarSearchPlacesCallback> =>
186
- NativeModules.RNRadar.searchPlaces(options);
187
-
188
- const searchGeofences = (
189
- options: RadarSearchGeofencesOptions
190
- ): Promise<RadarSearchGeofencesCallback> =>
191
- NativeModules.RNRadar.searchGeofences(options);
192
-
193
- const autocomplete = (
194
- options: RadarAutocompleteOptions
195
- ): Promise<RadarAddressCallback> => NativeModules.RNRadar.autocomplete(options);
196
-
197
- const geocode = (options: RadarGeocodeOptions): Promise<RadarAddressCallback> =>
198
- NativeModules.RNRadar.geocode(options);
199
-
200
- const reverseGeocode = (
201
- options?: RadarReverseGeocodeOptions
202
- ): Promise<RadarAddressCallback> =>
203
- NativeModules.RNRadar.reverseGeocode(options);
204
-
205
- const ipGeocode = (): Promise<RadarIPGeocodeCallback> =>
206
- NativeModules.RNRadar.ipGeocode();
207
-
208
- const getDistance = (
209
- options: RadarGetDistanceOptions
210
- ): Promise<RadarRouteCallback> => NativeModules.RNRadar.getDistance(options);
211
-
212
- const getMatrix = (options: RadarGetMatrixOptions): Promise<RadarRouteMatrix> =>
213
- NativeModules.RNRadar.getMatrix(options);
214
-
215
- const logConversion = (
216
- options: RadarLogConversionOptions
217
- ): Promise<RadarLogConversionCallback> =>
218
- NativeModules.RNRadar.logConversion(options);
219
-
220
- const sendEvent = (name: string, metadata: RadarMetadata): void =>
221
- NativeModules.RNRadar.sendEvent(name, metadata);
222
-
223
- const on = (
224
- channel: RadarEventChannel,
225
- callback: RadarListenerCallback
226
- ): void => eventEmitter.addListener(channel, callback);
227
-
228
- const off = (
229
- channel: RadarEventChannel,
230
- callback?: Function | undefined
231
- ): void => {
232
- if (callback) {
233
- // @ts-ignore
234
- eventEmitter.removeListener(channel, callback);
235
- } else {
236
- eventEmitter.removeAllListeners(channel);
237
- }
238
- };
239
-
240
- const nativeSdkVersion = (): Promise<string> =>
241
- NativeModules.RNRadar.nativeSdkVersion();
242
-
243
- const rnSdkVersion = (): string => version;
244
-
245
- const Radar: RadarNativeInterface = {
246
- initialize,
247
- setLogLevel,
248
- setUserId,
249
- getUserId,
250
- setDescription,
251
- getDescription,
252
- setMetadata,
253
- getMetadata,
254
- setAnonymousTrackingEnabled,
255
- isUsingRemoteTrackingOptions,
256
- getPermissionsStatus,
257
- requestPermissions,
258
- getLocation,
259
- trackOnce,
260
- trackVerified,
261
- getVerifiedLocationToken,
262
- startTrackingEfficient,
263
- startTrackingResponsive,
264
- startTrackingContinuous,
265
- startTrackingCustom,
266
- startTrackingVerified,
267
- mockTracking,
268
- stopTracking,
269
- stopTrackingVerified,
270
- isTracking,
271
- getTrackingOptions,
272
- setForegroundServiceOptions,
273
- setNotificationOptions,
274
- acceptEvent,
275
- rejectEvent,
276
- getTripOptions,
277
- startTrip,
278
- updateTrip,
279
- completeTrip,
280
- cancelTrip,
281
- getContext,
282
- searchPlaces,
283
- searchGeofences,
284
- autocomplete,
285
- geocode,
286
- reverseGeocode,
287
- ipGeocode,
288
- getDistance,
289
- getMatrix,
290
- logConversion,
291
- sendEvent,
292
- on,
293
- off,
294
- nativeSdkVersion,
295
- rnSdkVersion,
296
- };
297
-
298
- export default Radar;
package/src/index.ts DELETED
@@ -1,22 +0,0 @@
1
- import { RadarNativeInterface } from "./@types/RadarNativeInterface";
2
- import { Platform } from "react-native";
3
-
4
- let module: RadarNativeInterface;
5
-
6
- module = require("./index.native").default;
7
-
8
- export default module;
9
-
10
- let RadarRNWeb = Platform.OS === "web" ? require("./index.web").default : {};
11
-
12
- export { RadarRNWeb };
13
-
14
- let Autocomplete =
15
- Platform.OS !== "web" ? require("./ui/autocomplete").default : {};
16
- export { Autocomplete };
17
-
18
- let Map = Platform.OS !== "web" ? require("./ui/map").default : {};
19
- export { Map };
20
-
21
- export * from "./@types/types";
22
- export * from "./@types/RadarNativeInterface";