hypertrack-sdk-react-native 8.2.1 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/CONTRIBUTING.md +32 -110
  3. package/{LICENSE → LICENSE.md} +2 -0
  4. package/README.md +20 -40
  5. package/android/build.gradle +112 -113
  6. package/android/gradle.properties +1 -1
  7. package/android/src/main/java/com/reactnativehypertracksdk/HyperTrackReactNativePlugin.kt +209 -0
  8. package/android/src/main/java/com/reactnativehypertracksdk/HyperTrackSdkPackage.kt +2 -4
  9. package/android/src/main/java/com/reactnativehypertracksdk/ReactNativeSerialization.kt +88 -0
  10. package/android/src/main/java/com/reactnativehypertracksdk/common/Geotag.kt +9 -0
  11. package/android/src/main/java/com/reactnativehypertracksdk/common/HyperTrackError.kt +27 -0
  12. package/android/src/main/java/com/reactnativehypertracksdk/common/HyperTrackSdkWrapper.kt +243 -0
  13. package/android/src/main/java/com/reactnativehypertracksdk/common/LocationError.kt +9 -0
  14. package/android/src/main/java/com/reactnativehypertracksdk/common/Result.kt +48 -0
  15. package/android/src/main/java/com/reactnativehypertracksdk/common/SdkInitParams.kt +46 -0
  16. package/android/src/main/java/com/reactnativehypertracksdk/common/SdkMethod.kt +20 -0
  17. package/android/src/main/java/com/reactnativehypertracksdk/common/Serialization.kt +196 -0
  18. package/hypertrack-sdk-react-native.podspec +2 -2
  19. package/ios/HyperTrackReactNativePlugin.m +54 -0
  20. package/ios/HyperTrackReactNativePlugin.swift +253 -0
  21. package/ios/HyperTrackSdk-Bridging-Header.h +2 -0
  22. package/ios/HyperTrackSdk.xcodeproj/project.pbxproj +8 -11
  23. package/ios/common/DictionaryDecoder.swift +28 -0
  24. package/ios/common/HyperTrackError.swift +20 -0
  25. package/ios/common/HyperTrackSDKWrapper.swift +118 -0
  26. package/ios/common/SDKInitParams.swift +11 -0
  27. package/ios/common/SDKMethod.swift +14 -0
  28. package/ios/common/Serialization.swift +270 -0
  29. package/lib/commonjs/HyperTrack/HyperTrack.js +141 -142
  30. package/lib/commonjs/HyperTrack/HyperTrack.js.map +1 -1
  31. package/lib/commonjs/HyperTrack/data_types/HyperTrackError.js +31 -0
  32. package/lib/commonjs/HyperTrack/data_types/HyperTrackError.js.map +1 -0
  33. package/lib/commonjs/HyperTrack/data_types/Location.js +2 -0
  34. package/lib/commonjs/HyperTrack/data_types/Location.js.map +1 -0
  35. package/lib/commonjs/HyperTrack/data_types/LocationError.js +6 -0
  36. package/lib/commonjs/HyperTrack/data_types/LocationError.js.map +1 -0
  37. package/lib/commonjs/HyperTrack/data_types/SdkInitParams.js +2 -0
  38. package/lib/commonjs/HyperTrack/data_types/SdkInitParams.js.map +1 -0
  39. package/lib/commonjs/HyperTrack/data_types/internal/DeviceId.js +2 -0
  40. package/lib/commonjs/HyperTrack/data_types/internal/DeviceId.js.map +1 -0
  41. package/lib/commonjs/HyperTrack/data_types/internal/DeviceName.js +2 -0
  42. package/lib/commonjs/HyperTrack/data_types/internal/DeviceName.js.map +1 -0
  43. package/lib/commonjs/HyperTrack/data_types/internal/Geotag.js +2 -0
  44. package/lib/commonjs/HyperTrack/data_types/internal/Geotag.js.map +1 -0
  45. package/lib/commonjs/HyperTrack/data_types/internal/HyperTrackErrorInternal.js +2 -0
  46. package/lib/commonjs/HyperTrack/data_types/internal/HyperTrackErrorInternal.js.map +1 -0
  47. package/lib/commonjs/HyperTrack/data_types/internal/IsAvailable.js +2 -0
  48. package/lib/commonjs/HyperTrack/data_types/internal/IsAvailable.js.map +1 -0
  49. package/lib/commonjs/HyperTrack/data_types/internal/IsTracking.js +2 -0
  50. package/lib/commonjs/HyperTrack/data_types/internal/IsTracking.js.map +1 -0
  51. package/lib/commonjs/HyperTrack/data_types/internal/LocationErrorInternal.js +6 -0
  52. package/lib/commonjs/HyperTrack/data_types/internal/LocationErrorInternal.js.map +1 -0
  53. package/lib/commonjs/HyperTrack/data_types/internal/LocationResponse.js +6 -0
  54. package/lib/commonjs/HyperTrack/data_types/internal/LocationResponse.js.map +1 -0
  55. package/lib/commonjs/index.js +28 -17
  56. package/lib/commonjs/index.js.map +1 -1
  57. package/lib/module/HyperTrack/HyperTrack.js +140 -134
  58. package/lib/module/HyperTrack/HyperTrack.js.map +1 -1
  59. package/lib/module/HyperTrack/data_types/HyperTrackError.js +24 -0
  60. package/lib/module/HyperTrack/data_types/HyperTrackError.js.map +1 -0
  61. package/lib/module/HyperTrack/data_types/Location.js +2 -0
  62. package/lib/module/HyperTrack/data_types/Location.js.map +1 -0
  63. package/lib/module/HyperTrack/data_types/LocationError.js +2 -0
  64. package/lib/module/HyperTrack/data_types/LocationError.js.map +1 -0
  65. package/lib/module/HyperTrack/data_types/SdkInitParams.js +2 -0
  66. package/lib/module/HyperTrack/data_types/SdkInitParams.js.map +1 -0
  67. package/lib/module/HyperTrack/data_types/internal/DeviceId.js +2 -0
  68. package/lib/module/HyperTrack/data_types/internal/DeviceId.js.map +1 -0
  69. package/lib/module/HyperTrack/data_types/internal/DeviceName.js +2 -0
  70. package/lib/module/HyperTrack/data_types/internal/DeviceName.js.map +1 -0
  71. package/lib/module/HyperTrack/data_types/internal/Geotag.js +2 -0
  72. package/lib/module/HyperTrack/data_types/internal/Geotag.js.map +1 -0
  73. package/lib/module/HyperTrack/data_types/internal/HyperTrackErrorInternal.js +2 -0
  74. package/lib/module/HyperTrack/data_types/internal/HyperTrackErrorInternal.js.map +1 -0
  75. package/lib/module/HyperTrack/data_types/internal/IsAvailable.js +2 -0
  76. package/lib/module/HyperTrack/data_types/internal/IsAvailable.js.map +1 -0
  77. package/lib/module/HyperTrack/data_types/internal/IsTracking.js +2 -0
  78. package/lib/module/HyperTrack/data_types/internal/IsTracking.js.map +1 -0
  79. package/lib/module/HyperTrack/data_types/internal/LocationErrorInternal.js +2 -0
  80. package/lib/module/HyperTrack/data_types/internal/LocationErrorInternal.js.map +1 -0
  81. package/lib/module/HyperTrack/data_types/internal/LocationResponse.js +2 -0
  82. package/lib/module/HyperTrack/data_types/internal/LocationResponse.js.map +1 -0
  83. package/lib/module/index.js +4 -1
  84. package/lib/module/index.js.map +1 -1
  85. package/lib/typescript/HyperTrack/HyperTrack.d.ts +66 -100
  86. package/lib/typescript/HyperTrack/data_types/HyperTrackError.d.ts +20 -0
  87. package/lib/typescript/HyperTrack/data_types/Location.d.ts +7 -0
  88. package/lib/typescript/HyperTrack/data_types/LocationError.d.ts +8 -0
  89. package/lib/typescript/HyperTrack/data_types/SdkInitParams.d.ts +5 -0
  90. package/lib/typescript/HyperTrack/data_types/internal/DeviceId.d.ts +4 -0
  91. package/lib/typescript/HyperTrack/data_types/internal/DeviceName.d.ts +4 -0
  92. package/lib/typescript/HyperTrack/data_types/internal/Geotag.d.ts +3 -0
  93. package/lib/typescript/HyperTrack/data_types/internal/HyperTrackErrorInternal.d.ts +4 -0
  94. package/lib/typescript/HyperTrack/data_types/internal/IsAvailable.d.ts +4 -0
  95. package/lib/typescript/HyperTrack/data_types/internal/IsTracking.d.ts +4 -0
  96. package/lib/typescript/HyperTrack/data_types/internal/LocationErrorInternal.d.ts +12 -0
  97. package/lib/typescript/HyperTrack/data_types/internal/LocationResponse.d.ts +11 -0
  98. package/lib/typescript/index.d.ts +4 -1
  99. package/package.json +156 -156
  100. package/src/HyperTrack/HyperTrack.ts +163 -163
  101. package/src/HyperTrack/data_types/HyperTrackError.ts +22 -0
  102. package/src/HyperTrack/data_types/Location.ts +7 -0
  103. package/src/HyperTrack/data_types/LocationError.ts +11 -0
  104. package/src/HyperTrack/data_types/SdkInitParams.ts +5 -0
  105. package/src/HyperTrack/data_types/internal/DeviceId.ts +4 -0
  106. package/src/HyperTrack/data_types/internal/DeviceName.ts +4 -0
  107. package/src/HyperTrack/data_types/internal/Geotag.ts +3 -0
  108. package/src/HyperTrack/data_types/internal/HyperTrackErrorInternal.ts +4 -0
  109. package/src/HyperTrack/data_types/internal/IsAvailable.ts +4 -0
  110. package/src/HyperTrack/data_types/internal/IsTracking.ts +4 -0
  111. package/src/HyperTrack/data_types/internal/LocationErrorInternal.ts +14 -0
  112. package/src/HyperTrack/data_types/internal/LocationResponse.ts +14 -0
  113. package/src/index.tsx +4 -7
  114. package/android/src/main/java/com/reactnativehypertracksdk/HyperTrackModule.kt +0 -284
  115. package/ios/HyperTrack.h +0 -7
  116. package/ios/HyperTrack.m +0 -384
