hypertrack-sdk-react-native 13.2.3 → 13.3.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/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.2/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/gradle.xml +15 -0
- package/android/.idea/misc.xml +9 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/gradle.properties +1 -1
- package/android/local.properties +8 -0
- package/android/src/main/java/com/reactnativehypertracksdk/HyperTrackReactNativePlugin.kt +16 -8
- package/android/src/main/java/com/reactnativehypertracksdk/ReactNativeSerialization.kt +2 -2
- package/android/src/main/java/com/reactnativehypertracksdk/common/GeotagData.kt +4 -1
- package/android/src/main/java/com/reactnativehypertracksdk/common/HyperTrackSdkWrapper.kt +41 -21
- package/android/src/main/java/com/reactnativehypertracksdk/common/Serialization.kt +156 -112
- package/android/src/main/java/com/reactnativehypertracksdk/common/WrapperResult.kt +3 -4
- package/hypertrack-sdk-react-native.podspec +1 -1
- package/ios/common/GeotagData.swift +10 -1
- package/ios/common/HyperTrackSDKWrapper.swift +33 -4
- package/ios/common/Serialization.swift +71 -2
- package/lib/commonjs/HyperTrack/HyperTrack.js +67 -6
- package/lib/commonjs/HyperTrack/HyperTrack.js.map +1 -1
- package/lib/commonjs/HyperTrack/data_types/OrderStatus.js +2 -0
- package/lib/commonjs/HyperTrack/data_types/OrderStatus.js.map +1 -0
- package/lib/commonjs/HyperTrack/data_types/internal/GeotagData.js.map +1 -1
- package/lib/commonjs/HyperTrack/data_types/internal/OrderHandle.js +2 -0
- package/lib/commonjs/HyperTrack/data_types/internal/OrderHandle.js.map +1 -0
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/HyperTrack/HyperTrack.js +67 -6
- package/lib/module/HyperTrack/HyperTrack.js.map +1 -1
- package/lib/module/HyperTrack/data_types/OrderStatus.js +2 -0
- package/lib/module/HyperTrack/data_types/OrderStatus.js.map +1 -0
- package/lib/module/HyperTrack/data_types/internal/GeotagData.js.map +1 -1
- package/lib/module/HyperTrack/data_types/internal/OrderHandle.js +2 -0
- package/lib/module/HyperTrack/data_types/internal/OrderHandle.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/HyperTrack/HyperTrack.d.ts +24 -0
- package/lib/typescript/HyperTrack/data_types/OrderStatus.d.ts +8 -0
- package/lib/typescript/HyperTrack/data_types/internal/GeotagData.d.ts +4 -0
- package/lib/typescript/HyperTrack/data_types/internal/OrderHandle.d.ts +4 -0
- package/lib/typescript/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/HyperTrack/HyperTrack.ts +102 -6
- package/src/HyperTrack/data_types/OrderStatus.ts +11 -0
- package/src/HyperTrack/data_types/internal/GeotagData.ts +4 -0
- package/src/HyperTrack/data_types/internal/OrderHandle.ts +4 -0
- package/src/index.tsx +1 -0
|
@@ -4,9 +4,30 @@ import type { Location } from './data_types/Location';
|
|
|
4
4
|
import type { LocationError } from './data_types/LocationError';
|
|
5
5
|
import type { LocationWithDeviation } from './data_types/LocationWithDeviation';
|
|
6
6
|
import type { Result } from './data_types/Result';
|
|
7
|
+
import type { OrderStatus } from './data_types/OrderStatus';
|
|
7
8
|
export default class HyperTrack {
|
|
8
9
|
private static locateSubscription;
|
|
9
10
|
/**
|
|
11
|
+
* 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.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} orderHandle - Order handle
|
|
14
|
+
* @param {OrderStatus} orderStatus - Order status
|
|
15
|
+
* @param {Object} data - Geotag data JSON
|
|
16
|
+
* @returns current location if success or LocationError if failure
|
|
17
|
+
*/
|
|
18
|
+
static addGeotag(orderHandle: string, orderStatus: OrderStatus, data: Object): Promise<Result<Location, LocationError>>;
|
|
19
|
+
/**
|
|
20
|
+
* 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.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} orderHandle - Order handle
|
|
23
|
+
* @param {OrderStatus} orderStatus - Order status
|
|
24
|
+
* @param {Object} data - Geotag data JSON
|
|
25
|
+
* @param {Location} expectedLocation - Expected location
|
|
26
|
+
* @returns location with deviation if success or LocationError if failure
|
|
27
|
+
*/
|
|
28
|
+
static addGeotag(orderHandle: string, orderStatus: OrderStatus, data: Object, expectedLocation: Location): Promise<Result<LocationWithDeviation, LocationError>>;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated
|
|
10
31
|
* Adds a new geotag
|
|
11
32
|
*
|
|
12
33
|
* @param {Object} data - Geotag data JSON
|
|
@@ -14,6 +35,7 @@ export default class HyperTrack {
|
|
|
14
35
|
*/
|
|
15
36
|
static addGeotag(data: Object): Promise<Result<Location, LocationError>>;
|
|
16
37
|
/**
|
|
38
|
+
* @deprecated
|
|
17
39
|
* Adds a new geotag with expected location
|
|
18
40
|
*
|
|
19
41
|
* @param {Object} data - Geotag data JSON
|
|
@@ -198,4 +220,6 @@ export default class HyperTrack {
|
|
|
198
220
|
private static deserializeName;
|
|
199
221
|
/** @ignore */
|
|
200
222
|
private static isLocation;
|
|
223
|
+
/** @ignore */
|
|
224
|
+
private static isOrderStatus;
|
|
201
225
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import type { OrderStatus } from '../OrderStatus';
|
|
1
2
|
import type { LocationInternal } from './LocationInternal';
|
|
3
|
+
import type { OrderHandle } from './OrderHandle';
|
|
2
4
|
export type GeotagData = {
|
|
5
|
+
orderHandle: OrderHandle;
|
|
6
|
+
orderStatus: OrderStatus;
|
|
3
7
|
data: Object;
|
|
4
8
|
expectedLocation?: LocationInternal;
|
|
5
9
|
};
|
|
@@ -7,3 +7,4 @@ export { LocationError, Errors } from './HyperTrack/data_types/LocationError';
|
|
|
7
7
|
export { LocationWithDeviation } from './HyperTrack/data_types/LocationWithDeviation';
|
|
8
8
|
export { Location } from './HyperTrack/data_types/Location';
|
|
9
9
|
export { Result, Success, Failure } from './HyperTrack/data_types/Result';
|
|
10
|
+
export { OrderStatus } from './HyperTrack/data_types/OrderStatus';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hypertrack-sdk-react-native",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.3.1",
|
|
4
4
|
"description": "React Native HyperTrack SDK is a wrapper around native iOS and Android SDKs that allows to integrate HyperTrack into React Native apps.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -20,6 +20,8 @@ import type { LocationInternal } from './data_types/internal/LocationInternal';
|
|
|
20
20
|
import type { LocationWithDeviationInternal } from './data_types/internal/LocationWithDeviationInternal';
|
|
21
21
|
import type { Metadata } from './data_types/internal/Metadata';
|
|
22
22
|
import type { DynamicPublishableKey } from './data_types/internal/DynamicPublishableKey';
|
|
23
|
+
import type { OrderStatus } from './data_types/OrderStatus';
|
|
24
|
+
import type { OrderHandle } from './data_types/internal/OrderHandle';
|
|
23
25
|
|
|
24
26
|
const EVENT_ERRORS = 'errors';
|
|
25
27
|
const EVENT_IS_AVAILABLE = 'isAvailable';
|
|
@@ -50,6 +52,37 @@ export default class HyperTrack {
|
|
|
50
52
|
private static locateSubscription: EmitterSubscription | undefined;
|
|
51
53
|
|
|
52
54
|
/**
|
|
55
|
+
* 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.
|
|
56
|
+
*
|
|
57
|
+
* @param {string} orderHandle - Order handle
|
|
58
|
+
* @param {OrderStatus} orderStatus - Order status
|
|
59
|
+
* @param {Object} data - Geotag data JSON
|
|
60
|
+
* @returns current location if success or LocationError if failure
|
|
61
|
+
*/
|
|
62
|
+
static async addGeotag(
|
|
63
|
+
orderHandle: string,
|
|
64
|
+
orderStatus: OrderStatus,
|
|
65
|
+
data: Object
|
|
66
|
+
): Promise<Result<Location, LocationError>>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 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.
|
|
70
|
+
*
|
|
71
|
+
* @param {string} orderHandle - Order handle
|
|
72
|
+
* @param {OrderStatus} orderStatus - Order status
|
|
73
|
+
* @param {Object} data - Geotag data JSON
|
|
74
|
+
* @param {Location} expectedLocation - Expected location
|
|
75
|
+
* @returns location with deviation if success or LocationError if failure
|
|
76
|
+
*/
|
|
77
|
+
static async addGeotag(
|
|
78
|
+
orderHandle: string,
|
|
79
|
+
orderStatus: OrderStatus,
|
|
80
|
+
data: Object,
|
|
81
|
+
expectedLocation: Location
|
|
82
|
+
): Promise<Result<LocationWithDeviation, LocationError>>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated
|
|
53
86
|
* Adds a new geotag
|
|
54
87
|
*
|
|
55
88
|
* @param {Object} data - Geotag data JSON
|
|
@@ -60,6 +93,7 @@ export default class HyperTrack {
|
|
|
60
93
|
): Promise<Result<Location, LocationError>>;
|
|
61
94
|
|
|
62
95
|
/**
|
|
96
|
+
* @deprecated
|
|
63
97
|
* Adds a new geotag with expected location
|
|
64
98
|
*
|
|
65
99
|
* @param {Object} data - Geotag data JSON
|
|
@@ -74,7 +108,64 @@ export default class HyperTrack {
|
|
|
74
108
|
static async addGeotag(
|
|
75
109
|
...args: any[]
|
|
76
110
|
): Promise<Result<Location | LocationWithDeviation, LocationError>> {
|
|
111
|
+
if (
|
|
112
|
+
args.length === 3 &&
|
|
113
|
+
typeof args[0] === 'string' &&
|
|
114
|
+
HyperTrack.isOrderStatus(args[1]) &&
|
|
115
|
+
typeof args[2] === 'object'
|
|
116
|
+
) {
|
|
117
|
+
// addGeotag(orderHandle: string, orderStatus: OrderStatus, data: Object)
|
|
118
|
+
return HyperTrackSdk.addGeotag({
|
|
119
|
+
orderHandle: {
|
|
120
|
+
type: 'orderHandle',
|
|
121
|
+
value: args[0],
|
|
122
|
+
} as OrderHandle,
|
|
123
|
+
orderStatus: args[1],
|
|
124
|
+
data: args[2],
|
|
125
|
+
expectedLocation: undefined,
|
|
126
|
+
} as GeotagData).then(
|
|
127
|
+
(locationResponse: Result<LocationInternal, LocationErrorInternal>) => {
|
|
128
|
+
return this.deserializeLocationResponse(locationResponse);
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
if (
|
|
133
|
+
args.length === 4 &&
|
|
134
|
+
typeof args[0] === 'string' &&
|
|
135
|
+
HyperTrack.isOrderStatus(args[1]) &&
|
|
136
|
+
typeof args[2] === 'object' &&
|
|
137
|
+
HyperTrack.isLocation(args[3])
|
|
138
|
+
) {
|
|
139
|
+
// addGeotag(orderHandle: string, orderStatus: OrderStatus, data: Object, expectedLocation: Location)
|
|
140
|
+
return HyperTrackSdk.addGeotag({
|
|
141
|
+
orderHandle: {
|
|
142
|
+
type: 'orderHandle',
|
|
143
|
+
value: args[0],
|
|
144
|
+
} as OrderHandle,
|
|
145
|
+
orderStatus: args[1],
|
|
146
|
+
data: args[2],
|
|
147
|
+
expectedLocation: {
|
|
148
|
+
type: 'location',
|
|
149
|
+
value: {
|
|
150
|
+
latitude: args[3].latitude,
|
|
151
|
+
longitude: args[3].longitude,
|
|
152
|
+
},
|
|
153
|
+
} as LocationInternal,
|
|
154
|
+
} as GeotagData).then(
|
|
155
|
+
(
|
|
156
|
+
locationResponse: Result<
|
|
157
|
+
LocationWithDeviationInternal,
|
|
158
|
+
LocationErrorInternal
|
|
159
|
+
>
|
|
160
|
+
) => {
|
|
161
|
+
return this.deserializeLocationWithDeviationResponse(
|
|
162
|
+
locationResponse
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
}
|
|
77
167
|
if (args.length === 1 && typeof args[0] === 'object') {
|
|
168
|
+
// addGeotag(data: Object)
|
|
78
169
|
return HyperTrackSdk.addGeotag({
|
|
79
170
|
data: args[0],
|
|
80
171
|
expectedLocation: undefined,
|
|
@@ -83,19 +174,20 @@ export default class HyperTrack {
|
|
|
83
174
|
return this.deserializeLocationResponse(locationResponse);
|
|
84
175
|
}
|
|
85
176
|
);
|
|
86
|
-
}
|
|
177
|
+
}
|
|
178
|
+
if (
|
|
87
179
|
args.length === 2 &&
|
|
88
180
|
typeof args[0] === 'object' &&
|
|
89
181
|
HyperTrack.isLocation(args[1])
|
|
90
182
|
) {
|
|
91
|
-
|
|
183
|
+
// addGeotag(data: Object, expectedLocation: Location)
|
|
92
184
|
return HyperTrackSdk.addGeotag({
|
|
93
185
|
data: args[0],
|
|
94
186
|
expectedLocation: {
|
|
95
187
|
type: 'location',
|
|
96
188
|
value: {
|
|
97
|
-
latitude:
|
|
98
|
-
longitude:
|
|
189
|
+
latitude: args[1].latitude,
|
|
190
|
+
longitude: args[1].longitude,
|
|
99
191
|
},
|
|
100
192
|
} as LocationInternal,
|
|
101
193
|
} as GeotagData).then(
|
|
@@ -110,9 +202,8 @@ export default class HyperTrack {
|
|
|
110
202
|
);
|
|
111
203
|
}
|
|
112
204
|
);
|
|
113
|
-
} else {
|
|
114
|
-
throw new Error('Invalid arguments');
|
|
115
205
|
}
|
|
206
|
+
throw new Error(`Invalid addGeotag() arguments: ${JSON.stringify(args)}`);
|
|
116
207
|
}
|
|
117
208
|
|
|
118
209
|
/**
|
|
@@ -535,4 +626,9 @@ export default class HyperTrack {
|
|
|
535
626
|
typeof obj.longitude === 'number'
|
|
536
627
|
);
|
|
537
628
|
}
|
|
629
|
+
|
|
630
|
+
/** @ignore */
|
|
631
|
+
private static isOrderStatus(obj: OrderStatus): obj is OrderStatus {
|
|
632
|
+
return 'type' in obj && obj.type.startsWith('orderStatus');
|
|
633
|
+
}
|
|
538
634
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import type { OrderStatus } from '../OrderStatus';
|
|
1
2
|
import type { LocationInternal } from './LocationInternal';
|
|
3
|
+
import type { OrderHandle } from './OrderHandle';
|
|
2
4
|
|
|
3
5
|
export type GeotagData = {
|
|
6
|
+
orderHandle: OrderHandle;
|
|
7
|
+
orderStatus: OrderStatus;
|
|
4
8
|
data: Object;
|
|
5
9
|
expectedLocation?: LocationInternal;
|
|
6
10
|
};
|
package/src/index.tsx
CHANGED
|
@@ -11,3 +11,4 @@ export { LocationError, Errors } from './HyperTrack/data_types/LocationError';
|
|
|
11
11
|
export { LocationWithDeviation } from './HyperTrack/data_types/LocationWithDeviation';
|
|
12
12
|
export { Location } from './HyperTrack/data_types/Location';
|
|
13
13
|
export { Result, Success, Failure } from './HyperTrack/data_types/Result';
|
|
14
|
+
export { OrderStatus } from './HyperTrack/data_types/OrderStatus';
|