hypertrack-sdk-react-native 13.5.0 → 13.5.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/android/src/main/java/com/reactnativehypertracksdk/HyperTrackReactNativePlugin.kt +40 -37
- package/android/src/main/java/com/reactnativehypertracksdk/HyperTrackSdkPackage.kt +3 -6
- package/android/src/main/java/com/reactnativehypertracksdk/ReactNativeSerialization.kt +2 -3
- package/android/src/main/java/com/reactnativehypertracksdk/common/HyperTrackSdkWrapper.kt +42 -65
- package/android/src/main/java/com/reactnativehypertracksdk/common/Serialization.kt +69 -103
- package/android/src/main/java/com/reactnativehypertracksdk/common/WrapperResult.kt +14 -14
- package/lib/commonjs/HyperTrack/HyperTrack.js +5 -1
- package/lib/commonjs/HyperTrack/HyperTrack.js.map +1 -1
- package/lib/commonjs/HyperTrack/data_types/internal/IsInsideGeofence.js +2 -0
- package/lib/commonjs/HyperTrack/data_types/internal/IsInsideGeofence.js.map +1 -0
- package/lib/commonjs/HyperTrack/data_types/internal/OrderInternal.js.map +1 -1
- package/lib/module/HyperTrack/HyperTrack.js +5 -1
- package/lib/module/HyperTrack/HyperTrack.js.map +1 -1
- package/lib/module/HyperTrack/data_types/internal/IsInsideGeofence.js +2 -0
- package/lib/module/HyperTrack/data_types/internal/IsInsideGeofence.js.map +1 -0
- package/lib/module/HyperTrack/data_types/internal/OrderInternal.js.map +1 -1
- package/lib/typescript/HyperTrack/data_types/internal/IsInsideGeofence.d.ts +4 -0
- package/lib/typescript/HyperTrack/data_types/internal/OrderInternal.d.ts +2 -1
- package/package.json +1 -1
- package/src/HyperTrack/HyperTrack.ts +7 -2
- package/src/HyperTrack/data_types/internal/IsInsideGeofence.ts +4 -0
- package/src/HyperTrack/data_types/internal/OrderInternal.ts +2 -1
|
@@ -9,17 +9,16 @@ import com.hypertrack.sdk.android.Result
|
|
|
9
9
|
* to Map<String, T> or List<T> where T is any JSON-compatible type
|
|
10
10
|
*/
|
|
11
11
|
internal object Serialization {
|
|
12
|
-
fun deserializeDynamicPublishableKey(args: Serialized): WrapperResult<String>
|
|
13
|
-
|
|
12
|
+
fun deserializeDynamicPublishableKey(args: Serialized): WrapperResult<String> =
|
|
13
|
+
parse(args) {
|
|
14
14
|
it.assertValue<String>(key = KEY_TYPE, value = TYPE_DYNAMIC_PUBLISHABLE_KEY)
|
|
15
15
|
it
|
|
16
16
|
.get<String>(KEY_VALUE)
|
|
17
17
|
.getOrThrow()
|
|
18
18
|
}
|
|
19
|
-
}
|
|
20
19
|
|
|
21
|
-
fun deserializeGeotagData(map: Serialized): WrapperResult<GeotagData>
|
|
22
|
-
|
|
20
|
+
fun deserializeGeotagData(map: Serialized): WrapperResult<GeotagData> =
|
|
21
|
+
parse(map) {
|
|
23
22
|
val data =
|
|
24
23
|
it
|
|
25
24
|
.get<Serialized>(KEY_GEOTAG_DATA)
|
|
@@ -49,69 +48,61 @@ internal object Serialization {
|
|
|
49
48
|
orderStatus = orderStatus,
|
|
50
49
|
)
|
|
51
50
|
}
|
|
52
|
-
}
|
|
53
51
|
|
|
54
|
-
fun deserializeIsAvailable(isAvailable: Serialized): WrapperResult<Boolean>
|
|
55
|
-
|
|
52
|
+
fun deserializeIsAvailable(isAvailable: Serialized): WrapperResult<Boolean> =
|
|
53
|
+
parse(isAvailable) {
|
|
56
54
|
it.assertValue<String>(key = KEY_TYPE, value = TYPE_IS_AVAILABLE)
|
|
57
55
|
it
|
|
58
56
|
.get<Boolean>(KEY_VALUE)
|
|
59
57
|
.getOrThrow()
|
|
60
58
|
}
|
|
61
|
-
}
|
|
62
59
|
|
|
63
|
-
fun deserializeIsTracking(isTracking: Serialized): WrapperResult<Boolean>
|
|
64
|
-
|
|
60
|
+
fun deserializeIsTracking(isTracking: Serialized): WrapperResult<Boolean> =
|
|
61
|
+
parse(isTracking) {
|
|
65
62
|
it.assertValue<String>(key = KEY_TYPE, value = TYPE_IS_TRACKING)
|
|
66
63
|
it
|
|
67
64
|
.get<Boolean>(KEY_VALUE)
|
|
68
65
|
.getOrThrow()
|
|
69
66
|
}
|
|
70
|
-
}
|
|
71
67
|
|
|
72
|
-
fun deserializeMetadata(metadata: Serialized): WrapperResult<Serialized>
|
|
73
|
-
|
|
68
|
+
fun deserializeMetadata(metadata: Serialized): WrapperResult<Serialized> =
|
|
69
|
+
parse(metadata) {
|
|
74
70
|
it.assertValue<String>(key = KEY_TYPE, value = TYPE_METADATA)
|
|
75
71
|
it
|
|
76
72
|
.get<Serialized>(KEY_VALUE)
|
|
77
73
|
.getOrThrow()
|
|
78
74
|
}
|
|
79
|
-
}
|
|
80
75
|
|
|
81
|
-
fun deserializeName(name: Serialized): WrapperResult<String>
|
|
82
|
-
|
|
76
|
+
fun deserializeName(name: Serialized): WrapperResult<String> =
|
|
77
|
+
parse(name) {
|
|
83
78
|
it.assertValue<String>(key = KEY_TYPE, value = TYPE_NAME)
|
|
84
79
|
it
|
|
85
80
|
.get<String>(KEY_VALUE)
|
|
86
81
|
.getOrThrow()
|
|
87
82
|
}
|
|
88
|
-
}
|
|
89
83
|
|
|
90
|
-
fun deserializeWorkerHandle(map: Serialized): WrapperResult<String>
|
|
91
|
-
|
|
84
|
+
fun deserializeWorkerHandle(map: Serialized): WrapperResult<String> =
|
|
85
|
+
parse(map) {
|
|
92
86
|
it.assertValue<String>(key = KEY_TYPE, value = TYPE_WORKER_HANDLE)
|
|
93
87
|
it
|
|
94
88
|
.get<String>(KEY_VALUE)
|
|
95
89
|
.getOrThrow()
|
|
96
90
|
}
|
|
97
|
-
}
|
|
98
91
|
|
|
99
|
-
fun serializeDeviceId(deviceId: String): Serialized
|
|
100
|
-
|
|
92
|
+
fun serializeDeviceId(deviceId: String): Serialized =
|
|
93
|
+
mapOf(
|
|
101
94
|
KEY_TYPE to TYPE_DEVICE_ID,
|
|
102
95
|
KEY_VALUE to deviceId,
|
|
103
96
|
)
|
|
104
|
-
}
|
|
105
97
|
|
|
106
|
-
fun serializeDynamicPublishableKey(publishableKey: String): Serialized
|
|
107
|
-
|
|
98
|
+
fun serializeDynamicPublishableKey(publishableKey: String): Serialized =
|
|
99
|
+
mapOf(
|
|
108
100
|
KEY_TYPE to TYPE_DYNAMIC_PUBLISHABLE_KEY,
|
|
109
101
|
KEY_VALUE to publishableKey,
|
|
110
102
|
)
|
|
111
|
-
}
|
|
112
103
|
|
|
113
|
-
fun serializeError(error: HyperTrack.Error): Map<String, String>
|
|
114
|
-
|
|
104
|
+
fun serializeError(error: HyperTrack.Error): Map<String, String> =
|
|
105
|
+
mapOf(
|
|
115
106
|
KEY_TYPE to TYPE_ERROR,
|
|
116
107
|
KEY_VALUE to
|
|
117
108
|
when (error) {
|
|
@@ -128,30 +119,26 @@ internal object Serialization {
|
|
|
128
119
|
HyperTrack.Error.Permissions.Notifications.Denied -> "permissions.notifications.denied"
|
|
129
120
|
},
|
|
130
121
|
)
|
|
131
|
-
}
|
|
132
122
|
|
|
133
|
-
fun serializeErrors(errors: Set<HyperTrack.Error>): List<Map<String, String>>
|
|
134
|
-
|
|
123
|
+
fun serializeErrors(errors: Set<HyperTrack.Error>): List<Map<String, String>> =
|
|
124
|
+
errors.map {
|
|
135
125
|
serializeError(it)
|
|
136
126
|
}
|
|
137
|
-
}
|
|
138
127
|
|
|
139
|
-
fun serializeIsAvailable(isAvailable: Boolean): Serialized
|
|
140
|
-
|
|
128
|
+
fun serializeIsAvailable(isAvailable: Boolean): Serialized =
|
|
129
|
+
mapOf(
|
|
141
130
|
KEY_TYPE to TYPE_IS_AVAILABLE,
|
|
142
131
|
KEY_VALUE to isAvailable,
|
|
143
132
|
)
|
|
144
|
-
}
|
|
145
133
|
|
|
146
|
-
fun serializeIsTracking(isTracking: Boolean): Serialized
|
|
147
|
-
|
|
134
|
+
fun serializeIsTracking(isTracking: Boolean): Serialized =
|
|
135
|
+
mapOf(
|
|
148
136
|
KEY_TYPE to TYPE_IS_TRACKING,
|
|
149
137
|
KEY_VALUE to isTracking,
|
|
150
138
|
)
|
|
151
|
-
}
|
|
152
139
|
|
|
153
|
-
fun serializeLocateResult(locationResult: Result<HyperTrack.Location, Set<HyperTrack.Error>>): Serialized
|
|
154
|
-
|
|
140
|
+
fun serializeLocateResult(locationResult: Result<HyperTrack.Location, Set<HyperTrack.Error>>): Serialized =
|
|
141
|
+
when (locationResult) {
|
|
155
142
|
is Result.Failure -> {
|
|
156
143
|
serializeFailure(serializeErrors(locationResult.failure))
|
|
157
144
|
}
|
|
@@ -160,10 +147,9 @@ internal object Serialization {
|
|
|
160
147
|
serializeLocationSuccess(locationResult.success)
|
|
161
148
|
}
|
|
162
149
|
}
|
|
163
|
-
}
|
|
164
150
|
|
|
165
|
-
fun serializeLocationResult(locationResult: Result<HyperTrack.Location, HyperTrack.LocationError>): Serialized
|
|
166
|
-
|
|
151
|
+
fun serializeLocationResult(locationResult: Result<HyperTrack.Location, HyperTrack.LocationError>): Serialized =
|
|
152
|
+
when (locationResult) {
|
|
167
153
|
is Result.Failure -> {
|
|
168
154
|
serializeLocationErrorFailure(locationResult.failure)
|
|
169
155
|
}
|
|
@@ -172,40 +158,33 @@ internal object Serialization {
|
|
|
172
158
|
serializeLocationSuccess(locationResult.success)
|
|
173
159
|
}
|
|
174
160
|
}
|
|
175
|
-
}
|
|
176
161
|
|
|
177
|
-
fun serializeLocationErrorFailure(locationError: HyperTrack.LocationError): Serialized
|
|
178
|
-
|
|
179
|
-
}
|
|
162
|
+
fun serializeLocationErrorFailure(locationError: HyperTrack.LocationError): Serialized =
|
|
163
|
+
serializeFailure(serializeLocationError(locationError))
|
|
180
164
|
|
|
181
|
-
fun serializeLocationSuccess(location: HyperTrack.Location): Serialized
|
|
182
|
-
return serializeSuccess(serializeLocation(location))
|
|
183
|
-
}
|
|
165
|
+
fun serializeLocationSuccess(location: HyperTrack.Location): Serialized = serializeSuccess(serializeLocation(location))
|
|
184
166
|
|
|
185
|
-
fun serializeLocationWithDeviationSuccess(locationWithDeviation: HyperTrack.LocationWithDeviation): Serialized
|
|
186
|
-
|
|
167
|
+
fun serializeLocationWithDeviationSuccess(locationWithDeviation: HyperTrack.LocationWithDeviation): Serialized =
|
|
168
|
+
serializeSuccess(
|
|
187
169
|
serializeLocationWithDeviation(
|
|
188
170
|
locationWithDeviation,
|
|
189
171
|
),
|
|
190
172
|
)
|
|
191
|
-
}
|
|
192
173
|
|
|
193
|
-
fun serializeMetadata(metadata: Serialized): Serialized
|
|
194
|
-
|
|
174
|
+
fun serializeMetadata(metadata: Serialized): Serialized =
|
|
175
|
+
mapOf(
|
|
195
176
|
KEY_TYPE to TYPE_METADATA,
|
|
196
177
|
KEY_VALUE to metadata,
|
|
197
178
|
)
|
|
198
|
-
}
|
|
199
179
|
|
|
200
|
-
fun serializeName(name: String): Serialized
|
|
201
|
-
|
|
180
|
+
fun serializeName(name: String): Serialized =
|
|
181
|
+
mapOf(
|
|
202
182
|
KEY_TYPE to TYPE_NAME,
|
|
203
183
|
KEY_VALUE to name,
|
|
204
184
|
)
|
|
205
|
-
}
|
|
206
185
|
|
|
207
|
-
fun serializeOrders(orders: Collection<HyperTrack.Order>): Serialized
|
|
208
|
-
|
|
186
|
+
fun serializeOrders(orders: Collection<HyperTrack.Order>): Serialized =
|
|
187
|
+
mapOf(
|
|
209
188
|
KEY_TYPE to TYPE_ORDERS,
|
|
210
189
|
KEY_VALUE to
|
|
211
190
|
orders.mapIndexed { index, order ->
|
|
@@ -216,17 +195,15 @@ internal object Serialization {
|
|
|
216
195
|
)
|
|
217
196
|
},
|
|
218
197
|
)
|
|
219
|
-
}
|
|
220
198
|
|
|
221
|
-
fun serializeWorkerHandle(workerHandle: String): Serialized
|
|
222
|
-
|
|
199
|
+
fun serializeWorkerHandle(workerHandle: String): Serialized =
|
|
200
|
+
mapOf(
|
|
223
201
|
KEY_TYPE to TYPE_WORKER_HANDLE,
|
|
224
202
|
KEY_VALUE to workerHandle,
|
|
225
203
|
)
|
|
226
|
-
}
|
|
227
204
|
|
|
228
|
-
private fun deserializeLocation(map: Serialized): WrapperResult<Location>
|
|
229
|
-
|
|
205
|
+
private fun deserializeLocation(map: Serialized): WrapperResult<Location> =
|
|
206
|
+
parse(map) {
|
|
230
207
|
it.assertValue<String>(key = KEY_TYPE, value = TYPE_LOCATION)
|
|
231
208
|
val value =
|
|
232
209
|
it
|
|
@@ -247,19 +224,17 @@ internal object Serialization {
|
|
|
247
224
|
}
|
|
248
225
|
}.getOrThrow()
|
|
249
226
|
}
|
|
250
|
-
}
|
|
251
227
|
|
|
252
|
-
private fun deserializeOrderHandle(map: Serialized): WrapperResult<String>
|
|
253
|
-
|
|
228
|
+
private fun deserializeOrderHandle(map: Serialized): WrapperResult<String> =
|
|
229
|
+
parse(map) {
|
|
254
230
|
it.assertValue<String>(key = KEY_TYPE, value = TYPE_ORDER_HANDLE)
|
|
255
231
|
it
|
|
256
232
|
.get<String>(KEY_VALUE)
|
|
257
233
|
.getOrThrow()
|
|
258
234
|
}
|
|
259
|
-
}
|
|
260
235
|
|
|
261
|
-
private fun deserializeOrderStatus(map: Serialized): WrapperResult<HyperTrack.OrderStatus>
|
|
262
|
-
|
|
236
|
+
private fun deserializeOrderStatus(map: Serialized): WrapperResult<HyperTrack.OrderStatus> =
|
|
237
|
+
parse(map) {
|
|
263
238
|
when (it.get<String>(KEY_TYPE).getOrThrow()) {
|
|
264
239
|
TYPE_GEOTAG_ORDER_STATUS_CLOCK_IN -> HyperTrack.OrderStatus.ClockIn
|
|
265
240
|
TYPE_GEOTAG_ORDER_STATUS_CLOCK_OUT -> HyperTrack.OrderStatus.ClockOut
|
|
@@ -271,10 +246,9 @@ internal object Serialization {
|
|
|
271
246
|
else -> throw Error("Unknown order status: $map")
|
|
272
247
|
}
|
|
273
248
|
}
|
|
274
|
-
}
|
|
275
249
|
|
|
276
|
-
private fun serializeIsInsideGeofence(isInsideGeofence: Result<Boolean, HyperTrack.LocationError>): Serialized
|
|
277
|
-
|
|
250
|
+
private fun serializeIsInsideGeofence(isInsideGeofence: Result<Boolean, HyperTrack.LocationError>): Serialized =
|
|
251
|
+
when (isInsideGeofence) {
|
|
278
252
|
is Result.Failure -> {
|
|
279
253
|
serializeFailure(serializeLocationError(isInsideGeofence.failure))
|
|
280
254
|
}
|
|
@@ -288,10 +262,9 @@ internal object Serialization {
|
|
|
288
262
|
)
|
|
289
263
|
}
|
|
290
264
|
}
|
|
291
|
-
}
|
|
292
265
|
|
|
293
|
-
private fun serializeLocation(location: HyperTrack.Location): Serialized
|
|
294
|
-
|
|
266
|
+
private fun serializeLocation(location: HyperTrack.Location): Serialized =
|
|
267
|
+
mapOf(
|
|
295
268
|
KEY_TYPE to TYPE_LOCATION,
|
|
296
269
|
KEY_VALUE to
|
|
297
270
|
mapOf(
|
|
@@ -299,10 +272,9 @@ internal object Serialization {
|
|
|
299
272
|
KEY_LONGITUDE to location.longitude,
|
|
300
273
|
),
|
|
301
274
|
)
|
|
302
|
-
}
|
|
303
275
|
|
|
304
|
-
private fun serializeLocationWithDeviation(locationWithDeviation: HyperTrack.LocationWithDeviation): Serialized
|
|
305
|
-
|
|
276
|
+
private fun serializeLocationWithDeviation(locationWithDeviation: HyperTrack.LocationWithDeviation): Serialized =
|
|
277
|
+
mapOf(
|
|
306
278
|
KEY_TYPE to TYPE_LOCATION_WITH_DEVIATION,
|
|
307
279
|
KEY_VALUE to
|
|
308
280
|
mapOf(
|
|
@@ -310,31 +282,27 @@ internal object Serialization {
|
|
|
310
282
|
KEY_DEVIATION to locationWithDeviation.deviation,
|
|
311
283
|
),
|
|
312
284
|
)
|
|
313
|
-
}
|
|
314
285
|
|
|
315
|
-
private fun serializeFailure(failure: List<Serialized>): Serialized
|
|
316
|
-
|
|
286
|
+
private fun serializeFailure(failure: List<Serialized>): Serialized =
|
|
287
|
+
mapOf(
|
|
317
288
|
KEY_TYPE to TYPE_RESULT_FAILURE,
|
|
318
289
|
KEY_VALUE to failure,
|
|
319
290
|
)
|
|
320
|
-
}
|
|
321
291
|
|
|
322
|
-
private fun serializeFailure(failure: Serialized): Serialized
|
|
323
|
-
|
|
292
|
+
private fun serializeFailure(failure: Serialized): Serialized =
|
|
293
|
+
mapOf(
|
|
324
294
|
KEY_TYPE to TYPE_RESULT_FAILURE,
|
|
325
295
|
KEY_VALUE to failure,
|
|
326
296
|
)
|
|
327
|
-
}
|
|
328
297
|
|
|
329
|
-
private fun serializeSuccess(success: Serialized): Serialized
|
|
330
|
-
|
|
298
|
+
private fun serializeSuccess(success: Serialized): Serialized =
|
|
299
|
+
mapOf(
|
|
331
300
|
KEY_TYPE to TYPE_RESULT_SUCCESS,
|
|
332
301
|
KEY_VALUE to success,
|
|
333
302
|
)
|
|
334
|
-
}
|
|
335
303
|
|
|
336
|
-
private fun serializeLocationError(locationError: HyperTrack.LocationError): Serialized
|
|
337
|
-
|
|
304
|
+
private fun serializeLocationError(locationError: HyperTrack.LocationError): Serialized =
|
|
305
|
+
when (locationError) {
|
|
338
306
|
HyperTrack.LocationError.NotRunning -> {
|
|
339
307
|
mapOf(KEY_TYPE to TYPE_LOCATION_ERROR_NOT_RUNNING)
|
|
340
308
|
}
|
|
@@ -352,7 +320,6 @@ internal object Serialization {
|
|
|
352
320
|
)
|
|
353
321
|
}
|
|
354
322
|
}
|
|
355
|
-
}
|
|
356
323
|
|
|
357
324
|
fun <T> parse(
|
|
358
325
|
source: Serialized,
|
|
@@ -382,8 +349,8 @@ internal object Serialization {
|
|
|
382
349
|
private val _exceptions = mutableListOf<Exception>()
|
|
383
350
|
val exceptions: List<Exception> = _exceptions
|
|
384
351
|
|
|
385
|
-
inline fun <reified T> get(key: String): WrapperResult<T>
|
|
386
|
-
|
|
352
|
+
inline fun <reified T> get(key: String): WrapperResult<T> =
|
|
353
|
+
try {
|
|
387
354
|
Success(source[key]!! as T)
|
|
388
355
|
} catch (e: Exception) {
|
|
389
356
|
Failure(
|
|
@@ -393,10 +360,9 @@ internal object Serialization {
|
|
|
393
360
|
},
|
|
394
361
|
)
|
|
395
362
|
}
|
|
396
|
-
}
|
|
397
363
|
|
|
398
|
-
inline fun <reified T> getOptional(key: String): WrapperResult<T?>
|
|
399
|
-
|
|
364
|
+
inline fun <reified T> getOptional(key: String): WrapperResult<T?> =
|
|
365
|
+
try {
|
|
400
366
|
Success(source[key] as T?)
|
|
401
367
|
} catch (e: Exception) {
|
|
402
368
|
Failure(
|
|
@@ -406,7 +372,6 @@ internal object Serialization {
|
|
|
406
372
|
},
|
|
407
373
|
)
|
|
408
374
|
}
|
|
409
|
-
}
|
|
410
375
|
|
|
411
376
|
inline fun <reified T> assertValue(
|
|
412
377
|
key: String,
|
|
@@ -422,7 +387,8 @@ internal object Serialization {
|
|
|
422
387
|
val source: Any,
|
|
423
388
|
val exceptions: List<Exception>,
|
|
424
389
|
) : Throwable(
|
|
425
|
-
exceptions
|
|
390
|
+
exceptions
|
|
391
|
+
.joinToString("\n")
|
|
426
392
|
.let {
|
|
427
393
|
"Invalid input:\n\n${source}\n\n$it"
|
|
428
394
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
package com.reactnativehypertracksdk.common
|
|
2
2
|
|
|
3
3
|
internal sealed class WrapperResult<SuccessType> {
|
|
4
|
-
fun <MappedSuccess> flatMapSuccess(onSuccess: (SuccessType) -> WrapperResult<MappedSuccess>): WrapperResult<MappedSuccess>
|
|
5
|
-
|
|
4
|
+
fun <MappedSuccess> flatMapSuccess(onSuccess: (SuccessType) -> WrapperResult<MappedSuccess>): WrapperResult<MappedSuccess> =
|
|
5
|
+
when (this) {
|
|
6
6
|
is Success -> {
|
|
7
7
|
onSuccess.invoke(this.success)
|
|
8
8
|
}
|
|
@@ -11,10 +11,9 @@ internal sealed class WrapperResult<SuccessType> {
|
|
|
11
11
|
Failure<MappedSuccess>(this.failure)
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
}
|
|
15
14
|
|
|
16
|
-
fun <MappedSuccess> mapSuccess(onSuccess: (SuccessType) -> MappedSuccess): WrapperResult<MappedSuccess>
|
|
17
|
-
|
|
15
|
+
fun <MappedSuccess> mapSuccess(onSuccess: (SuccessType) -> MappedSuccess): WrapperResult<MappedSuccess> =
|
|
16
|
+
when (this) {
|
|
18
17
|
is Success -> {
|
|
19
18
|
Success(onSuccess.invoke(this.success))
|
|
20
19
|
}
|
|
@@ -23,29 +22,30 @@ internal sealed class WrapperResult<SuccessType> {
|
|
|
23
22
|
Failure<MappedSuccess>(this.failure)
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
|
-
}
|
|
27
25
|
|
|
28
|
-
fun getOrThrow(): SuccessType
|
|
29
|
-
|
|
26
|
+
fun getOrThrow(): SuccessType =
|
|
27
|
+
when (this) {
|
|
30
28
|
is Success -> this.success
|
|
31
29
|
is Failure -> throw Exception(
|
|
32
30
|
"Result unwrapping failed: ${this.failure}",
|
|
33
31
|
this.failure,
|
|
34
32
|
)
|
|
35
33
|
}
|
|
36
|
-
}
|
|
37
34
|
|
|
38
35
|
companion object {
|
|
39
|
-
fun <SuccessType> tryAsResult(block: () -> SuccessType): WrapperResult<SuccessType>
|
|
40
|
-
|
|
36
|
+
fun <SuccessType> tryAsResult(block: () -> SuccessType): WrapperResult<SuccessType> =
|
|
37
|
+
try {
|
|
41
38
|
Success(block.invoke())
|
|
42
39
|
} catch (e: Exception) {
|
|
43
40
|
Failure(e)
|
|
44
41
|
}
|
|
45
|
-
}
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
44
|
|
|
49
|
-
internal data class Success<SuccessType>(
|
|
45
|
+
internal data class Success<SuccessType>(
|
|
46
|
+
val success: SuccessType,
|
|
47
|
+
) : WrapperResult<SuccessType>()
|
|
50
48
|
|
|
51
|
-
internal data class Failure<SuccessType>(
|
|
49
|
+
internal data class Failure<SuccessType>(
|
|
50
|
+
val failure: Throwable,
|
|
51
|
+
) : WrapperResult<SuccessType>()
|
|
@@ -455,9 +455,13 @@ class HyperTrack {
|
|
|
455
455
|
static deserializeIsInsideGeofence(isInsideGeofence) {
|
|
456
456
|
switch (isInsideGeofence.type) {
|
|
457
457
|
case 'success':
|
|
458
|
+
let successValue = isInsideGeofence.value;
|
|
459
|
+
if (successValue.type !== 'isInsideGeofence') {
|
|
460
|
+
throw new Error(`Invalid isInsideGeofence: ${JSON.stringify(successValue)}`);
|
|
461
|
+
}
|
|
458
462
|
return {
|
|
459
463
|
type: 'success',
|
|
460
|
-
value:
|
|
464
|
+
value: successValue.value
|
|
461
465
|
};
|
|
462
466
|
case 'failure':
|
|
463
467
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_HyperTrackError","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","EVENT_ERRORS","EVENT_IS_AVAILABLE","EVENT_IS_TRACKING","EVENT_LOCATE","EVENT_LOCATION","EVENT_ORDERS","LINKING_ERROR","Platform","select","ios","default","HyperTrackSdk","NativeModules","HyperTrackReactNativePlugin","Proxy","get","Error","EventEmitter","NativeEventEmitter","HyperTrack","addGeotag","args","length","isOrderStatus","orderHandle","type","orderStatus","data","expectedLocation","undefined","then","locationResponse","deserializeLocationResponse","isLocation","latitude","longitude","deserializeLocationWithDeviationResponse","JSON","stringify","getDeviceId","deviceId","getDynamicPublishableKey","dynamicPublishableKey","deserializeDynamicPublishableKey","getErrors","errors","deserializeHyperTrackErrors","getIsAvailable","isAvailable","getIsTracking","isTracking","getLocation","getMetadata","metadata","deserializeMetadata","getName","name","deserializeName","getOrders","orders","deserializeOrders","getWorkerHandle","workerHandle","locate","callback","_this$locateSubscript","locateSubscription","remove","addListener","location","deserializeLocateResponse","setDynamicPublishableKey","setIsAvailable","setIsTracking","setMetadata","setName","setWorkerHandle","subscribeToErrors","listener","rawErrors","subscribeToIsAvailable","subscribeToIsTracking","subscribeToLocation","subscribeToOrders","res","map","error","keys","HyperTrackError","find","deserializeIsInsideGeofence","isInsideGeofence","deserializeLocationError","response","locationError","locationWithDeviationInternal","locationInternal","deviation","result","Map","entries","_","sort","first","second","index","forEach","orderInternal","set","startsWith","exports"],"sources":["HyperTrack.ts"],"sourcesContent":["import {\n NativeModules,\n Platform,\n NativeEventEmitter,\n type EmitterSubscription,\n} from 'react-native';\nimport { HyperTrackError } from './data_types/HyperTrackError';\nimport type { IsAvailable } from './data_types/internal/IsAvailable';\nimport type { IsTracking } from './data_types/internal/IsTracking';\nimport type { Location } from './data_types/Location';\nimport type { LocationError } from './data_types/LocationError';\nimport type { DeviceId } from './data_types/internal/DeviceId';\nimport type { GeotagData } from './data_types/internal/GeotagData';\nimport type { Name } from './data_types/internal/Name';\nimport type { HyperTrackErrorInternal } from './data_types/internal/HyperTrackErrorInternal';\nimport type { LocationWithDeviation } from './data_types/LocationWithDeviation';\nimport type { LocationErrorInternal } from './data_types/internal/LocationErrorInternal';\nimport type { Result } from './data_types/Result';\nimport type { LocationInternal } from './data_types/internal/LocationInternal';\nimport type { LocationWithDeviationInternal } from './data_types/internal/LocationWithDeviationInternal';\nimport type { Metadata } from './data_types/internal/Metadata';\nimport type { DynamicPublishableKey } from './data_types/internal/DynamicPublishableKey';\nimport type { OrderStatus } from './data_types/OrderStatus';\nimport type { OrderHandle } from './data_types/internal/OrderHandle';\nimport type { WorkerHandle } from './data_types/internal/WorkerHandle';\nimport type { Order } from './data_types/Order';\nimport type { OrdersInternal } from './data_types/internal/OrdersInternal';\nimport type { OrderInternal } from './data_types/internal/OrderInternal';\n\nconst EVENT_ERRORS = 'errors';\nconst EVENT_IS_AVAILABLE = 'isAvailable';\nconst EVENT_IS_TRACKING = 'isTracking';\nconst EVENT_LOCATE = 'locate';\nconst EVENT_LOCATION = 'location';\nconst EVENT_ORDERS = 'orders';\n\nconst LINKING_ERROR =\n `The package 'hypertrack-sdk-react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst HyperTrackSdk = NativeModules.HyperTrackReactNativePlugin\n ? NativeModules.HyperTrackReactNativePlugin\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nconst EventEmitter = new NativeEventEmitter(HyperTrackSdk);\n\nexport default class HyperTrack {\n private static locateSubscription: EmitterSubscription | undefined;\n\n /**\n * Adds a new geotag. Check [Shift tracking](https://hypertrack.com/docs/shift-tracking) and [Clock In/Out tagging](https://hypertrack.com/docs/clock-inout-tracking) docs to learn how to use Order handle and Order status params.\n *\n * @param {string} orderHandle - Order handle\n * @param {OrderStatus} orderStatus - Order status\n * @param {Object} data - Geotag data JSON\n * @returns current location if success or LocationError if failure\n */\n static async addGeotag(\n orderHandle: string,\n orderStatus: OrderStatus,\n data: Object\n ): Promise<Result<Location, LocationError>>;\n\n /**\n * Adds a new geotag with expected location. Check [Shift tracking](https://hypertrack.com/docs/shift-tracking) and [Clock In/Out tagging](https://hypertrack.com/docs/clock-inout-tracking) docs to learn how to use Order handle and Order status params.\n *\n * @param {string} orderHandle - Order handle\n * @param {OrderStatus} orderStatus - Order status\n * @param {Object} data - Geotag data JSON\n * @param {Location} expectedLocation - Expected location\n * @returns location with deviation if success or LocationError if failure\n */\n static async addGeotag(\n orderHandle: string,\n orderStatus: OrderStatus,\n data: Object,\n expectedLocation: Location\n ): Promise<Result<LocationWithDeviation, LocationError>>;\n\n /**\n * @deprecated\n * Adds a new geotag\n *\n * @param {Object} data - Geotag data JSON\n * @returns current location if success or LocationError if failure\n */\n static async addGeotag(\n data: Object\n ): Promise<Result<Location, LocationError>>;\n\n /**\n * @deprecated\n * Adds a new geotag with expected location\n *\n * @param {Object} data - Geotag data JSON\n * @param {Location} expectedLocation - Expected location\n * @returns location with deviation if success or LocationError if failure\n */\n static async addGeotag(\n data: Object,\n expectedLocation: Location\n ): Promise<Result<LocationWithDeviation, LocationError>>;\n\n static async addGeotag(\n ...args: any[]\n ): Promise<Result<Location | LocationWithDeviation, LocationError>> {\n if (\n args.length === 3 &&\n typeof args[0] === 'string' &&\n HyperTrack.isOrderStatus(args[1]) &&\n typeof args[2] === 'object'\n ) {\n // addGeotag(orderHandle: string, orderStatus: OrderStatus, data: Object)\n return HyperTrackSdk.addGeotag({\n orderHandle: {\n type: 'orderHandle',\n value: args[0],\n } as OrderHandle,\n orderStatus: args[1],\n data: args[2],\n expectedLocation: undefined,\n } as GeotagData).then(\n (locationResponse: Result<LocationInternal, LocationErrorInternal>) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n }\n if (\n args.length === 4 &&\n typeof args[0] === 'string' &&\n HyperTrack.isOrderStatus(args[1]) &&\n typeof args[2] === 'object' &&\n HyperTrack.isLocation(args[3])\n ) {\n // addGeotag(orderHandle: string, orderStatus: OrderStatus, data: Object, expectedLocation: Location)\n return HyperTrackSdk.addGeotag({\n orderHandle: {\n type: 'orderHandle',\n value: args[0],\n } as OrderHandle,\n orderStatus: args[1],\n data: args[2],\n expectedLocation: {\n type: 'location',\n value: {\n latitude: args[3].latitude,\n longitude: args[3].longitude,\n },\n } as LocationInternal,\n } as GeotagData).then(\n (\n locationResponse: Result<\n LocationWithDeviationInternal,\n LocationErrorInternal\n >\n ) => {\n return this.deserializeLocationWithDeviationResponse(\n locationResponse\n );\n }\n );\n }\n if (args.length === 1 && typeof args[0] === 'object') {\n // addGeotag(data: Object)\n return HyperTrackSdk.addGeotag({\n data: args[0],\n expectedLocation: undefined,\n } as GeotagData).then(\n (locationResponse: Result<LocationInternal, LocationErrorInternal>) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n }\n if (\n args.length === 2 &&\n typeof args[0] === 'object' &&\n HyperTrack.isLocation(args[1])\n ) {\n // addGeotag(data: Object, expectedLocation: Location)\n return HyperTrackSdk.addGeotag({\n data: args[0],\n expectedLocation: {\n type: 'location',\n value: {\n latitude: args[1].latitude,\n longitude: args[1].longitude,\n },\n } as LocationInternal,\n } as GeotagData).then(\n (\n locationResponse: Result<\n LocationWithDeviationInternal,\n LocationErrorInternal\n >\n ) => {\n return this.deserializeLocationWithDeviationResponse(\n locationResponse\n );\n }\n );\n }\n throw new Error(`Invalid addGeotag() arguments: ${JSON.stringify(args)}`);\n }\n\n /**\n * Returns a string that is used to uniquely identify the device\n *\n * @returns {string} Device ID\n */\n static async getDeviceId(): Promise<string> {\n return HyperTrackSdk.getDeviceId().then(\n (deviceId: DeviceId) => deviceId.value\n );\n }\n\n static async getDynamicPublishableKey(): Promise<string> {\n return HyperTrackSdk.getDynamicPublishableKey().then(\n (dynamicPublishableKey: DynamicPublishableKey) =>\n this.deserializeDynamicPublishableKey(dynamicPublishableKey)\n );\n }\n\n /**\n * Returns a list of errors that blocks SDK from tracking\n *\n * @returns {HyperTrackError[]} List of errors\n */\n static async getErrors(): Promise<HyperTrackError[]> {\n return HyperTrackSdk.getErrors().then(\n (errors: HyperTrackErrorInternal[]) => {\n return this.deserializeHyperTrackErrors(errors);\n }\n );\n }\n\n /**\n * Reflects availability of the device for the Nearby search\n *\n * @returns true when is available or false when unavailable\n */\n static async getIsAvailable(): Promise<boolean> {\n return HyperTrackSdk.getIsAvailable().then(\n (isAvailable: IsAvailable) => isAvailable.value\n );\n }\n\n /**\n * Reflects the tracking intent for the device\n *\n * @returns {boolean} Whether the user's movement data is getting tracked or not.\n */\n static async getIsTracking(): Promise<boolean> {\n return HyperTrackSdk.getIsTracking().then(\n (isTracking: IsTracking) => isTracking.value\n );\n }\n\n /**\n * Reflects the current location of the user or an outage reason\n */\n static async getLocation(): Promise<Result<Location, LocationError>> {\n return HyperTrackSdk.getLocation().then(\n (locationResponse: Result<LocationInternal, LocationErrorInternal>) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n }\n\n /**\n * Gets the metadata that is set for the device\n *\n * @returns {Object} Metadata JSON\n */\n static async getMetadata(): Promise<Object> {\n return HyperTrackSdk.getMetadata().then((metadata: Metadata) => {\n return this.deserializeMetadata(metadata);\n });\n }\n\n /**\n * Gets the name that is set for the device\n *\n * @returns {string} Device name\n */\n static async getName(): Promise<string> {\n return HyperTrackSdk.getName().then((name: Name) => {\n return this.deserializeName(name);\n });\n }\n\n /**\n * Gets the active orders for the worker. The orders are sorted with the ordering in \n * which the worker should complete them.\n *\n * @returns {Map<string, Order>} Map of orders\n */\n static async getOrders(): Promise<Map<string, Order>> {\n return HyperTrackSdk.getOrders().then((orders: OrdersInternal) => {\n return this.deserializeOrders(orders);\n });\n }\n\n /**\n * A primary identifier that uniquely identifies the worker outside of HyperTrack.\n * Example: email, phone number, database id\n * It is usually obtained and set when the worker logs into the app.\n * Set it to an empty string \"\" when the worker logs out of the app to un-bind the device from the worker and\n * avoid unintentional tracking.\n */\n static async getWorkerHandle(): Promise<string> {\n return HyperTrackSdk.getWorkerHandle().then(\n (workerHandle: WorkerHandle) => workerHandle.value\n );\n }\n\n /**\n * Requests one-time location update and returns the location once it is available, or error.\n *\n * Only one locate subscription can be active at a time. If you re-subscribe, the old EmitterSubscription\n * will be automaticaly removed.\n *\n * This method will start location tracking if called, and will stop it when the location is received or\n * the subscription is cancelled. If any other tracking intent is present (e.g. isAvailable is set to `true`),\n * the tracking will not be stopped.\n *\n * @param callback\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.locate(location => {\n * ...\n * })\n *\n * // to unsubscribe\n * subscription.remove()\n * ```\n */\n static locate(\n callback: (location: Result<Location, HyperTrackError[]>) => void\n ) {\n this.locateSubscription?.remove();\n this.locateSubscription = EventEmitter.addListener(\n EVENT_LOCATE,\n (location: Result<LocationInternal, HyperTrackErrorInternal[]>) => {\n callback(this.deserializeLocateResponse(location));\n }\n );\n HyperTrackSdk.locate();\n return this.locateSubscription;\n }\n\n static setDynamicPublishableKey(dynamicPublishableKey: string) {\n HyperTrackSdk.setDynamicPublishableKey({\n type: 'dynamicPublishableKey',\n value: dynamicPublishableKey,\n } as DynamicPublishableKey);\n }\n\n /**\n * Sets the availability of the device for the Nearby search\n *\n * @param isAvailable true when is available or false when unavailable\n */\n static setIsAvailable(isAvailable: boolean) {\n HyperTrackSdk.setIsAvailable({\n type: 'isAvailable',\n value: isAvailable,\n } as IsAvailable);\n }\n\n /**\n * Sets the tracking intent for the device\n *\n * @param {boolean} isTracking\n */\n static setIsTracking(isTracking: boolean) {\n HyperTrackSdk.setIsTracking({\n type: 'isTracking',\n value: isTracking,\n } as IsTracking);\n }\n\n /**\n * Sets the metadata for the device\n *\n * @param {Object} data - Metadata JSON\n */\n static setMetadata(data: Object) {\n HyperTrackSdk.setMetadata({\n type: 'metadata',\n value: data,\n });\n }\n\n /**\n * Sets the name for the device\n *\n * @param {string} name\n */\n static setName(name: string) {\n HyperTrackSdk.setName({\n type: 'name',\n value: name,\n } as Name);\n }\n\n /**\n * A primary identifier that uniquely identifies the worker outside of HyperTrack.\n * Example: email, phone number, database id\n * It is usually obtained and set when the worker logs into the app.\n * Set it to an empty string \"\" when the worker logs out of the app to un-bind the device from the worker and\n * avoid unintentional tracking.\n *\n * @param {string} workerHandle\n */\n static setWorkerHandle(workerHandle: string) {\n HyperTrackSdk.setWorkerHandle({\n type: 'workerHandle',\n value: workerHandle,\n } as WorkerHandle);\n }\n\n /**\n * Subscribe to tracking errors\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToErrors(errors => {\n * errors.forEach(error => {\n * // ... error\n * })\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToErrors(\n listener: (errors: HyperTrackError[]) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_ERRORS,\n (rawErrors: HyperTrackErrorInternal[]) => {\n listener(this.deserializeHyperTrackErrors(rawErrors));\n }\n );\n }\n\n /**\n * Subscribe to availability changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToIsAvailable(isAvailable => {\n * if (isAvailable) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToIsAvailable(\n listener: (isAvailable: boolean) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_IS_AVAILABLE,\n (isAvailable: IsAvailable) => {\n listener(isAvailable.value);\n }\n );\n }\n\n /**\n * Subscribe to tracking intent changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToIsTracking(isTracking => {\n * if (isTracking) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToIsTracking(\n listener: (isTracking: boolean) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_IS_TRACKING,\n (isTracking: IsTracking) => {\n listener(isTracking.value);\n }\n );\n }\n\n /**\n * Subscribe to location changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToLocation(location => {\n * ...\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToLocation(\n listener: (location: Result<Location, LocationError>) => void\n ) {\n return EventEmitter.addListener(\n EVENT_LOCATION,\n (location: Result<LocationInternal, LocationErrorInternal>) => {\n listener(this.deserializeLocationResponse(location));\n }\n );\n }\n\n /**\n * Subscribe to changes in the orders assigned to the worker\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToOrders(orders => {\n * ...\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToOrders(\n listener: (orders: Map<string, Order>) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(EVENT_ORDERS, (orders: OrdersInternal) => {\n listener(this.deserializeOrders(orders));\n });\n }\n\n /** @ignore */\n private static deserializeDynamicPublishableKey(\n dynamicPublishableKey: DynamicPublishableKey\n ): string {\n if (dynamicPublishableKey.type !== 'dynamicPublishableKey') {\n throw new Error(\n `Invalid dynamicPublishableKey: ${JSON.stringify(\n dynamicPublishableKey\n )}`\n );\n }\n return dynamicPublishableKey.value;\n }\n\n /** @ignore */\n private static deserializeHyperTrackErrors(\n errors: HyperTrackErrorInternal[]\n ): HyperTrackError[] {\n let res = errors.map((error: HyperTrackErrorInternal) => {\n if (error.type !== 'error') {\n throw new Error('Invalid error type');\n }\n return Object.keys(HyperTrackError).find(\n (key) =>\n HyperTrackError[key as keyof typeof HyperTrackError] === error.value\n ) as HyperTrackError;\n });\n return res;\n }\n\n /** @ignore */\n private static deserializeIsInsideGeofence(\n isInsideGeofence: Result<boolean, LocationErrorInternal>\n ): Result<boolean, LocationError> {\n switch (isInsideGeofence.type) {\n case 'success':\n return {\n type: 'success',\n value: isInsideGeofence.value,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeLocationError(isInsideGeofence.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocateResponse(\n response: Result<LocationInternal, HyperTrackErrorInternal[]>\n ): Result<Location, HyperTrackError[]> {\n switch (response.type) {\n case 'success':\n return {\n type: 'success',\n value: response.value.value,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeHyperTrackErrors(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationError(\n locationError: LocationErrorInternal\n ): LocationError {\n switch (locationError.type) {\n case 'notRunning':\n case 'starting':\n return locationError;\n case 'errors':\n return {\n type: 'errors',\n value: this.deserializeHyperTrackErrors(locationError.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationResponse(\n response: Result<LocationInternal, LocationErrorInternal>\n ): Result<Location, LocationError> {\n switch (response.type) {\n case 'success':\n return {\n type: 'success',\n value: response.value.value,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeLocationError(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationWithDeviationResponse(\n response: Result<LocationWithDeviationInternal, LocationErrorInternal>\n ): Result<LocationWithDeviation, LocationError> {\n switch (response.type) {\n case 'success':\n const locationWithDeviationInternal: LocationWithDeviationInternal =\n response.value;\n const locationInternal: LocationInternal =\n locationWithDeviationInternal.value.location;\n\n return {\n type: 'success',\n value: {\n location: locationInternal.value,\n deviation: locationWithDeviationInternal.value.deviation,\n } as LocationWithDeviation,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeLocationError(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeMetadata(metadata: Metadata): Object {\n if (metadata.type !== 'metadata') {\n throw new Error(`Invalid metadata: ${JSON.stringify(metadata)}`);\n }\n return metadata.value;\n }\n\n /** @ignore */\n private static deserializeName(name: Name): string {\n if (name.type !== 'name') {\n throw new Error(`Invalid name: ${JSON.stringify(name)}`);\n }\n return name.value;\n }\n\n /** @ignore */\n private static deserializeOrders(orders: OrdersInternal): Map<string, Order> {\n if (orders.type !== 'orders') {\n throw new Error(`Invalid orders: ${JSON.stringify(orders)}`);\n }\n let result = new Map<string, Order>();\n Object.entries(orders.value)\n .map(([_, value]: [string, OrderInternal]) => {\n return value;\n })\n .sort(\n (first: OrderInternal, second: OrderInternal) =>\n first.index - second.index\n )\n .forEach((orderInternal: OrderInternal) => {\n result.set(orderInternal.orderHandle, {\n orderHandle: orderInternal.orderHandle,\n isInsideGeofence: this.deserializeIsInsideGeofence(\n orderInternal.isInsideGeofence\n ),\n } as Order);\n });\n return result;\n }\n\n /** @ignore */\n private static isLocation(obj: Location): obj is Location {\n return (\n 'latitude' in obj &&\n typeof obj.latitude === 'number' &&\n 'longitude' in obj &&\n typeof obj.longitude === 'number'\n );\n }\n\n /** @ignore */\n private static isOrderStatus(obj: OrderStatus): obj is OrderStatus {\n return 'type' in obj && obj.type.startsWith('orderStatus');\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAMA,IAAAC,gBAAA,GAAAD,OAAA;AAA+D,SAAAE,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YA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E,gBAAgB,EAAE,IAAI,CAACD,2BAA2B,CAChDiB,aAAa,CAAChB,gBAChB;MACF,CAAU,CAAC;IACb,CAAC,CAAC;IACJ,OAAOO,MAAM;EACf;;EAEA;EACA,OAAejE,UAAUA,CAACrD,GAAa,EAAmB;IACxD,OACE,UAAU,IAAIA,GAAG,IACjB,OAAOA,GAAG,CAACsD,QAAQ,KAAK,QAAQ,IAChC,WAAW,IAAItD,GAAG,IAClB,OAAOA,GAAG,CAACuD,SAAS,KAAK,QAAQ;EAErC;;EAEA;EACA,OAAeZ,aAAaA,CAAC3C,GAAgB,EAAsB;IACjE,OAAO,MAAM,IAAIA,GAAG,IAAIA,GAAG,CAAC6C,IAAI,CAACoF,UAAU,CAAC,aAAa,CAAC;EAC5D;AACF;AAACC,OAAA,CAAApG,OAAA,GAAAS,UAAA;AAAAxC,eAAA,CAlrBoBwC,UAAU"}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_HyperTrackError","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","EVENT_ERRORS","EVENT_IS_AVAILABLE","EVENT_IS_TRACKING","EVENT_LOCATE","EVENT_LOCATION","EVENT_ORDERS","LINKING_ERROR","Platform","select","ios","default","HyperTrackSdk","NativeModules","HyperTrackReactNativePlugin","Proxy","get","Error","EventEmitter","NativeEventEmitter","HyperTrack","addGeotag","args","length","isOrderStatus","orderHandle","type","orderStatus","data","expectedLocation","undefined","then","locationResponse","deserializeLocationResponse","isLocation","latitude","longitude","deserializeLocationWithDeviationResponse","JSON","stringify","getDeviceId","deviceId","getDynamicPublishableKey","dynamicPublishableKey","deserializeDynamicPublishableKey","getErrors","errors","deserializeHyperTrackErrors","getIsAvailable","isAvailable","getIsTracking","isTracking","getLocation","getMetadata","metadata","deserializeMetadata","getName","name","deserializeName","getOrders","orders","deserializeOrders","getWorkerHandle","workerHandle","locate","callback","_this$locateSubscript","locateSubscription","remove","addListener","location","deserializeLocateResponse","setDynamicPublishableKey","setIsAvailable","setIsTracking","setMetadata","setName","setWorkerHandle","subscribeToErrors","listener","rawErrors","subscribeToIsAvailable","subscribeToIsTracking","subscribeToLocation","subscribeToOrders","res","map","error","keys","HyperTrackError","find","deserializeIsInsideGeofence","isInsideGeofence","successValue","deserializeLocationError","response","locationError","locationWithDeviationInternal","locationInternal","deviation","result","Map","entries","_","sort","first","second","index","forEach","orderInternal","set","startsWith","exports"],"sources":["HyperTrack.ts"],"sourcesContent":["import {\n NativeModules,\n Platform,\n NativeEventEmitter,\n type EmitterSubscription,\n} from 'react-native';\nimport { HyperTrackError } from './data_types/HyperTrackError';\nimport type { IsAvailable } from './data_types/internal/IsAvailable';\nimport type { IsTracking } from './data_types/internal/IsTracking';\nimport type { Location } from './data_types/Location';\nimport type { LocationError } from './data_types/LocationError';\nimport type { DeviceId } from './data_types/internal/DeviceId';\nimport type { GeotagData } from './data_types/internal/GeotagData';\nimport type { Name } from './data_types/internal/Name';\nimport type { HyperTrackErrorInternal } from './data_types/internal/HyperTrackErrorInternal';\nimport type { LocationWithDeviation } from './data_types/LocationWithDeviation';\nimport type { LocationErrorInternal } from './data_types/internal/LocationErrorInternal';\nimport type { Result } from './data_types/Result';\nimport type { LocationInternal } from './data_types/internal/LocationInternal';\nimport type { LocationWithDeviationInternal } from './data_types/internal/LocationWithDeviationInternal';\nimport type { Metadata } from './data_types/internal/Metadata';\nimport type { DynamicPublishableKey } from './data_types/internal/DynamicPublishableKey';\nimport type { OrderStatus } from './data_types/OrderStatus';\nimport type { OrderHandle } from './data_types/internal/OrderHandle';\nimport type { WorkerHandle } from './data_types/internal/WorkerHandle';\nimport type { Order } from './data_types/Order';\nimport type { OrdersInternal } from './data_types/internal/OrdersInternal';\nimport type { OrderInternal } from './data_types/internal/OrderInternal';\nimport type { IsInsideGeofence } from './data_types/internal/IsInsideGeofence';\n\nconst EVENT_ERRORS = 'errors';\nconst EVENT_IS_AVAILABLE = 'isAvailable';\nconst EVENT_IS_TRACKING = 'isTracking';\nconst EVENT_LOCATE = 'locate';\nconst EVENT_LOCATION = 'location';\nconst EVENT_ORDERS = 'orders';\n\nconst LINKING_ERROR =\n `The package 'hypertrack-sdk-react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst HyperTrackSdk = NativeModules.HyperTrackReactNativePlugin\n ? NativeModules.HyperTrackReactNativePlugin\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nconst EventEmitter = new NativeEventEmitter(HyperTrackSdk);\n\nexport default class HyperTrack {\n private static locateSubscription: EmitterSubscription | undefined;\n\n /**\n * Adds a new geotag. Check [Shift tracking](https://hypertrack.com/docs/shift-tracking) and [Clock In/Out tagging](https://hypertrack.com/docs/clock-inout-tracking) docs to learn how to use Order handle and Order status params.\n *\n * @param {string} orderHandle - Order handle\n * @param {OrderStatus} orderStatus - Order status\n * @param {Object} data - Geotag data JSON\n * @returns current location if success or LocationError if failure\n */\n static async addGeotag(\n orderHandle: string,\n orderStatus: OrderStatus,\n data: Object\n ): Promise<Result<Location, LocationError>>;\n\n /**\n * Adds a new geotag with expected location. Check [Shift tracking](https://hypertrack.com/docs/shift-tracking) and [Clock In/Out tagging](https://hypertrack.com/docs/clock-inout-tracking) docs to learn how to use Order handle and Order status params.\n *\n * @param {string} orderHandle - Order handle\n * @param {OrderStatus} orderStatus - Order status\n * @param {Object} data - Geotag data JSON\n * @param {Location} expectedLocation - Expected location\n * @returns location with deviation if success or LocationError if failure\n */\n static async addGeotag(\n orderHandle: string,\n orderStatus: OrderStatus,\n data: Object,\n expectedLocation: Location\n ): Promise<Result<LocationWithDeviation, LocationError>>;\n\n /**\n * @deprecated\n * Adds a new geotag\n *\n * @param {Object} data - Geotag data JSON\n * @returns current location if success or LocationError if failure\n */\n static async addGeotag(\n data: Object\n ): Promise<Result<Location, LocationError>>;\n\n /**\n * @deprecated\n * Adds a new geotag with expected location\n *\n * @param {Object} data - Geotag data JSON\n * @param {Location} expectedLocation - Expected location\n * @returns location with deviation if success or LocationError if failure\n */\n static async addGeotag(\n data: Object,\n expectedLocation: Location\n ): Promise<Result<LocationWithDeviation, LocationError>>;\n\n static async addGeotag(\n ...args: any[]\n ): Promise<Result<Location | LocationWithDeviation, LocationError>> {\n if (\n args.length === 3 &&\n typeof args[0] === 'string' &&\n HyperTrack.isOrderStatus(args[1]) &&\n typeof args[2] === 'object'\n ) {\n // addGeotag(orderHandle: string, orderStatus: OrderStatus, data: Object)\n return HyperTrackSdk.addGeotag({\n orderHandle: {\n type: 'orderHandle',\n value: args[0],\n } as OrderHandle,\n orderStatus: args[1],\n data: args[2],\n expectedLocation: undefined,\n } as GeotagData).then(\n (locationResponse: Result<LocationInternal, LocationErrorInternal>) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n }\n if (\n args.length === 4 &&\n typeof args[0] === 'string' &&\n HyperTrack.isOrderStatus(args[1]) &&\n typeof args[2] === 'object' &&\n HyperTrack.isLocation(args[3])\n ) {\n // addGeotag(orderHandle: string, orderStatus: OrderStatus, data: Object, expectedLocation: Location)\n return HyperTrackSdk.addGeotag({\n orderHandle: {\n type: 'orderHandle',\n value: args[0],\n } as OrderHandle,\n orderStatus: args[1],\n data: args[2],\n expectedLocation: {\n type: 'location',\n value: {\n latitude: args[3].latitude,\n longitude: args[3].longitude,\n },\n } as LocationInternal,\n } as GeotagData).then(\n (\n locationResponse: Result<\n LocationWithDeviationInternal,\n LocationErrorInternal\n >\n ) => {\n return this.deserializeLocationWithDeviationResponse(\n locationResponse\n );\n }\n );\n }\n if (args.length === 1 && typeof args[0] === 'object') {\n // addGeotag(data: Object)\n return HyperTrackSdk.addGeotag({\n data: args[0],\n expectedLocation: undefined,\n } as GeotagData).then(\n (locationResponse: Result<LocationInternal, LocationErrorInternal>) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n }\n if (\n args.length === 2 &&\n typeof args[0] === 'object' &&\n HyperTrack.isLocation(args[1])\n ) {\n // addGeotag(data: Object, expectedLocation: Location)\n return HyperTrackSdk.addGeotag({\n data: args[0],\n expectedLocation: {\n type: 'location',\n value: {\n latitude: args[1].latitude,\n longitude: args[1].longitude,\n },\n } as LocationInternal,\n } as GeotagData).then(\n (\n locationResponse: Result<\n LocationWithDeviationInternal,\n LocationErrorInternal\n >\n ) => {\n return this.deserializeLocationWithDeviationResponse(\n locationResponse\n );\n }\n );\n }\n throw new Error(`Invalid addGeotag() arguments: ${JSON.stringify(args)}`);\n }\n\n /**\n * Returns a string that is used to uniquely identify the device\n *\n * @returns {string} Device ID\n */\n static async getDeviceId(): Promise<string> {\n return HyperTrackSdk.getDeviceId().then(\n (deviceId: DeviceId) => deviceId.value\n );\n }\n\n static async getDynamicPublishableKey(): Promise<string> {\n return HyperTrackSdk.getDynamicPublishableKey().then(\n (dynamicPublishableKey: DynamicPublishableKey) =>\n this.deserializeDynamicPublishableKey(dynamicPublishableKey)\n );\n }\n\n /**\n * Returns a list of errors that blocks SDK from tracking\n *\n * @returns {HyperTrackError[]} List of errors\n */\n static async getErrors(): Promise<HyperTrackError[]> {\n return HyperTrackSdk.getErrors().then(\n (errors: HyperTrackErrorInternal[]) => {\n return this.deserializeHyperTrackErrors(errors);\n }\n );\n }\n\n /**\n * Reflects availability of the device for the Nearby search\n *\n * @returns true when is available or false when unavailable\n */\n static async getIsAvailable(): Promise<boolean> {\n return HyperTrackSdk.getIsAvailable().then(\n (isAvailable: IsAvailable) => isAvailable.value\n );\n }\n\n /**\n * Reflects the tracking intent for the device\n *\n * @returns {boolean} Whether the user's movement data is getting tracked or not.\n */\n static async getIsTracking(): Promise<boolean> {\n return HyperTrackSdk.getIsTracking().then(\n (isTracking: IsTracking) => isTracking.value\n );\n }\n\n /**\n * Reflects the current location of the user or an outage reason\n */\n static async getLocation(): Promise<Result<Location, LocationError>> {\n return HyperTrackSdk.getLocation().then(\n (locationResponse: Result<LocationInternal, LocationErrorInternal>) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n }\n\n /**\n * Gets the metadata that is set for the device\n *\n * @returns {Object} Metadata JSON\n */\n static async getMetadata(): Promise<Object> {\n return HyperTrackSdk.getMetadata().then((metadata: Metadata) => {\n return this.deserializeMetadata(metadata);\n });\n }\n\n /**\n * Gets the name that is set for the device\n *\n * @returns {string} Device name\n */\n static async getName(): Promise<string> {\n return HyperTrackSdk.getName().then((name: Name) => {\n return this.deserializeName(name);\n });\n }\n\n /**\n * Gets the active orders for the worker. The orders are sorted with the ordering in \n * which the worker should complete them.\n *\n * @returns {Map<string, Order>} Map of orders\n */\n static async getOrders(): Promise<Map<string, Order>> {\n return HyperTrackSdk.getOrders().then((orders: OrdersInternal) => {\n return this.deserializeOrders(orders);\n });\n }\n\n /**\n * A primary identifier that uniquely identifies the worker outside of HyperTrack.\n * Example: email, phone number, database id\n * It is usually obtained and set when the worker logs into the app.\n * Set it to an empty string \"\" when the worker logs out of the app to un-bind the device from the worker and\n * avoid unintentional tracking.\n */\n static async getWorkerHandle(): Promise<string> {\n return HyperTrackSdk.getWorkerHandle().then(\n (workerHandle: WorkerHandle) => workerHandle.value\n );\n }\n\n /**\n * Requests one-time location update and returns the location once it is available, or error.\n *\n * Only one locate subscription can be active at a time. If you re-subscribe, the old EmitterSubscription\n * will be automaticaly removed.\n *\n * This method will start location tracking if called, and will stop it when the location is received or\n * the subscription is cancelled. If any other tracking intent is present (e.g. isAvailable is set to `true`),\n * the tracking will not be stopped.\n *\n * @param callback\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.locate(location => {\n * ...\n * })\n *\n * // to unsubscribe\n * subscription.remove()\n * ```\n */\n static locate(\n callback: (location: Result<Location, HyperTrackError[]>) => void\n ) {\n this.locateSubscription?.remove();\n this.locateSubscription = EventEmitter.addListener(\n EVENT_LOCATE,\n (location: Result<LocationInternal, HyperTrackErrorInternal[]>) => {\n callback(this.deserializeLocateResponse(location));\n }\n );\n HyperTrackSdk.locate();\n return this.locateSubscription;\n }\n\n static setDynamicPublishableKey(dynamicPublishableKey: string) {\n HyperTrackSdk.setDynamicPublishableKey({\n type: 'dynamicPublishableKey',\n value: dynamicPublishableKey,\n } as DynamicPublishableKey);\n }\n\n /**\n * Sets the availability of the device for the Nearby search\n *\n * @param isAvailable true when is available or false when unavailable\n */\n static setIsAvailable(isAvailable: boolean) {\n HyperTrackSdk.setIsAvailable({\n type: 'isAvailable',\n value: isAvailable,\n } as IsAvailable);\n }\n\n /**\n * Sets the tracking intent for the device\n *\n * @param {boolean} isTracking\n */\n static setIsTracking(isTracking: boolean) {\n HyperTrackSdk.setIsTracking({\n type: 'isTracking',\n value: isTracking,\n } as IsTracking);\n }\n\n /**\n * Sets the metadata for the device\n *\n * @param {Object} data - Metadata JSON\n */\n static setMetadata(data: Object) {\n HyperTrackSdk.setMetadata({\n type: 'metadata',\n value: data,\n });\n }\n\n /**\n * Sets the name for the device\n *\n * @param {string} name\n */\n static setName(name: string) {\n HyperTrackSdk.setName({\n type: 'name',\n value: name,\n } as Name);\n }\n\n /**\n * A primary identifier that uniquely identifies the worker outside of HyperTrack.\n * Example: email, phone number, database id\n * It is usually obtained and set when the worker logs into the app.\n * Set it to an empty string \"\" when the worker logs out of the app to un-bind the device from the worker and\n * avoid unintentional tracking.\n *\n * @param {string} workerHandle\n */\n static setWorkerHandle(workerHandle: string) {\n HyperTrackSdk.setWorkerHandle({\n type: 'workerHandle',\n value: workerHandle,\n } as WorkerHandle);\n }\n\n /**\n * Subscribe to tracking errors\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToErrors(errors => {\n * errors.forEach(error => {\n * // ... error\n * })\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToErrors(\n listener: (errors: HyperTrackError[]) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_ERRORS,\n (rawErrors: HyperTrackErrorInternal[]) => {\n listener(this.deserializeHyperTrackErrors(rawErrors));\n }\n );\n }\n\n /**\n * Subscribe to availability changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToIsAvailable(isAvailable => {\n * if (isAvailable) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToIsAvailable(\n listener: (isAvailable: boolean) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_IS_AVAILABLE,\n (isAvailable: IsAvailable) => {\n listener(isAvailable.value);\n }\n );\n }\n\n /**\n * Subscribe to tracking intent changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToIsTracking(isTracking => {\n * if (isTracking) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToIsTracking(\n listener: (isTracking: boolean) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_IS_TRACKING,\n (isTracking: IsTracking) => {\n listener(isTracking.value);\n }\n );\n }\n\n /**\n * Subscribe to location changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToLocation(location => {\n * ...\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToLocation(\n listener: (location: Result<Location, LocationError>) => void\n ) {\n return EventEmitter.addListener(\n EVENT_LOCATION,\n (location: Result<LocationInternal, LocationErrorInternal>) => {\n listener(this.deserializeLocationResponse(location));\n }\n );\n }\n\n /**\n * Subscribe to changes in the orders assigned to the worker\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToOrders(orders => {\n * ...\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToOrders(\n listener: (orders: Map<string, Order>) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(EVENT_ORDERS, (orders: OrdersInternal) => {\n listener(this.deserializeOrders(orders));\n });\n }\n\n /** @ignore */\n private static deserializeDynamicPublishableKey(\n dynamicPublishableKey: DynamicPublishableKey\n ): string {\n if (dynamicPublishableKey.type !== 'dynamicPublishableKey') {\n throw new Error(\n `Invalid dynamicPublishableKey: ${JSON.stringify(\n dynamicPublishableKey\n )}`\n );\n }\n return dynamicPublishableKey.value;\n }\n\n /** @ignore */\n private static deserializeHyperTrackErrors(\n errors: HyperTrackErrorInternal[]\n ): HyperTrackError[] {\n let res = errors.map((error: HyperTrackErrorInternal) => {\n if (error.type !== 'error') {\n throw new Error('Invalid error type');\n }\n return Object.keys(HyperTrackError).find(\n (key) =>\n HyperTrackError[key as keyof typeof HyperTrackError] === error.value\n ) as HyperTrackError;\n });\n return res;\n }\n\n /** @ignore */\n private static deserializeIsInsideGeofence(\n isInsideGeofence: Result<IsInsideGeofence, LocationErrorInternal>,\n ): Result<boolean, LocationError> {\n switch (isInsideGeofence.type) {\n case 'success':\n let successValue = isInsideGeofence.value;\n if (successValue.type !== 'isInsideGeofence') {\n throw new Error(`Invalid isInsideGeofence: ${JSON.stringify(successValue)}`);\n }\n return {\n type: 'success',\n value: successValue.value,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeLocationError(isInsideGeofence.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocateResponse(\n response: Result<LocationInternal, HyperTrackErrorInternal[]>\n ): Result<Location, HyperTrackError[]> {\n switch (response.type) {\n case 'success':\n return {\n type: 'success',\n value: response.value.value,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeHyperTrackErrors(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationError(\n locationError: LocationErrorInternal\n ): LocationError {\n switch (locationError.type) {\n case 'notRunning':\n case 'starting':\n return locationError;\n case 'errors':\n return {\n type: 'errors',\n value: this.deserializeHyperTrackErrors(locationError.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationResponse(\n response: Result<LocationInternal, LocationErrorInternal>\n ): Result<Location, LocationError> {\n switch (response.type) {\n case 'success':\n return {\n type: 'success',\n value: response.value.value,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeLocationError(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationWithDeviationResponse(\n response: Result<LocationWithDeviationInternal, LocationErrorInternal>\n ): Result<LocationWithDeviation, LocationError> {\n switch (response.type) {\n case 'success':\n const locationWithDeviationInternal: LocationWithDeviationInternal =\n response.value;\n const locationInternal: LocationInternal =\n locationWithDeviationInternal.value.location;\n\n return {\n type: 'success',\n value: {\n location: locationInternal.value,\n deviation: locationWithDeviationInternal.value.deviation,\n } as LocationWithDeviation,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeLocationError(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeMetadata(metadata: Metadata): Object {\n if (metadata.type !== 'metadata') {\n throw new Error(`Invalid metadata: ${JSON.stringify(metadata)}`);\n }\n return metadata.value;\n }\n\n /** @ignore */\n private static deserializeName(name: Name): string {\n if (name.type !== 'name') {\n throw new Error(`Invalid name: ${JSON.stringify(name)}`);\n }\n return name.value;\n }\n\n /** @ignore */\n private static deserializeOrders(orders: OrdersInternal): Map<string, Order> {\n if (orders.type !== 'orders') {\n throw new Error(`Invalid orders: ${JSON.stringify(orders)}`);\n }\n let result = new Map<string, Order>();\n Object.entries(orders.value)\n .map(([_, value]: [string, OrderInternal]) => {\n return value;\n })\n .sort(\n (first: OrderInternal, second: OrderInternal) =>\n first.index - second.index\n )\n .forEach((orderInternal: OrderInternal) => {\n result.set(orderInternal.orderHandle, {\n orderHandle: orderInternal.orderHandle,\n isInsideGeofence: this.deserializeIsInsideGeofence(\n orderInternal.isInsideGeofence\n ),\n } as Order);\n });\n return result;\n }\n\n /** @ignore */\n private static isLocation(obj: Location): obj is Location {\n return (\n 'latitude' in obj &&\n typeof obj.latitude === 'number' &&\n 'longitude' in obj &&\n typeof obj.longitude === 'number'\n );\n }\n\n /** @ignore */\n private static isOrderStatus(obj: OrderStatus): obj is OrderStatus {\n return 'type' in obj && obj.type.startsWith('orderStatus');\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAMA,IAAAC,gBAAA,GAAAD,OAAA;AAA+D,SAAAE,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAE,MAAA,CAAAF,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAI,CAAA,2BAAAJ,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAK,CAAA,GAAAL,CAAA,CAAAM,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAJ,CAAA,GAAAI,CAAA,CAAAG,IAAA,CAAAR,CAAA,EAAAI,CAAA,uCAAAH,CAAA,SAAAA,CAAA,YAAAQ,SAAA,yEAAAL,CAAA,GAAAD,MAAA,GAAAO,MAAA,EAAAV,CAAA;AAwB/D,MAAMW,YAAY,GAAG,QAAQ;AAC7B,MAAMC,kBAAkB,GAAG,aAAa;AACxC,MAAMC,iBAAiB,GAAG,YAAY;AACtC,MAAMC,YAAY,GAAG,QAAQ;AAC7B,MAAMC,cAAc,GAAG,UAAU;AACjC,MAAMC,YAAY,GAAG,QAAQ;AAE7B,MAAMC,aAAa,GAChB,sFAAqF,GACtFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC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CAACnB,IAAY,EAAE;IAC3B7C,aAAa,CAACgE,OAAO,CAAC;MACpBlD,IAAI,EAAE,MAAM;MACZ3C,KAAK,EAAE0E;IACT,CAAS,CAAC;EACZ;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOoB,eAAeA,CAACd,YAAoB,EAAE;IAC3CnD,aAAa,CAACiE,eAAe,CAAC;MAC5BnD,IAAI,EAAE,cAAc;MACpB3C,KAAK,EAAEgF;IACT,CAAiB,CAAC;EACpB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOe,iBAAiBA,CACtBC,QAA6C,EACxB;IACrB,OAAO7D,YAAY,CAACmD,WAAW,CAC7BpE,YAAY,EACX+E,SAAoC,IAAK;MACxCD,QAAQ,CAAC,IAAI,CAAChC,2BAA2B,CAACiC,SAAS,CAAC,CAAC;IACvD,CACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,sBAAsBA,CAC3BF,QAAwC,EACnB;IACrB,OAAO7D,YAAY,CAACmD,WAAW,CAC7BnE,kBAAkB,EACjB+C,WAAwB,IAAK;MAC5B8B,QAAQ,CAAC9B,WAAW,CAAClE,KAAK,CAAC;IAC7B,CACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOmG,qBAAqBA,CAC1BH,QAAuC,EAClB;IACrB,OAAO7D,YAAY,CAACmD,WAAW,CAC7BlE,iBAAiB,EAChBgD,UAAsB,IAAK;MAC1B4B,QAAQ,CAAC5B,UAAU,CAACpE,KAAK,CAAC;IAC5B,CACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;E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