react-native-radar 3.20.4 → 3.21.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Radar.podspec +22 -0
- package/android/build.gradle +77 -35
- package/android/gradle.properties +5 -1
- package/android/src/main/AndroidManifest.xml +1 -3
- package/android/src/main/java/{io/radar/react/RNRadarModule.java → com/radar/RadarModuleImpl.java} +131 -258
- package/android/src/main/java/com/radar/RadarPackage.kt +35 -0
- package/android/src/main/java/{io/radar/react/RNRadarUtils.java → com/radar/RadarUtils.java} +3 -2
- package/android/src/newarch/java/com/radar/RadarModule.kt +381 -0
- package/android/src/oldarch/java/com/radar/RadarModule.java +416 -0
- package/android/src/{main/java/io/radar/react/RNRadarReceiver.java → oldarch/java/com/radar/RadarOldArchReceiver.java} +8 -8
- package/android/src/{main/java/io/radar/react/RNRadarVerifiedReceiver.java → oldarch/java/com/radar/RadarOldArchVerifiedReceiver.java} +4 -4
- package/app.plugin.js +1 -1
- package/ios/RNRadar.h +11 -2
- package/ios/{RNRadar.m → RNRadar.mm} +77 -39
- package/lib/commonjs/@types/RadarNativeInterface.js +2 -0
- package/lib/commonjs/@types/RadarNativeInterface.js.map +1 -0
- package/lib/commonjs/@types/types.js +2 -0
- package/lib/commonjs/@types/types.js.map +1 -0
- package/lib/commonjs/NativeRadar.js +2 -0
- package/lib/commonjs/NativeRadar.js.map +1 -0
- package/lib/commonjs/helpers.js +2 -0
- package/lib/commonjs/helpers.js.map +1 -0
- package/lib/commonjs/index.js +2 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/index.native.js +2 -0
- package/lib/commonjs/index.native.js.map +1 -0
- package/lib/commonjs/index.web.js +2 -0
- package/lib/commonjs/index.web.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/plugin/types.js +2 -0
- package/lib/commonjs/plugin/types.js.map +1 -0
- package/lib/commonjs/plugin/withRadar.js +2 -0
- package/lib/commonjs/plugin/withRadar.js.map +1 -0
- package/lib/commonjs/plugin/withRadarAndroid.js +2 -0
- package/lib/commonjs/plugin/withRadarAndroid.js.map +1 -0
- package/lib/commonjs/plugin/withRadarIOS.js +2 -0
- package/lib/commonjs/plugin/withRadarIOS.js.map +1 -0
- package/lib/commonjs/ui/autocomplete.js +2 -0
- package/lib/commonjs/ui/autocomplete.js.map +1 -0
- package/lib/commonjs/ui/images.js +2 -0
- package/lib/commonjs/ui/images.js.map +1 -0
- package/lib/commonjs/ui/map.js +2 -0
- package/lib/commonjs/ui/map.js.map +1 -0
- package/lib/commonjs/ui/styles.js +2 -0
- package/lib/commonjs/ui/styles.js.map +1 -0
- package/lib/commonjs/version.js +2 -0
- package/lib/commonjs/version.js.map +1 -0
- package/{dist → lib/typescript/src}/@types/RadarNativeInterface.d.ts +18 -7
- package/lib/typescript/src/@types/RadarNativeInterface.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/@types/types.d.ts +5 -3
- package/lib/typescript/src/@types/types.d.ts.map +1 -0
- package/lib/typescript/src/NativeRadar.d.ts +87 -0
- package/lib/typescript/src/NativeRadar.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/index.native.d.ts +7 -0
- package/lib/typescript/src/index.native.d.ts.map +1 -0
- package/lib/typescript/src/plugin/types.d.ts +13 -0
- package/lib/typescript/src/plugin/types.d.ts.map +1 -0
- package/{plugin/build → lib/typescript/src/plugin}/withRadar.d.ts +2 -1
- package/lib/typescript/src/plugin/withRadar.d.ts.map +1 -0
- package/{plugin/build → lib/typescript/src/plugin}/withRadarAndroid.d.ts +1 -0
- package/lib/typescript/src/plugin/withRadarAndroid.d.ts.map +1 -0
- package/{plugin/build → lib/typescript/src/plugin}/withRadarIOS.d.ts +1 -0
- package/lib/typescript/src/plugin/withRadarIOS.d.ts.map +1 -0
- package/lib/typescript/src/version.d.ts +2 -0
- package/lib/typescript/src/version.d.ts.map +1 -0
- package/package.json +85 -34
- package/react-native.config.js +10 -0
- package/src/@types/RadarNativeInterface.ts +127 -0
- package/src/@types/types.ts +808 -0
- package/src/NativeRadar.ts +95 -0
- package/src/helpers.js +11 -0
- package/src/index.native.ts +419 -0
- package/src/index.tsx +22 -0
- package/src/index.web.js +528 -0
- package/{plugin/build/types.d.ts → src/plugin/types.ts} +1 -1
- package/src/plugin/withRadar.ts +39 -0
- package/src/plugin/withRadarAndroid.ts +147 -0
- package/src/plugin/withRadarIOS.ts +80 -0
- package/src/ui/autocomplete.jsx +324 -0
- package/src/ui/back.png +0 -0
- package/src/ui/close.png +0 -0
- package/src/ui/images.js +5 -0
- package/src/ui/map-logo.png +0 -0
- package/src/ui/map.jsx +122 -0
- package/src/ui/marker.png +0 -0
- package/src/ui/radar-logo.png +0 -0
- package/src/ui/search.png +0 -0
- package/src/ui/styles.js +125 -0
- package/src/version.ts +3 -0
- package/android/build.gradle.template +0 -49
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/android/gradlew +0 -160
- package/android/gradlew.bat +0 -90
- package/android/proguard-rules.pro +0 -4
- package/android/src/main/java/io/radar/react/RNRadarPackage.java +0 -29
- package/dist/@types/RadarNativeInterface.js +0 -2
- package/dist/@types/types.js +0 -150
- package/dist/helpers.d.ts +0 -2
- package/dist/helpers.js +0 -11
- package/dist/index.js +0 -29
- package/dist/index.native.d.ts +0 -3
- package/dist/index.native.js +0 -150
- package/dist/index.web.d.ts +0 -113
- package/dist/index.web.js +0 -516
- package/dist/ui/autocomplete.d.ts +0 -5
- package/dist/ui/autocomplete.js +0 -206
- package/dist/ui/images.d.ts +0 -5
- package/dist/ui/images.js +0 -8
- package/dist/ui/map.d.ts +0 -6
- package/dist/ui/map.js +0 -122
- package/dist/ui/styles.d.ts +0 -172
- package/dist/ui/styles.js +0 -125
- package/ios/Cartfile.private +0 -1
- package/ios/Cartfile.resolved +0 -1
- package/ios/Cartfile.resolved.template +0 -1
- package/ios/RNRadar.xcodeproj/project.pbxproj +0 -521
- package/ios/RNRadar.xcodeproj/xcshareddata/xcschemes/RNRadar.xcscheme +0 -76
- package/plugin/build/index.d.ts +0 -3
- package/plugin/build/index.js +0 -6
- package/plugin/build/types.js +0 -2
- package/plugin/build/withRadar.js +0 -26
- package/plugin/build/withRadarAndroid.js +0 -98
- package/plugin/build/withRadarIOS.js +0 -76
- package/react-native-radar.podspec +0 -19
- /package/{dist → lib/commonjs}/ui/back.png +0 -0
- /package/{dist → lib/commonjs}/ui/close.png +0 -0
- /package/{dist → lib/commonjs}/ui/map-logo.png +0 -0
- /package/{dist → lib/commonjs}/ui/marker.png +0 -0
- /package/{dist → lib/commonjs}/ui/radar-logo.png +0 -0
- /package/{dist → lib/commonjs}/ui/search.png +0 -0
package/dist/index.web.js
DELETED
|
@@ -1,516 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const radar_sdk_js_1 = __importDefault(require("radar-sdk-js"));
|
|
7
|
-
const package_json_1 = require("../package.json");
|
|
8
|
-
let throws = false;
|
|
9
|
-
const throwOnUnimplemented = (value) => {
|
|
10
|
-
throws = value;
|
|
11
|
-
};
|
|
12
|
-
const initialize = (publishableKey) => {
|
|
13
|
-
radar_sdk_js_1.default.initialize(publishableKey);
|
|
14
|
-
};
|
|
15
|
-
const setLogLevel = (level) => {
|
|
16
|
-
if (throws)
|
|
17
|
-
throw new Error("setLogLevel() is not implemented on web");
|
|
18
|
-
};
|
|
19
|
-
const setUserId = (userId) => {
|
|
20
|
-
radar_sdk_js_1.default.setUserId(userId);
|
|
21
|
-
};
|
|
22
|
-
const getUserId = () => {
|
|
23
|
-
if (throws)
|
|
24
|
-
throw new Error("getUserId() is not implemented on web");
|
|
25
|
-
return new Promise((resolve, reject) => { reject("getUserId() is not implemented on web"); });
|
|
26
|
-
};
|
|
27
|
-
const setDeviceId = (deviceId, installId) => {
|
|
28
|
-
radar_sdk_js_1.default.setDeviceId(deviceId, installId);
|
|
29
|
-
};
|
|
30
|
-
const setDeviceType = (deviceType) => {
|
|
31
|
-
radar_sdk_js_1.default.setDeviceType(deviceType);
|
|
32
|
-
};
|
|
33
|
-
const setRequestHeaders = (headers) => {
|
|
34
|
-
radar_sdk_js_1.default.setRequestHeaders(headers);
|
|
35
|
-
};
|
|
36
|
-
const setDescription = (description) => {
|
|
37
|
-
radar_sdk_js_1.default.setDescription(description);
|
|
38
|
-
};
|
|
39
|
-
const getDescription = () => {
|
|
40
|
-
if (throws)
|
|
41
|
-
throw new Error("getDescription() is not implemented on web");
|
|
42
|
-
return new Promise((resolve, reject) => { reject("getDescription() is not implemented on web"); });
|
|
43
|
-
};
|
|
44
|
-
const setMetadata = (metadata) => {
|
|
45
|
-
radar_sdk_js_1.default.setMetadata(metadata);
|
|
46
|
-
};
|
|
47
|
-
const getMetadata = () => {
|
|
48
|
-
if (throws)
|
|
49
|
-
throw new Error("getMetadata() is not implemented on web");
|
|
50
|
-
return new Promise((resolve, reject) => { reject("getMetadata() is not implemented on web"); });
|
|
51
|
-
};
|
|
52
|
-
const setAnonymousTrackingEnabled = () => {
|
|
53
|
-
if (throws)
|
|
54
|
-
throw new Error("setAnonymousTrackingEnabled() is not implemented on web");
|
|
55
|
-
};
|
|
56
|
-
const getPermissionsStatus = () => {
|
|
57
|
-
return new Promise(resolve => {
|
|
58
|
-
const navigator = window.navigator;
|
|
59
|
-
if (!navigator.permissions) {
|
|
60
|
-
resolve({
|
|
61
|
-
status: 'UNKNOWN'
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
navigator.permissions.query({ name: 'geolocation' }).then((result) => {
|
|
66
|
-
resolve({
|
|
67
|
-
status: result.state === 'granted' ? 'GRANTED_FOREGROUND' : 'DENIED',
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
const requestPermissions = (background) => {
|
|
74
|
-
if (throws)
|
|
75
|
-
throw new Error("requestPermissions() is not implemented on web");
|
|
76
|
-
return new Promise((resolve, reject) => { reject("requestPermissions() is not implemented on web"); });
|
|
77
|
-
};
|
|
78
|
-
const getLocation = () => {
|
|
79
|
-
return new Promise((resolve, reject) => {
|
|
80
|
-
radar_sdk_js_1.default.getLocation((err, result) => {
|
|
81
|
-
if (err)
|
|
82
|
-
reject(err);
|
|
83
|
-
else
|
|
84
|
-
resolve(result);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
const trackOnce = (options) => {
|
|
89
|
-
return new Promise((resolve, reject) => {
|
|
90
|
-
const callback = (err, { status, location, user, events }) => {
|
|
91
|
-
if (err) {
|
|
92
|
-
reject(err);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
resolve({
|
|
96
|
-
status,
|
|
97
|
-
location,
|
|
98
|
-
user,
|
|
99
|
-
events,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
if (options) {
|
|
104
|
-
radar_sdk_js_1.default.trackOnce(options.location ? options.location : options, callback);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
radar_sdk_js_1.default.trackOnce(callback);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
const trackVerified = () => {
|
|
112
|
-
if (throws)
|
|
113
|
-
throw new Error("trackVerified() is not implemented on web");
|
|
114
|
-
return new Promise((resolve, reject) => { reject("trackVerified() is not implemented on web"); });
|
|
115
|
-
};
|
|
116
|
-
const getVerifiedLocationToken = () => {
|
|
117
|
-
if (throws)
|
|
118
|
-
throw new Error("getVerifiedLocationToken() is not implemented on web");
|
|
119
|
-
return new Promise((resolve, reject) => { reject("getVerifiedLocationToken() is not implemented on web"); });
|
|
120
|
-
};
|
|
121
|
-
const startTrackingEfficient = () => {
|
|
122
|
-
if (throws)
|
|
123
|
-
throw new Error("startTrackingEfficient() is not implemented on web");
|
|
124
|
-
};
|
|
125
|
-
const startTrackingResponsive = () => {
|
|
126
|
-
if (throws)
|
|
127
|
-
throw new Error("startTrackingResponsive() is not implemented on web");
|
|
128
|
-
};
|
|
129
|
-
const startTrackingContinuous = () => {
|
|
130
|
-
if (throws)
|
|
131
|
-
throw new Error("startTrackingContinuous() is not implemented on web");
|
|
132
|
-
};
|
|
133
|
-
const startTrackingCustom = (options) => {
|
|
134
|
-
if (throws)
|
|
135
|
-
throw new Error("startTrackingCustom() is not implemented on web");
|
|
136
|
-
};
|
|
137
|
-
const startTrackingVerified = (options) => {
|
|
138
|
-
if (throws)
|
|
139
|
-
throw new Error("startTrackingVerified() is not implemented on web");
|
|
140
|
-
};
|
|
141
|
-
const mockTracking = (options) => {
|
|
142
|
-
if (throws)
|
|
143
|
-
throw new Error("mockTracking() is not implemented on web");
|
|
144
|
-
};
|
|
145
|
-
const stopTracking = () => {
|
|
146
|
-
if (throws)
|
|
147
|
-
throw new Error("stopTracking() is not implemented on web");
|
|
148
|
-
};
|
|
149
|
-
const stopTrackingVerified = () => {
|
|
150
|
-
if (throws)
|
|
151
|
-
throw new Error("stopTrackingVerified() is not implemented on web");
|
|
152
|
-
};
|
|
153
|
-
const isTracking = () => {
|
|
154
|
-
if (throws)
|
|
155
|
-
throw new Error("isTracking() is not implemented on web");
|
|
156
|
-
return new Promise((resolve, reject) => { reject("isTracking() is not implemented on web"); });
|
|
157
|
-
};
|
|
158
|
-
const getTrackingOptions = () => {
|
|
159
|
-
if (throws)
|
|
160
|
-
throw new Error("getTrackingOptions() is not implemented on web");
|
|
161
|
-
return new Promise((resolve, reject) => { reject("getTrackingOptions() is not implemented on web"); });
|
|
162
|
-
};
|
|
163
|
-
const isUsingRemoteTrackingOptions = () => {
|
|
164
|
-
if (throws)
|
|
165
|
-
throw new Error("isUsingRemoteTrackingOptions() is not implemented on web");
|
|
166
|
-
return new Promise((resolve, reject) => { reject("isUsingRemoteTrackingOptions() is not implemented on web"); });
|
|
167
|
-
};
|
|
168
|
-
const setForegroundServiceOptions = (options) => {
|
|
169
|
-
if (throws)
|
|
170
|
-
throw new Error("setForegroundServiceOptions() is not implemented on web");
|
|
171
|
-
};
|
|
172
|
-
const setNotificationOptions = (options) => {
|
|
173
|
-
if (throws)
|
|
174
|
-
throw new Error("setNotificationOptions() is not implemented on web");
|
|
175
|
-
};
|
|
176
|
-
const getTripOptions = () => {
|
|
177
|
-
if (throws)
|
|
178
|
-
throw new Error("getTripOptions() is not implemented on web");
|
|
179
|
-
return new Promise((resolve, reject) => { reject("getTripOptions() is not implemented on web"); });
|
|
180
|
-
};
|
|
181
|
-
const startTrip = (options) => {
|
|
182
|
-
if (options.tripOptions) {
|
|
183
|
-
options = options.tripOptions;
|
|
184
|
-
}
|
|
185
|
-
console.log(options);
|
|
186
|
-
return new Promise((resolve, reject) => {
|
|
187
|
-
const callback = (err, { trip, events, status }) => {
|
|
188
|
-
if (err) {
|
|
189
|
-
reject(err);
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
resolve({
|
|
193
|
-
trip,
|
|
194
|
-
events,
|
|
195
|
-
status
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
radar_sdk_js_1.default.startTrip(options, callback);
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
|
-
const completeTrip = () => {
|
|
203
|
-
return new Promise((resolve, reject) => {
|
|
204
|
-
const callback = (err, { trip, events, status }) => {
|
|
205
|
-
if (err) {
|
|
206
|
-
reject(err);
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
resolve({
|
|
210
|
-
trip,
|
|
211
|
-
events,
|
|
212
|
-
status
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
radar_sdk_js_1.default.completeTrip(callback);
|
|
217
|
-
});
|
|
218
|
-
};
|
|
219
|
-
const cancelTrip = () => {
|
|
220
|
-
return new Promise((resolve, reject) => {
|
|
221
|
-
const callback = (err, { trip, events, status }) => {
|
|
222
|
-
if (err) {
|
|
223
|
-
reject(err);
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
resolve({
|
|
227
|
-
trip,
|
|
228
|
-
events,
|
|
229
|
-
status
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
radar_sdk_js_1.default.cancelTrip(callback);
|
|
234
|
-
});
|
|
235
|
-
};
|
|
236
|
-
const updateTrip = (tripOptions) => {
|
|
237
|
-
return new Promise((resolve, reject) => {
|
|
238
|
-
const callback = (err, { trip, events, status }) => {
|
|
239
|
-
if (err) {
|
|
240
|
-
reject(err);
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
resolve({
|
|
244
|
-
trip,
|
|
245
|
-
events,
|
|
246
|
-
status
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
radar_sdk_js_1.default.updateTrip(tripOptions.options, tripOptions.status, callback);
|
|
251
|
-
});
|
|
252
|
-
};
|
|
253
|
-
const acceptEvent = (eventId, verifiedPlaceId) => {
|
|
254
|
-
if (throws)
|
|
255
|
-
throw new Error("acceptEvent() is not implemented on web");
|
|
256
|
-
};
|
|
257
|
-
const rejectEvent = (eventId) => {
|
|
258
|
-
if (throws)
|
|
259
|
-
throw new Error("rejectEvent() is not implemented on web");
|
|
260
|
-
};
|
|
261
|
-
const getContext = (options) => {
|
|
262
|
-
return new Promise((resolve, reject) => {
|
|
263
|
-
const callback = (err, { status, location, context }) => {
|
|
264
|
-
if (err) {
|
|
265
|
-
reject(err);
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
resolve({
|
|
269
|
-
status,
|
|
270
|
-
location,
|
|
271
|
-
context,
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
if (options) {
|
|
276
|
-
radar_sdk_js_1.default.getContext(options, callback);
|
|
277
|
-
}
|
|
278
|
-
else {
|
|
279
|
-
radar_sdk_js_1.default.getContext(callback);
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
};
|
|
283
|
-
const searchPlaces = (options) => {
|
|
284
|
-
return new Promise((resolve, reject) => {
|
|
285
|
-
radar_sdk_js_1.default.searchPlaces(options, (err, { status, location, places }) => {
|
|
286
|
-
if (err) {
|
|
287
|
-
reject(err);
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
resolve({
|
|
291
|
-
status,
|
|
292
|
-
location,
|
|
293
|
-
places,
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
};
|
|
299
|
-
const searchGeofences = (options) => {
|
|
300
|
-
return new Promise((resolve, reject) => {
|
|
301
|
-
radar_sdk_js_1.default.searchGeofences(options, (err, { status, location, geofences }) => {
|
|
302
|
-
if (err) {
|
|
303
|
-
reject(err);
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
resolve({
|
|
307
|
-
status,
|
|
308
|
-
location,
|
|
309
|
-
geofences,
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
});
|
|
314
|
-
};
|
|
315
|
-
const autocomplete = (options) => {
|
|
316
|
-
return new Promise((resolve, reject) => {
|
|
317
|
-
radar_sdk_js_1.default.autocomplete(options, (err, { status, addresses }) => {
|
|
318
|
-
if (err) {
|
|
319
|
-
reject(err);
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
322
|
-
resolve({
|
|
323
|
-
status,
|
|
324
|
-
addresses,
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
});
|
|
328
|
-
});
|
|
329
|
-
};
|
|
330
|
-
const geocode = (options) => {
|
|
331
|
-
return new Promise((resolve, reject) => {
|
|
332
|
-
let newOptions = options;
|
|
333
|
-
if (typeof options === 'string') {
|
|
334
|
-
newOptions = {
|
|
335
|
-
query: options
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
else if (options.address) {
|
|
339
|
-
newOptions.query = options.address;
|
|
340
|
-
}
|
|
341
|
-
radar_sdk_js_1.default.geocode(newOptions, (err, { status, addresses }) => {
|
|
342
|
-
if (err) {
|
|
343
|
-
reject(err);
|
|
344
|
-
}
|
|
345
|
-
else {
|
|
346
|
-
resolve({
|
|
347
|
-
status,
|
|
348
|
-
addresses,
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
});
|
|
353
|
-
};
|
|
354
|
-
const reverseGeocode = (options) => {
|
|
355
|
-
return new Promise((resolve, reject) => {
|
|
356
|
-
const callback = (err, { status, addresses }) => {
|
|
357
|
-
if (err) {
|
|
358
|
-
reject(err);
|
|
359
|
-
}
|
|
360
|
-
else {
|
|
361
|
-
resolve({
|
|
362
|
-
status,
|
|
363
|
-
addresses,
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
if (options) {
|
|
368
|
-
radar_sdk_js_1.default.reverseGeocode(options, callback);
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
radar_sdk_js_1.default.reverseGeocode(callback);
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
};
|
|
375
|
-
const ipGeocode = () => {
|
|
376
|
-
return new Promise((resolve, reject) => {
|
|
377
|
-
radar_sdk_js_1.default.ipGeocode((err, { status, address }) => {
|
|
378
|
-
if (err) {
|
|
379
|
-
reject(err);
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
resolve({
|
|
383
|
-
status,
|
|
384
|
-
address,
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
});
|
|
389
|
-
};
|
|
390
|
-
const validateAddress = (options) => {
|
|
391
|
-
return new Promise((resolve, reject) => {
|
|
392
|
-
radar_sdk_js_1.default.validateAddress(options, (err, { status, address }) => {
|
|
393
|
-
if (err) {
|
|
394
|
-
reject(err);
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
resolve({
|
|
398
|
-
status,
|
|
399
|
-
address
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
});
|
|
404
|
-
};
|
|
405
|
-
const getDistance = (options) => {
|
|
406
|
-
return new Promise((resolve, reject) => {
|
|
407
|
-
radar_sdk_js_1.default.getDistance(options, (err, { status, routes }) => {
|
|
408
|
-
if (err) {
|
|
409
|
-
reject(err);
|
|
410
|
-
}
|
|
411
|
-
else {
|
|
412
|
-
resolve({
|
|
413
|
-
status,
|
|
414
|
-
routes,
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
});
|
|
419
|
-
};
|
|
420
|
-
const getMatrix = (options) => {
|
|
421
|
-
return new Promise((resolve, reject) => {
|
|
422
|
-
radar_sdk_js_1.default.getMatrix(options, (err, { origins, destinations, matrix, status }) => {
|
|
423
|
-
if (err) {
|
|
424
|
-
reject(err);
|
|
425
|
-
}
|
|
426
|
-
else {
|
|
427
|
-
resolve({
|
|
428
|
-
origins,
|
|
429
|
-
destinations,
|
|
430
|
-
matrix,
|
|
431
|
-
status,
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
});
|
|
436
|
-
};
|
|
437
|
-
const logConversion = (options) => {
|
|
438
|
-
if (throws)
|
|
439
|
-
throw new Error("logConversion() is not implemented on web");
|
|
440
|
-
return new Promise((resolve, reject) => { reject("logConversion() is not implemented on web"); });
|
|
441
|
-
};
|
|
442
|
-
const sendEvent = (name, metadata) => {
|
|
443
|
-
if (throws)
|
|
444
|
-
throw new Error("sendEvent() is not implemented on web");
|
|
445
|
-
};
|
|
446
|
-
const on = (event, callback) => {
|
|
447
|
-
if (throws)
|
|
448
|
-
throw new Error("on() is not implemented on web");
|
|
449
|
-
};
|
|
450
|
-
const off = (event, callback) => {
|
|
451
|
-
if (throws)
|
|
452
|
-
throw new Error("off() is not implemented on web");
|
|
453
|
-
};
|
|
454
|
-
const nativeSdkVersion = () => {
|
|
455
|
-
return new Promise((resolve, reject) => { resolve(radar_sdk_js_1.default.VERSION); });
|
|
456
|
-
};
|
|
457
|
-
const rnSdkVersion = () => package_json_1.version;
|
|
458
|
-
const Radar = {
|
|
459
|
-
initialize,
|
|
460
|
-
setLogLevel,
|
|
461
|
-
setUserId,
|
|
462
|
-
getUserId,
|
|
463
|
-
setDescription,
|
|
464
|
-
getDescription,
|
|
465
|
-
setMetadata,
|
|
466
|
-
getMetadata,
|
|
467
|
-
setAnonymousTrackingEnabled,
|
|
468
|
-
getPermissionsStatus,
|
|
469
|
-
requestPermissions,
|
|
470
|
-
getLocation,
|
|
471
|
-
trackOnce,
|
|
472
|
-
trackVerified,
|
|
473
|
-
getVerifiedLocationToken,
|
|
474
|
-
startTrackingEfficient,
|
|
475
|
-
startTrackingResponsive,
|
|
476
|
-
startTrackingContinuous,
|
|
477
|
-
startTrackingCustom,
|
|
478
|
-
startTrackingVerified,
|
|
479
|
-
mockTracking,
|
|
480
|
-
stopTracking,
|
|
481
|
-
stopTrackingVerified,
|
|
482
|
-
isTracking,
|
|
483
|
-
getTrackingOptions,
|
|
484
|
-
isUsingRemoteTrackingOptions,
|
|
485
|
-
setForegroundServiceOptions,
|
|
486
|
-
setNotificationOptions,
|
|
487
|
-
getTripOptions,
|
|
488
|
-
startTrip,
|
|
489
|
-
completeTrip,
|
|
490
|
-
cancelTrip,
|
|
491
|
-
updateTrip,
|
|
492
|
-
acceptEvent,
|
|
493
|
-
rejectEvent,
|
|
494
|
-
getContext,
|
|
495
|
-
searchPlaces,
|
|
496
|
-
searchGeofences,
|
|
497
|
-
autocomplete,
|
|
498
|
-
geocode,
|
|
499
|
-
reverseGeocode,
|
|
500
|
-
ipGeocode,
|
|
501
|
-
validateAddress,
|
|
502
|
-
getDistance,
|
|
503
|
-
getMatrix,
|
|
504
|
-
logConversion,
|
|
505
|
-
sendEvent,
|
|
506
|
-
on,
|
|
507
|
-
off,
|
|
508
|
-
nativeSdkVersion,
|
|
509
|
-
rnSdkVersion,
|
|
510
|
-
// only for web, these should be called via RadarRNWeb instead of Radar for typing
|
|
511
|
-
throwOnUnimplemented,
|
|
512
|
-
setDeviceId,
|
|
513
|
-
setDeviceType,
|
|
514
|
-
setRequestHeaders,
|
|
515
|
-
};
|
|
516
|
-
exports.default = Radar;
|