hypertrack-sdk-react-native 13.2.2 → 13.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/common/GeotagData.kt +4 -1
- package/android/src/main/java/com/reactnativehypertracksdk/common/HyperTrackSdkWrapper.kt +29 -8
- package/android/src/main/java/com/reactnativehypertracksdk/common/Serialization.kt +84 -48
- 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 +46 -2
- package/lib/commonjs/HyperTrack/HyperTrack.js +61 -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/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/HyperTrack/HyperTrack.js +61 -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/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/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/HyperTrack/HyperTrack.ts +95 -6
- package/src/HyperTrack/data_types/OrderStatus.ts +11 -0
- package/src/index.tsx +1 -0
|
@@ -20,6 +20,7 @@ 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';
|
|
23
24
|
|
|
24
25
|
const EVENT_ERRORS = 'errors';
|
|
25
26
|
const EVENT_IS_AVAILABLE = 'isAvailable';
|
|
@@ -52,14 +53,46 @@ export default class HyperTrack {
|
|
|
52
53
|
/**
|
|
53
54
|
* Adds a new geotag
|
|
54
55
|
*
|
|
56
|
+
* @param {string} orderHandle - Order handle
|
|
57
|
+
* @param {OrderStatus} orderStatus - Order status
|
|
55
58
|
* @param {Object} data - Geotag data JSON
|
|
56
59
|
* @returns current location if success or LocationError if failure
|
|
57
60
|
*/
|
|
58
61
|
static async addGeotag(
|
|
62
|
+
orderHandle: string,
|
|
63
|
+
orderStatus: OrderStatus,
|
|
59
64
|
data: Object
|
|
60
65
|
): Promise<Result<Location, LocationError>>;
|
|
61
66
|
|
|
62
67
|
/**
|
|
68
|
+
* Adds a new geotag with expected location
|
|
69
|
+
*
|
|
70
|
+
* @param {string} orderHandle - Order handle
|
|
71
|
+
* @param {OrderStatus} orderStatus - Order status
|
|
72
|
+
* @param {Object} data - Geotag data JSON
|
|
73
|
+
* @param {Location} expectedLocation - Expected location
|
|
74
|
+
* @returns location with deviation if success or LocationError if failure
|
|
75
|
+
*/
|
|
76
|
+
static async addGeotag(
|
|
77
|
+
orderHandle: string,
|
|
78
|
+
orderStatus: OrderStatus,
|
|
79
|
+
data: Object,
|
|
80
|
+
expectedLocation: Location
|
|
81
|
+
): Promise<Result<LocationWithDeviation, LocationError>>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @deprecated
|
|
85
|
+
* Adds a new geotag
|
|
86
|
+
*
|
|
87
|
+
* @param {Object} data - Geotag data JSON
|
|
88
|
+
* @returns current location if success or LocationError if failure
|
|
89
|
+
*/
|
|
90
|
+
static async addGeotag(
|
|
91
|
+
data: Object
|
|
92
|
+
): Promise<Result<Location, LocationError>>;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @deprecated
|
|
63
96
|
* Adds a new geotag with expected location
|
|
64
97
|
*
|
|
65
98
|
* @param {Object} data - Geotag data JSON
|
|
@@ -74,7 +107,58 @@ export default class HyperTrack {
|
|
|
74
107
|
static async addGeotag(
|
|
75
108
|
...args: any[]
|
|
76
109
|
): Promise<Result<Location | LocationWithDeviation, LocationError>> {
|
|
110
|
+
if (
|
|
111
|
+
args.length === 3 &&
|
|
112
|
+
typeof args[0] === 'string' &&
|
|
113
|
+
HyperTrack.isOrderStatus(args[1]) &&
|
|
114
|
+
typeof args[2] === 'object'
|
|
115
|
+
) {
|
|
116
|
+
// addGeotag(orderHandle: string, orderStatus: OrderStatus, data: Object)
|
|
117
|
+
return HyperTrackSdk.addGeotag({
|
|
118
|
+
orderHandle: args[0],
|
|
119
|
+
orderStatus: args[1],
|
|
120
|
+
data: args[2],
|
|
121
|
+
expectedLocation: undefined,
|
|
122
|
+
} as GeotagData).then(
|
|
123
|
+
(locationResponse: Result<LocationInternal, LocationErrorInternal>) => {
|
|
124
|
+
return this.deserializeLocationResponse(locationResponse);
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
if (
|
|
129
|
+
args.length === 4 &&
|
|
130
|
+
typeof args[0] === 'string' &&
|
|
131
|
+
HyperTrack.isOrderStatus(args[1]) &&
|
|
132
|
+
typeof args[2] === 'object' &&
|
|
133
|
+
HyperTrack.isLocation(args[3])
|
|
134
|
+
) {
|
|
135
|
+
// addGeotag(orderHandle: string, orderStatus: OrderStatus, data: Object, expectedLocation: Location)
|
|
136
|
+
return HyperTrackSdk.addGeotag({
|
|
137
|
+
orderHandle: args[0],
|
|
138
|
+
orderStatus: args[1],
|
|
139
|
+
data: args[2],
|
|
140
|
+
expectedLocation: {
|
|
141
|
+
type: 'location',
|
|
142
|
+
value: {
|
|
143
|
+
latitude: args[3].latitude,
|
|
144
|
+
longitude: args[3].longitude,
|
|
145
|
+
},
|
|
146
|
+
} as LocationInternal,
|
|
147
|
+
} as GeotagData).then(
|
|
148
|
+
(
|
|
149
|
+
locationResponse: Result<
|
|
150
|
+
LocationWithDeviationInternal,
|
|
151
|
+
LocationErrorInternal
|
|
152
|
+
>
|
|
153
|
+
) => {
|
|
154
|
+
return this.deserializeLocationWithDeviationResponse(
|
|
155
|
+
locationResponse
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
77
160
|
if (args.length === 1 && typeof args[0] === 'object') {
|
|
161
|
+
// addGeotag(data: Object)
|
|
78
162
|
return HyperTrackSdk.addGeotag({
|
|
79
163
|
data: args[0],
|
|
80
164
|
expectedLocation: undefined,
|
|
@@ -83,19 +167,20 @@ export default class HyperTrack {
|
|
|
83
167
|
return this.deserializeLocationResponse(locationResponse);
|
|
84
168
|
}
|
|
85
169
|
);
|
|
86
|
-
}
|
|
170
|
+
}
|
|
171
|
+
if (
|
|
87
172
|
args.length === 2 &&
|
|
88
173
|
typeof args[0] === 'object' &&
|
|
89
174
|
HyperTrack.isLocation(args[1])
|
|
90
175
|
) {
|
|
91
|
-
|
|
176
|
+
// addGeotag(data: Object, expectedLocation: Location)
|
|
92
177
|
return HyperTrackSdk.addGeotag({
|
|
93
178
|
data: args[0],
|
|
94
179
|
expectedLocation: {
|
|
95
180
|
type: 'location',
|
|
96
181
|
value: {
|
|
97
|
-
latitude:
|
|
98
|
-
longitude:
|
|
182
|
+
latitude: args[1].latitude,
|
|
183
|
+
longitude: args[1].longitude,
|
|
99
184
|
},
|
|
100
185
|
} as LocationInternal,
|
|
101
186
|
} as GeotagData).then(
|
|
@@ -110,9 +195,8 @@ export default class HyperTrack {
|
|
|
110
195
|
);
|
|
111
196
|
}
|
|
112
197
|
);
|
|
113
|
-
} else {
|
|
114
|
-
throw new Error('Invalid arguments');
|
|
115
198
|
}
|
|
199
|
+
throw new Error(`Invalid addGeotag() arguments: ${JSON.stringify(args)}`);
|
|
116
200
|
}
|
|
117
201
|
|
|
118
202
|
/**
|
|
@@ -535,4 +619,9 @@ export default class HyperTrack {
|
|
|
535
619
|
typeof obj.longitude === 'number'
|
|
536
620
|
);
|
|
537
621
|
}
|
|
622
|
+
|
|
623
|
+
/** @ignore */
|
|
624
|
+
private static isOrderStatus(obj: OrderStatus): obj is OrderStatus {
|
|
625
|
+
return 'type' in obj && obj.type.startsWith('orderStatus');
|
|
626
|
+
}
|
|
538
627
|
}
|
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';
|