@@ -3,163 +3,152 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.SDKError = exports.LocationError = exports.GeotagError = void 0;
7
-
6
+ exports.default = void 0;
8
7
  var _reactNative = require("react-native");
9
-
8
+ var _HyperTrackError = require("./data_types/HyperTrackError");
9
+ const EVENT_TRACKING = 'onTrackingChanged';
10
+ const EVENT_AVAILABILITY = 'onAvailabilityChanged';
11
+ const EVENT_ERROR = 'onError';
10
12
  const LINKING_ERROR = `The package 'hypertrack-sdk-react-native' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
11
13
  ios: "- You have run 'pod install'\n",
12
14
  default: ''
13
15
  }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
14
- const HyperTrackSdk = _reactNative.NativeModules.HyperTrack ? _reactNative.NativeModules.HyperTrack : new Proxy({}, {
16
+ const HyperTrackSdk = _reactNative.NativeModules.HyperTrackReactNativePlugin ? _reactNative.NativeModules.HyperTrackReactNativePlugin : new Proxy({}, {
15
17
  get() {
16
18
  throw new Error(LINKING_ERROR);
17
19
  }
18
-
19
20
  });
20
21
  const EventEmitter = new _reactNative.NativeEventEmitter(HyperTrackSdk);
21
- let SDKError;
22
- /**
23
- * A base interface for errors in SDK.
24
- */
25
-
26
- exports.SDKError = SDKError;
27
-
28
- (function (SDKError) {
29
- SDKError[SDKError["GENERAL"] = 0] = "GENERAL";
30
- SDKError[SDKError["INVALID_PUBLISHABLE_KEY"] = 1] = "INVALID_PUBLISHABLE_KEY";
31
- SDKError[SDKError["AUTHORIZATION_FAILED"] = 2] = "AUTHORIZATION_FAILED";
32
- SDKError[SDKError["PERMISSION_DENIED"] = 3] = "PERMISSION_DENIED";
33
- })(SDKError || (exports.SDKError = SDKError = {}));
34
-
35
- /**
36
- * Interface for accessing adding geotag result.
37
- */
38
- let GeotagError;
39
- exports.GeotagError = GeotagError;
40
-
41
- (function (GeotagError) {
42
- GeotagError[GeotagError["PLATFORM_NOT_SUPPORTED"] = 0] = "PLATFORM_NOT_SUPPORTED";
43
- GeotagError[GeotagError["LOCATION_MISMATCH"] = 1] = "LOCATION_MISMATCH";
44
- GeotagError[GeotagError["LOCATION_NOT_AVAILABLE"] = 2] = "LOCATION_NOT_AVAILABLE";
45
- GeotagError[GeotagError["INVALID_ARGUMENTS"] = 3] = "INVALID_ARGUMENTS";
46
- })(GeotagError || (exports.GeotagError = GeotagError = {}));
47
-
48
- let LocationError;
49
- exports.LocationError = LocationError;
50
-
51
- (function (LocationError) {
52
- LocationError["LOCATION_PERMISSIONS_NOT_DETERMINED"] = "location_permissions_not_determined";
53
- LocationError["LOCATION_PERMISSIONS_CANT_BE_ASKED_IN_BACKGROUND"] = "location_permissions_cant_be_asked_in_background";
54
- LocationError["LOCATION_PERMISSIONS_INSUFFICIENT_FOR_BACKGROUND"] = "location_permissions_insufficient_for_background";
55
- LocationError["LOCATION_PERMISSIONS_RESTRICTED"] = "location_permissions_restricted";
56
- LocationError["LOCATION_PERMISSIONS_REDUCED_ACCURACY"] = "location_permissions_reduced_accuracy";
57
- LocationError["LOCATION_PERMISSIONS_DENIED"] = "location_permissions_denied";
58
- LocationError["LOCATION_SERVICES_DISABLED"] = "location_services_disabled";
59
- LocationError["MOTION_ACTIVITY_PERMISSIONS_NOT_DETERMINED"] = "motion_activity_permissions_not_determined";
60
- LocationError["MOTION_ACTIVITY_PERMISSIONS_CANT_BE_ASKED_IN_BACKGROUND"] = "motion_activity_permissions_cant_be_asked_in_background";
61
- LocationError["MOTION_ACTIVITY_PERMISSIONS_DENIED"] = "motion_activity_permissions_denied";
62
- LocationError["MOTION_ACTIVITY_SERVICES_DISABLED"] = "motion_activity_services_disabled";
63
- LocationError["NOT_RUNNING"] = "not_running";
64
- LocationError["GPS_SIGNAL_LOST"] = "gps_signal_lost";
65
- LocationError["STARTING"] = "starting";
66
- LocationError["LOCATION_MOCKED"] = "location_mocked";
67
- })(LocationError || (exports.LocationError = LocationError = {}));
68
-
69
22
  class HyperTrack {
70
23
  constructor() {
71
24
  return this;
72
25
  }
73
26
 
74
- static async createInstance(publishableKey) {
75
- let automaticallyRequestPermissions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
76
-
27
+ /**
28
+ * Creates an SDK instance
29
+ *
30
+ * @param publishableKey publishable key provided in HyperTrack’s dashboard setup page
31
+ * @param sdkInitParams
32
+ * @returns HyperTrack instance
33
+ */
34
+ static async initialize(publishableKey) {
35
+ let sdkInitParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
77
36
  try {
78
- await HyperTrackSdk.initialize(publishableKey, false, automaticallyRequestPermissions);
37
+ await HyperTrackSdk.initializeSdk({
38
+ publishableKey,
39
+ loggingEnabled: sdkInitParams.loggingEnabled ?? false,
40
+ allowMockLocations: sdkInitParams.allowMockLocations ?? false,
41
+ requireBackgroundTrackingPermission: sdkInitParams.requireBackgroundTrackingPermission ?? false
42
+ });
79
43
  return new HyperTrack();
80
44
  } catch (error) {
81
45
  throw new Error(error.message);
82
46
  }
83
47
  }
84
- /**
85
- * Enables debug log output. This is very verbose, so you shouldn't use this for
86
- * production build.
87
- */
88
48
 
89
-
90
- static enableDebugLogging(enable) {
91
- HyperTrackSdk.enableDebugLogging(enable);
92
- }
93
49
  /**
94
- * Returns a string which is used by HyperTrack to uniquely identify the user.
50
+ * Returns a string that is used to uniquely identify the device
95
51
  */
96
-
97
-
98
- async getDeviceID() {
99
- return HyperTrackSdk.getDeviceID();
52
+ getDeviceId() {
53
+ return HyperTrackSdk.getDeviceId().then(deviceId => deviceId.value);
100
54
  }
55
+
101
56
  /**
102
- * Device's availability for nearby search
57
+ * Reflects availability of the device for the Nearby search
103
58
  *
104
59
  * @returns true when is available or false when unavailable
105
60
  */
106
-
107
-
108
61
  isAvailable() {
109
- return HyperTrackSdk.isAvailable();
62
+ return HyperTrackSdk.isAvailable().then(isAvailable => isAvailable.value);
110
63
  }
64
+
111
65
  /**
112
- * Allows you to set device availability for nearby search
66
+ * Sets the availability of the device for the Nearby search
113
67
  *
114
68
  * @param availability true when is available or false when unavailable
115
69
  */
116
-
117
-
118
- async setAvailability(availability) {
119
- return HyperTrackSdk.setAvailability(availability);
70
+ setAvailability(isAvailable) {
71
+ HyperTrackSdk.setAvailability({
72
+ type: 'isAvailable',
73
+ value: isAvailable
74
+ });
120
75
  }
76
+
121
77
  /**
122
- * Determine whether the SDK is tracking the movement of the user.
78
+ * Reflects the tracking intent for the device
79
+ *
123
80
  * @return {boolean} Whether the user's movement data is getting tracked or not.
124
81
  */
125
-
126
-
127
82
  isTracking() {
128
- return HyperTrackSdk.isTracking();
83
+ return HyperTrackSdk.isTracking().then(isTracking => isTracking.value);
129
84
  }
85
+
130
86
  /**
131
- * Update device state from server.
87
+ * Syncs the device state with the HyperTrack servers
132
88
  */
133
-
134
-
135
- syncDeviceSettings() {
136
- HyperTrackSdk.syncDeviceSettings();
89
+ sync() {
90
+ HyperTrackSdk.sync();
137
91
  }
92
+
138
93
  /**
139
- * Start or resume tracking location and activity events.
94
+ * Expresses an intent to start location tracking for the device
140
95
  */
141
-
142
-
143
96
  startTracking() {
144
97
  HyperTrackSdk.startTracking();
145
98
  }
99
+
146
100
  /**
147
- * Stops the SDK from listening to the user's movement updates and recording any data.
101
+ * Stops location tracking immediately
148
102
  */
149
-
150
-
151
103
  stopTracking() {
152
104
  HyperTrackSdk.stopTracking();
153
- } /// The current location of the user or an outage reason.
154
-
105
+ }
155
106
 
107
+ /**
108
+ * Reflects the current location of the user or an outage reason
109
+ */
156
110
  getLocation() {
157
- return HyperTrackSdk.getLocation();
111
+ return HyperTrackSdk.getLocation().then(locationResponse => {
112
+ return this.deserializeLocationResponse(locationResponse);
113
+ });
114
+ }
115
+
116
+ /**
117
+ * Sets the name for the device
118
+ * @param {string} name
119
+ */
120
+ setName(name) {
121
+ HyperTrackSdk.setName({
122
+ type: 'deviceName',
123
+ value: name
124
+ });
158
125
  }
126
+
159
127
  /**
160
- * Listen for errors.
128
+ * Sets the metadata for the device
129
+ * @param {Object} data - Metadata JSON
130
+ */
131
+ setMetadata(data) {
132
+ HyperTrackSdk.setMetadata(data);
133
+ }
134
+
135
+ /**
136
+ * Adds a new geotag
137
+ * @param {Object} data - Geotad data JSON
138
+ * @returns current location if success or LocationError if failure
139
+ */
140
+ addGeotag(data) {
141
+ return HyperTrackSdk.addGeotag({
142
+ data
143
+ }).then(locationResponse => {
144
+ return this.deserializeLocationResponse(locationResponse);
145
+ });
146
+ }
147
+
148
+ /**
149
+ * Subscribe to tracking errors
161
150
  *
162
- * @param listener (errors: {code, message}) => void
151
+ * @param listener
163
152
  * @returns EmitterSubscription
164
153
  * @example
165
154
  * ```js
@@ -173,15 +162,16 @@ class HyperTrack {
173
162
  * subscription.remove()
174
163
  * ```
175
164
  */
176
-
177
-
178
165
  subscribeToErrors(listener) {
179
- return EventEmitter.addListener('onTrackingErrorHyperTrack', listener);
166
+ return EventEmitter.addListener(EVENT_ERROR, rawErrors => {
167
+ listener(this.deserializeHyperTrackErrors(rawErrors));
168
+ });
180
169
  }
170
+
181
171
  /**
182
- * Listen for tracking changes.
172
+ * Subscribe to tracking intent changes
183
173
  *
184
- * @param listener (isTracking: boolean) => void
174
+ * @param listener
185
175
  * @returns EmitterSubscription
186
176
  * @example
187
177
  * ```js
@@ -195,50 +185,59 @@ class HyperTrack {
195
185
  * subscription.remove()
196
186
  * ```
197
187
  */
198
-
199
-
200
188
  subscribeToTracking(listener) {
201
- return EventEmitter.addListener('onTrackingStateChanged', listener);
202
- }
203
- /**
204
- * Send device name to HyperTrack
205
- * @param {string} name - Device name you want to see in the Dashboard.
206
- */
207
-
208
-
209
- setDeviceName(name) {
210
- HyperTrackSdk.setDeviceName(name);
211
- }
212
- /**
213
- * Send metadata details to HyperTrack
214
- * @param {Object} data - Send extra device information.
215
- */
216
-
217
-
218
- setMetadata(data) {
219
- HyperTrackSdk.setMetadata(data);
189
+ return EventEmitter.addListener(EVENT_TRACKING, isTracking => {
190
+ listener(isTracking.value);
191
+ });
220
192
  }
221
- /**
222
- * @deprecated
223
- * Set a trip marker
224
- * @param {Object} _data - Include anything that can be parsed into JSON.
225
- */
226
193
 
227
-
228
- setTripMarker(_data) {
229
- throw new Error('Deprecated');
230
- }
231
194
  /**
232
- * Add geotag
233
- * @param {Object} data - Include anything that can be parsed into JSON.
195
+ * Subscribe to availability changes
196
+ *
197
+ * @param listener
198
+ * @returns EmitterSubscription
199
+ * @example
200
+ * ```js
201
+ * const subscription = HyperTrack.subscribeToAvailability(isAvailable => {
202
+ * if (isAvailable) {
203
+ * // ... ready to go
204
+ * }
205
+ * })
206
+ *
207
+ * // later, to stop listening
208
+ * subscription.remove()
209
+ * ```
234
210
  */
235
-
236
-
237
- addGeotag(data) {
238
- return HyperTrackSdk.addGeotag(data);
211
+ subscribeToAvailability(listener) {
212
+ return EventEmitter.addListener(EVENT_AVAILABILITY, isAvailable => {
213
+ listener(isAvailable.value);
214
+ });
215
+ }
216
+
217
+ /** @ignore */
218
+ deserializeHyperTrackErrors(errors) {
219
+ return errors.map(error => _HyperTrackError.HyperTrackError[error.value]);
220
+ }
221
+
222
+ /** @ignore */
223
+ deserializeLocationResponse(response) {
224
+ switch (response.type) {
225
+ case "success":
226
+ return response.value;
227
+ case "failure":
228
+ switch (response.value.type) {
229
+ case "notRunning":
230
+ case "starting":
231
+ return response.value;
232
+ case "errors":
233
+ return {
234
+ type: "errors",
235
+ value: this.deserializeHyperTrackErrors(response.value.value)
236
+ };
237
+ }
238
+ }
239
+ ;
239
240
  }
240
-
241
241
  }
242
-
243
242
  exports.default = HyperTrack;
244
243
  //# sourceMappingURL=HyperTrack.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","HyperTrackSdk","NativeModules","HyperTrack","Proxy","get","Error","EventEmitter","NativeEventEmitter","SDKError","GeotagError","LocationError","constructor","createInstance","publishableKey","automaticallyRequestPermissions","initialize","error","message","enableDebugLogging","enable","getDeviceID","isAvailable","setAvailability","availability","isTracking","syncDeviceSettings","startTracking","stopTracking","getLocation","subscribeToErrors","listener","addListener","subscribeToTracking","setDeviceName","name","setMetadata","data","setTripMarker","_data","addGeotag"],"sources":["HyperTrack.ts"],"sourcesContent":["import { NativeModules, Platform, NativeEventEmitter } from 'react-native';\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.HyperTrack\n ? NativeModules.HyperTrack\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nconst EventEmitter = new NativeEventEmitter(HyperTrackSdk);\n\nexport enum SDKError {\n /**\n * An error that we couldn't recognize.\n */\n GENERAL = 0,\n /**\n * Publishable key is invalid. Check your key on hypertrack dashboard setup.\n */\n INVALID_PUBLISHABLE_KEY = 1,\n /**\n * Your free trial ended or account was not renewed. Check your account on hypertrack dashboard.\n */\n AUTHORIZATION_FAILED = 2,\n /**\n * Tracking won't start due to denied (or absent) permission.\n */\n PERMISSION_DENIED = 3,\n}\n\n/**\n * A base interface for errors in SDK.\n */\nexport type Error = {\n code: SDKError;\n message?: string;\n};\n\n/**\n * Interface for accessing adding geotag result.\n */\nexport enum GeotagError {\n /** Expected location is not supported on this platform */\n PLATFORM_NOT_SUPPORTED = 0,\n /** Expected vs actual location difference is greater then required */\n LOCATION_MISMATCH = 1,\n /** SDK can't get actual location from OS sensors */\n LOCATION_NOT_AVAILABLE = 2,\n /** Invalid arguments */\n INVALID_ARGUMENTS = 3,\n}\n\nexport interface Location {\n location: {\n latitude: number;\n longitude: number;\n };\n}\n\nexport enum LocationError {\n // The user has not chosen whether the app can use location services.\n // SDK automatically asked for permissions.\n LOCATION_PERMISSIONS_NOT_DETERMINED = 'location_permissions_not_determined',\n // The user has not chosen whether the app can use location services.\n // SDK can't ask for permissions in background.\n LOCATION_PERMISSIONS_CANT_BE_ASKED_IN_BACKGROUND = 'location_permissions_cant_be_asked_in_background',\n // Can't start tracking in background with When In Use location\n // permissions. SDK will automatically start tracking when app will return\n // to foreground.\n LOCATION_PERMISSIONS_INSUFFICIENT_FOR_BACKGROUND = 'location_permissions_insufficient_for_background',\n // The app is not authorized to use location services.\n LOCATION_PERMISSIONS_RESTRICTED = 'location_permissions_restricted',\n // The user didn't grant precise location permissions or downgraded permissions to imprecise.\n LOCATION_PERMISSIONS_REDUCED_ACCURACY = 'location_permissions_reduced_accuracy',\n // The user denied location permissions.\n LOCATION_PERMISSIONS_DENIED = 'location_permissions_denied',\n // The user disabled location services systemwide.\n LOCATION_SERVICES_DISABLED = 'location_services_disabled',\n // The user has not chosen whether the app can use motion activity\n // services. SDK automatically asked for permissions.\n MOTION_ACTIVITY_PERMISSIONS_NOT_DETERMINED = 'motion_activity_permissions_not_determined',\n // The user has not chosen whether the app can use motion activity\n // services. SDK can't ask for permissions in background.\n MOTION_ACTIVITY_PERMISSIONS_CANT_BE_ASKED_IN_BACKGROUND = 'motion_activity_permissions_cant_be_asked_in_background',\n // Motion activity permissions denied after SDK's initialization. Granting\n // them will restart the app, so in effect, they are denied during this app's\n // session.\n MOTION_ACTIVITY_PERMISSIONS_DENIED = 'motion_activity_permissions_denied',\n // The user disabled motion services systemwide.\n MOTION_ACTIVITY_SERVICES_DISABLED = 'motion_activity_services_disabled',\n // The SDK is not collecting locations because it's either not tracking or is unavailable.\n NOT_RUNNING = 'not_running',\n // GPS satellites are not in view.\n GPS_SIGNAL_LOST = 'gps_signal_lost',\n // The SDK started collecting locations and is waiting for OS location services to respond.\n STARTING = 'starting',\n // The user enabled mock location app while mocking locations is prohibited.\n LOCATION_MOCKED = 'location_mocked',\n}\n\nexport default class HyperTrack {\n constructor() {\n return this;\n }\n\n static async createInstance(\n publishableKey: string,\n automaticallyRequestPermissions = true\n ) {\n try {\n await HyperTrackSdk.initialize(\n publishableKey,\n false,\n automaticallyRequestPermissions\n );\n return new HyperTrack();\n } catch (error: any) {\n throw new Error(error.message);\n }\n }\n\n /**\n * Enables debug log output. This is very verbose, so you shouldn't use this for\n * production build.\n */\n static enableDebugLogging(enable: boolean) {\n HyperTrackSdk.enableDebugLogging(enable);\n }\n\n /**\n * Returns a string which is used by HyperTrack to uniquely identify the user.\n */\n async getDeviceID(): Promise<string> {\n return HyperTrackSdk.getDeviceID();\n }\n\n /**\n * Device's availability for nearby search\n *\n * @returns true when is available or false when unavailable\n */\n isAvailable(): Promise<boolean> {\n return HyperTrackSdk.isAvailable();\n }\n\n /**\n * Allows you to set device availability for nearby search\n *\n * @param availability true when is available or false when unavailable\n */\n async setAvailability(availability: Boolean): Promise<void> {\n return HyperTrackSdk.setAvailability(availability);\n }\n\n /**\n * Determine whether the SDK is tracking the movement of the user.\n * @return {boolean} Whether the user's movement data is getting tracked or not.\n */\n isTracking(): Promise<boolean> {\n return HyperTrackSdk.isTracking();\n }\n\n /**\n * Update device state from server.\n */\n syncDeviceSettings() {\n HyperTrackSdk.syncDeviceSettings();\n }\n\n /**\n * Start or resume tracking location and activity events.\n */\n startTracking() {\n HyperTrackSdk.startTracking();\n }\n\n /**\n * Stops the SDK from listening to the user's movement updates and recording any data.\n */\n stopTracking() {\n HyperTrackSdk.stopTracking();\n }\n\n /// The current location of the user or an outage reason.\n getLocation(): Promise<LocationError | Location> {\n return HyperTrackSdk.getLocation();\n }\n\n /**\n * Listen for errors.\n *\n * @param listener (errors: {code, message}) => void\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 subscribeToErrors(listener: (errors: Error) => void) {\n return EventEmitter.addListener('onTrackingErrorHyperTrack', listener);\n }\n\n /**\n * Listen for tracking changes.\n *\n * @param listener (isTracking: boolean) => void\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToTracking(isTracking => {\n * if (isTracking) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n subscribeToTracking(listener: (isTracking: boolean) => void) {\n return EventEmitter.addListener('onTrackingStateChanged', listener);\n }\n\n /**\n * Send device name to HyperTrack\n * @param {string} name - Device name you want to see in the Dashboard.\n */\n setDeviceName(name: string) {\n HyperTrackSdk.setDeviceName(name);\n }\n\n /**\n * Send metadata details to HyperTrack\n * @param {Object} data - Send extra device information.\n */\n setMetadata(data: Object) {\n HyperTrackSdk.setMetadata(data);\n }\n\n /**\n * @deprecated\n * Set a trip marker\n * @param {Object} _data - Include anything that can be parsed into JSON.\n */\n setTripMarker(_data: Object) {\n throw new Error('Deprecated');\n }\n\n /**\n * Add geotag\n * @param {Object} data - Include anything that can be parsed into JSON.\n */\n addGeotag(data: Object): Promise<LocationError | Location> {\n return HyperTrackSdk.addGeotag(data);\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAEA,MAAMA,aAAa,GAChB,sFAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,aAAa,GAAGC,0BAAA,CAAcC,UAAd,GAClBD,0BAAA,CAAcC,UADI,GAElB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUV,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ;AAWA,MAAMW,YAAY,GAA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AACC,YAAD,EAAuC;IAC1D,OAAOvB,aAAa,CAACsB,eAAd,CAA8BC,YAA9B,CAAP;EACD;EAED;AACF;AACA;AACA;;;EACEC,UAAU,GAAqB;IAC7B,OAAOxB,aAAa,CAACwB,UAAd,EAAP;EACD;EAED;AACF;AACA;;;EACEC,kBAAkB,GAAG;IACnBzB,aAAa,CAACyB,kBAAd;EACD;EAED;AACF;AACA;;;EACEC,aAAa,GAAG;IACd1B,aAAa,CAAC0B,aAAd;EACD;EAED;AACF;AACA;;;EACEC,YAAY,GAAG;IACb3B,aAAa,CAAC2B,YAAd;EACD,CAjF6B,CAmF9B;;;EACAC,WAAW,GAAsC;IAC/C,OAAO5B,aAAa,CAAC4B,WAAd,EAAP;EACD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;EACEC,iBAAiB,CAACC,QAAD,EAAoC;IACnD,OAAOxB,YAAY,CAACyB,WAAb,CAAyB,2BAAzB,EAAsDD,QAAtD,CAAP;EACD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;EACEE,mBAAmB,CAACF,QAAD,EAA0C;IAC3D,OAAOxB,YAAY,CAACyB,WAAb,CAAyB,wBAAzB,EAAmDD,QAAnD,CAAP;EACD;EAED;AACF;AACA;AACA;;;EACEG,aAAa,CAACC,IAAD,EAAe;IAC1BlC,aAAa,CAACiC,aAAd,CAA4BC,IAA5B;EACD;EAED;AACF;AACA;AACA;;;EACEC,WAAW,CAACC,IAAD,EAAe;IACxBpC,aAAa,CAACmC,WAAd,CAA0BC,IAA1B;EACD;EAED;AACF;AACA;AACA;AACA;;;EACEC,aAAa,CAACC,KAAD,EAAgB;IAC3B,MAAM,IAAIjC,KAAJ,CAAU,YAAV,CAAN;EACD;EAED;AACF;AACA;AACA;;;EACEkC,SAAS,CAACH,IAAD,EAAkD;IACzD,OAAOpC,aAAa,CAACuC,SAAd,CAAwBH,IAAxB,CAAP;EACD;;AAjK6B"}
1
+ {"version":3,"names":["EVENT_TRACKING","EVENT_AVAILABILITY","EVENT_ERROR","LINKING_ERROR","Platform","select","ios","default","HyperTrackSdk","NativeModules","HyperTrackReactNativePlugin","Proxy","get","Error","EventEmitter","NativeEventEmitter","HyperTrack","constructor","initialize","publishableKey","sdkInitParams","initializeSdk","loggingEnabled","allowMockLocations","requireBackgroundTrackingPermission","error","message","getDeviceId","then","deviceId","value","isAvailable","setAvailability","type","isTracking","sync","startTracking","stopTracking","getLocation","locationResponse","deserializeLocationResponse","setName","name","setMetadata","data","addGeotag","subscribeToErrors","listener","addListener","rawErrors","deserializeHyperTrackErrors","subscribeToTracking","subscribeToAvailability","errors","map","HyperTrackError","response"],"sources":["HyperTrack.ts"],"sourcesContent":["import { NativeModules, Platform, NativeEventEmitter } 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 { LocationResponse } from './data_types/internal/LocationResponse';\nimport type { Location } from './data_types/Location';\nimport type { LocationError } from './data_types/LocationError';\nimport type { SdkInitParams } from './data_types/SdkInitParams';\nimport type { DeviceId } from './data_types/internal/DeviceId';\nimport type { Geotag } from './data_types/internal/Geotag';\nimport type { DeviceName } from './data_types/internal/DeviceName';\nimport type { HyperTrackErrorInternal } from './data_types/internal/HyperTrackErrorInternal';\n\nconst EVENT_TRACKING = 'onTrackingChanged';\nconst EVENT_AVAILABILITY = 'onAvailabilityChanged';\nconst EVENT_ERROR = 'onError';\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 constructor() {\n return this;\n }\n\n /**\n * Creates an SDK instance\n * \n * @param publishableKey publishable key provided in HyperTrack’s dashboard setup page\n * @param sdkInitParams\n * @returns HyperTrack instance\n */\n static async initialize(\n publishableKey: string,\n sdkInitParams: SdkInitParams = {}\n ): Promise<HyperTrack> {\n try {\n await HyperTrackSdk.initializeSdk({\n publishableKey,\n loggingEnabled: sdkInitParams.loggingEnabled ?? false,\n allowMockLocations: sdkInitParams.allowMockLocations ?? false,\n requireBackgroundTrackingPermission: sdkInitParams.requireBackgroundTrackingPermission ?? false,\n });\n return new HyperTrack();\n } catch (error: any) {\n throw new Error(error.message);\n }\n }\n\n /**\n * Returns a string that is used to uniquely identify the device\n */\n getDeviceId(): Promise<string> {\n return HyperTrackSdk.getDeviceId().then(\n (deviceId: DeviceId) => deviceId.value\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 isAvailable(): Promise<boolean> {\n return HyperTrackSdk.isAvailable().then(\n (isAvailable: IsAvailable) => isAvailable.value\n );\n }\n\n /**\n * Sets the availability of the device for the Nearby search\n *\n * @param availability true when is available or false when unavailable\n */\n setAvailability(isAvailable: boolean) {\n HyperTrackSdk.setAvailability({\n type: 'isAvailable',\n value: isAvailable\n } as IsAvailable);\n }\n\n /**\n * Reflects the tracking intent for the device\n * \n * @return {boolean} Whether the user's movement data is getting tracked or not.\n */\n isTracking(): Promise<boolean> {\n return HyperTrackSdk.isTracking().then(\n (isTracking: IsTracking) => isTracking.value\n );\n }\n\n /**\n * Syncs the device state with the HyperTrack servers\n */\n sync() {\n HyperTrackSdk.sync();\n }\n\n /**\n * Expresses an intent to start location tracking for the device\n */\n startTracking() {\n HyperTrackSdk.startTracking();\n }\n\n /**\n * Stops location tracking immediately\n */\n stopTracking() {\n HyperTrackSdk.stopTracking();\n }\n\n /**\n * Reflects the current location of the user or an outage reason\n */\n getLocation(): Promise<LocationError | Location> {\n return HyperTrackSdk.getLocation().then(\n (locationResponse: LocationResponse) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n }\n\n /**\n * Sets the name for the device\n * @param {string} name\n */\n setName(name: string) {\n HyperTrackSdk.setName({\n type: 'deviceName',\n value: name\n } as DeviceName)\n }\n\n /**\n * Sets the metadata for the device\n * @param {Object} data - Metadata JSON\n */\n setMetadata(data: Object) {\n HyperTrackSdk.setMetadata(data);\n }\n\n /**\n * Adds a new geotag\n * @param {Object} data - Geotad data JSON\n * @returns current location if success or LocationError if failure\n */\n addGeotag(data: Object): Promise<LocationError | Location> {\n return HyperTrackSdk.addGeotag({\n data\n } as Geotag).then(\n (locationResponse: LocationResponse) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\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 subscribeToErrors(listener: (errors: HyperTrackError[]) => void) {\n return EventEmitter.addListener(EVENT_ERROR, (rawErrors: HyperTrackErrorInternal[]) => {\n listener(this.deserializeHyperTrackErrors(rawErrors))\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.subscribeToTracking(isTracking => {\n * if (isTracking) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n subscribeToTracking(listener: (isTracking: boolean) => void) {\n return EventEmitter.addListener(\n EVENT_TRACKING,\n (isTracking: IsTracking) => {\n listener(isTracking.value);\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.subscribeToAvailability(isAvailable => {\n * if (isAvailable) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n subscribeToAvailability(listener: (isAvailable: boolean) => void) {\n return EventEmitter.addListener(\n EVENT_AVAILABILITY,\n (isAvailable: IsAvailable) => {\n listener(isAvailable.value);\n }\n );\n }\n\n /** @ignore */\n private deserializeHyperTrackErrors(errors: HyperTrackErrorInternal[]): HyperTrackError[] {\n return errors.map((error: HyperTrackErrorInternal) => HyperTrackError[error.value as keyof typeof HyperTrackError])\n }\n\n /** @ignore */\n private deserializeLocationResponse(response: LocationResponse): Location | LocationError {\n switch(response.type) {\n case \"success\":\n return response.value\n case \"failure\":\n switch(response.value.type) {\n case \"notRunning\":\n case \"starting\":\n return response.value\n case \"errors\":\n return {\n type: \"errors\",\n value: this.deserializeHyperTrackErrors(response.value.value)\n }\n }\n };\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AAYA,MAAMA,cAAc,GAAG,mBAAmB;AAC1C,MAAMC,kBAAkB,GAAG,uBAAuB;AAClD,MAAMC,WAAW,GAAG,SAAS;AAE7B,MAAMC,aAAa,GAChB,sFAAqF,GACtFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAE/C,MAAMC,aAAa,GAAGC,0BAAa,CAACC,2BAA2B,GAC3DD,0BAAa,CAACC,2BAA2B,GACzC,IAAIC,KAAK,CACT,CAAC,CAAC,EACF;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAEH,MAAMW,YAAY,GAAG,IAAIC,+BAAkB,CAACP,aAAa,CAAC;AAE3C,MAAMQ,UAAU,CAAC;EACtBC,WAAW,GAAG;IACpB,OAAO,IAAI;EACb;;EAEA;AACF;AACA;AACA;AACA;AACA;AAC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,KAAK,CAAC;IAC5B,CAAC,CACF;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEsB,uBAAuB,CAACL,QAAwC,EAAE;IAChE,OAAOjC,YAAY,CAACkC,WAAW,CAC7B/C,kBAAkB,EACjB8B,WAAwB,IAAK;MAC5BgB,QAAQ,CAAChB,WAAW,CAACD,KAAK,CAAC;IAC7B,CAAC,CACF;EACH;;EAEA;EACQoB,2BAA2B,CAACG,MAAiC,EAAqB;IACxF,OAAOA,MAAM,CAACC,GAAG,CAAE7B,KAA8B,IAAK8B,gCAAe,CAAC9B,KAAK,CAACK,KAAK,CAAiC,CAAC;EACrH;;EAEA;EACQU,2BAA2B,CAACgB,QAA0B,EAA4B;IACxF,QAAOA,QAAQ,CAACvB,IAAI;MAClB,KAAK,SAAS;QACZ,OAAOuB,QAAQ,CAAC1B,KAAK;MACvB,KAAK,SAAS;QACZ,QAAO0B,QAAQ,CAAC1B,KAAK,CAACG,IAAI;UACxB,KAAK,YAAY;UACjB,KAAK,UAAU;YACb,OAAOuB,QAAQ,CAAC1B,KAAK;UACvB,KAAK,QAAQ;YACX,OAAO;cACLG,IAAI,EAAE,QAAQ;cACdH,KAAK,EAAE,IAAI,CAACoB,2BAA2B,CAACM,QAAQ,CAAC1B,KAAK,CAACA,KAAK;YAC9D,CAAC;QAAA;IACJ;IACJ;EACH;AACF;AAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.HyperTrackError = void 0;
7
+ // enum naming convention is ignored to make datatype sync
8
+ // across platforms easier
9
+ let HyperTrackError;
10
+ exports.HyperTrackError = HyperTrackError;
11
+ (function (HyperTrackError) {
12
+ HyperTrackError["gpsSignalLost"] = "gpsSignalLost";
13
+ HyperTrackError["locationMocked"] = "locationMocked";
14
+ HyperTrackError["locationPermissionsDenied"] = "locationPermissionsDenied";
15
+ HyperTrackError["locationPermissionsInsufficientForBackground"] = "locationPermissionsInsufficientForBackground";
16
+ HyperTrackError["locationPermissionsNotDetermined"] = "locationPermissionsNotDetermined";
17
+ HyperTrackError["locationPermissionsReducedAccuracy"] = "locationPermissionsReducedAccuracy";
18
+ HyperTrackError["locationPermissionsProvisional"] = "locationPermissionsProvisional";
19
+ HyperTrackError["locationPermissionsRestricted"] = "locationPermissionsRestricted";
20
+ HyperTrackError["locationServicesDisabled"] = "locationServicesDisabled";
21
+ HyperTrackError["locationServicesUnavailable"] = "locationServicesUnavailable";
22
+ HyperTrackError["motionActivityPermissionsNotDetermined"] = "motionActivityPermissionsNotDetermined";
23
+ HyperTrackError["motionActivityPermissionsDenied"] = "motionActivityPermissionsDenied";
24
+ HyperTrackError["motionActivityServicesDisabled"] = "motionActivityServicesDisabled";
25
+ HyperTrackError["motionActivityServicesUnavailable"] = "motionActivityServicesUnavailable";
26
+ HyperTrackError["motionActivityPermissionsRestricted"] = "motionActivityPermissionsRestricted";
27
+ HyperTrackError["networkConnectionUnavailable"] = "networkConnectionUnavailable";
28
+ HyperTrackError["invalidPublishableKey"] = "invalidPublishableKey";
29
+ HyperTrackError["blockedFromRunning"] = "blockedFromRunning";
30
+ })(HyperTrackError || (exports.HyperTrackError = HyperTrackError = {}));
31
+ //# sourceMappingURL=HyperTrackError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["HyperTrackError"],"sources":["HyperTrackError.ts"],"sourcesContent":["// enum naming convention is ignored to make datatype sync\n// across platforms easier\nexport enum HyperTrackError {\n gpsSignalLost = \"gpsSignalLost\",\n locationMocked = \"locationMocked\",\n locationPermissionsDenied = \"locationPermissionsDenied\",\n locationPermissionsInsufficientForBackground = \"locationPermissionsInsufficientForBackground\",\n locationPermissionsNotDetermined = \"locationPermissionsNotDetermined\",\n locationPermissionsReducedAccuracy = \"locationPermissionsReducedAccuracy\",\n locationPermissionsProvisional = \"locationPermissionsProvisional\",\n locationPermissionsRestricted = \"locationPermissionsRestricted\",\n locationServicesDisabled = \"locationServicesDisabled\",\n locationServicesUnavailable = \"locationServicesUnavailable\",\n motionActivityPermissionsNotDetermined = \"motionActivityPermissionsNotDetermined\",\n motionActivityPermissionsDenied = \"motionActivityPermissionsDenied\",\n motionActivityServicesDisabled = \"motionActivityServicesDisabled\",\n motionActivityServicesUnavailable = \"motionActivityServicesUnavailable\",\n motionActivityPermissionsRestricted = \"motionActivityPermissionsRestricted\",\n networkConnectionUnavailable = \"networkConnectionUnavailable\",\n invalidPublishableKey = \"invalidPublishableKey\",\n blockedFromRunning = \"blockedFromRunning\"\n}\n"],"mappings":";;;;;;AAAA;AACA;AAAA,IACYA,eAAe;AAAA;AAAA,WAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;AAAA,GAAfA,eAAe,+BAAfA,eAAe"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=Location.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["Location.ts"],"sourcesContent":["export type Location = {\n type: 'location';\n value: {\n latitude: number;\n longitude: number;\n };\n};\n"],"mappings":""}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=LocationError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["LocationError.ts"],"sourcesContent":["import type { HyperTrackError } from './HyperTrackError';\nimport type { NotRunning, Starting } from './internal/LocationErrorInternal';\n\nexport { NotRunning, Starting }\n\nexport type Errors = {\n type: 'errors';\n value: HyperTrackError[];\n};\n\nexport type LocationError = NotRunning | Starting | Errors;\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=SdkInitParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["SdkInitParams.ts"],"sourcesContent":["export type SdkInitParams = {\n loggingEnabled?: boolean;\n allowMockLocations?: boolean;\n requireBackgroundTrackingPermission?: boolean;\n};\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=DeviceId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["DeviceId.ts"],"sourcesContent":["export type DeviceId = {\n type: 'deviceID';\n value: string;\n};\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=DeviceName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["DeviceName.ts"],"sourcesContent":["export type DeviceName = {\n type: 'deviceName';\n value: string;\n};\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=Geotag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["Geotag.ts"],"sourcesContent":["export type Geotag = {\n data: Object\n}\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=HyperTrackErrorInternal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["HyperTrackErrorInternal.ts"],"sourcesContent":["export type HyperTrackErrorInternal = {\n type: \"hyperTrackError\",\n value: string\n}\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=IsAvailable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["IsAvailable.ts"],"sourcesContent":["export type IsAvailable = {\n type: 'isAvailable';\n value: boolean;\n};\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=IsTracking.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["IsTracking.ts"],"sourcesContent":["export type IsTracking = {\n type: 'isTracking';\n value: boolean;\n};\n"],"mappings":""}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=LocationErrorInternal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["LocationErrorInternal.ts"],"sourcesContent":["import type { HyperTrackErrorInternal } from './HyperTrackErrorInternal';\n\nexport type NotRunning = {\n type: 'notRunning';\n};\nexport type Starting = {\n type: 'starting';\n};\nexport type ErrorsInternal = {\n type: 'errors';\n value: HyperTrackErrorInternal[];\n};\n\nexport type LocationErrorInternal = NotRunning | Starting | ErrorsInternal;\n"],"mappings":""}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=LocationResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["LocationResponse.ts"],"sourcesContent":["import type { Location } from '../Location';\nimport type { LocationErrorInternal } from './LocationErrorInternal';\n\nexport type LocationSuccess = {\n type: 'success';\n value: Location;\n};\n\nexport type LocationFailure = {\n type: 'failure';\n value: LocationErrorInternal;\n};\n\nexport type LocationResponse = LocationSuccess | LocationFailure;\n"],"mappings":""}
@@ -3,50 +3,61 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "Error", {
6
+ Object.defineProperty(exports, "Errors", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _HyperTrack.Error;
9
+ return _LocationError.Errors;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "GeotagError", {
12
+ Object.defineProperty(exports, "HyperTrack", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _HyperTrack.GeotagError;
15
+ return _HyperTrack.default;
16
16
  }
17
17
  });
18
- Object.defineProperty(exports, "HyperTrack", {
18
+ Object.defineProperty(exports, "HyperTrackError", {
19
19
  enumerable: true,
20
20
  get: function () {
21
- return _HyperTrack.default;
21
+ return _HyperTrackError.HyperTrackError;
22
22
  }
23
23
  });
24
24
  Object.defineProperty(exports, "Location", {
25
25
  enumerable: true,
26
26
  get: function () {
27
- return _HyperTrack.Location;
27
+ return _Location.Location;
28
28
  }
29
29
  });
30
30
  Object.defineProperty(exports, "LocationError", {
31
31
  enumerable: true,
32
32
  get: function () {
33
- return _HyperTrack.LocationError;
33
+ return _LocationError.LocationError;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "NotRunning", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _LocationError.NotRunning;
34
40
  }
35
41
  });
36
- Object.defineProperty(exports, "SDKError", {
42
+ Object.defineProperty(exports, "SdkInitParams", {
37
43
  enumerable: true,
38
44
  get: function () {
39
- return _HyperTrack.SDKError;
45
+ return _SdkInitParams.SdkInitParams;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "Starting", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _LocationError.Starting;
40
52
  }
41
53
  });
42
54
  exports.default = void 0;
43
-
44
- var _HyperTrack = _interopRequireWildcard(require("./HyperTrack/HyperTrack"));
45
-
46
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
47
-
48
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
49
-
55
+ var _HyperTrack = _interopRequireDefault(require("./HyperTrack/HyperTrack"));
56
+ var _HyperTrackError = require("./HyperTrack/data_types/HyperTrackError");
57
+ var _LocationError = require("./HyperTrack/data_types/LocationError");
58
+ var _Location = require("./HyperTrack/data_types/Location");
59
+ var _SdkInitParams = require("./HyperTrack/data_types/SdkInitParams");
60
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
50
61
  var _default = _HyperTrack.default;
51
62
  exports.default = _default;
52
63
  //# sourceMappingURL=index.js.map