hypertrack-sdk-react-native 8.2.2 → 9.1.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 +29 -1
  2. package/CONTRIBUTING.md +30 -110
  3. package/LICENSE +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 +28 -0
  12. package/android/src/main/java/com/reactnativehypertracksdk/common/HyperTrackSdkWrapper.kt +251 -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 +50 -0
  15. package/android/src/main/java/com/reactnativehypertracksdk/common/SdkInitParams.kt +44 -0
  16. package/android/src/main/java/com/reactnativehypertracksdk/common/SdkMethod.kt +21 -0
  17. package/android/src/main/java/com/reactnativehypertracksdk/common/Serialization.kt +203 -0
  18. package/hypertrack-sdk-react-native.podspec +1 -1
  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 +120 -0
  26. package/ios/common/SDKInitParams.swift +13 -0
  27. package/ios/common/SDKMethod.swift +14 -0
  28. package/ios/common/Serialization.swift +268 -0
  29. package/lib/commonjs/HyperTrack/HyperTrack.js +142 -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 +141 -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 +25 -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 +164 -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 +28 -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,153 @@
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
+ automaticallyRequestPermissions: sdkInitParams.automaticallyRequestPermissions ?? true
43
+ });
79
44
  return new HyperTrack();
80
45
  } catch (error) {
81
46
  throw new Error(error.message);
82
47
  }
83
48
  }
84
- /**
85
- * Enables debug log output. This is very verbose, so you shouldn't use this for
86
- * production build.
87
- */
88
49
 
89
-
90
- static enableDebugLogging(enable) {
91
- HyperTrackSdk.enableDebugLogging(enable);
92
- }
93
50
  /**
94
- * Returns a string which is used by HyperTrack to uniquely identify the user.
51
+ * Returns a string that is used to uniquely identify the device
95
52
  */
96
-
97
-
98
- async getDeviceID() {
99
- return HyperTrackSdk.getDeviceID();
53
+ getDeviceId() {
54
+ return HyperTrackSdk.getDeviceId().then(deviceId => deviceId.value);
100
55
  }
56
+
101
57
  /**
102
- * Device's availability for nearby search
58
+ * Reflects availability of the device for the Nearby search
103
59
  *
104
60
  * @returns true when is available or false when unavailable
105
61
  */
106
-
107
-
108
62
  isAvailable() {
109
- return HyperTrackSdk.isAvailable();
63
+ return HyperTrackSdk.isAvailable().then(isAvailable => isAvailable.value);
110
64
  }
65
+
111
66
  /**
112
- * Allows you to set device availability for nearby search
67
+ * Sets the availability of the device for the Nearby search
113
68
  *
114
69
  * @param availability true when is available or false when unavailable
115
70
  */
116
-
117
-
118
- async setAvailability(availability) {
119
- return HyperTrackSdk.setAvailability(availability);
71
+ setAvailability(isAvailable) {
72
+ HyperTrackSdk.setAvailability({
73
+ type: 'isAvailable',
74
+ value: isAvailable
75
+ });
120
76
  }
77
+
121
78
  /**
122
- * Determine whether the SDK is tracking the movement of the user.
79
+ * Reflects the tracking intent for the device
80
+ *
123
81
  * @return {boolean} Whether the user's movement data is getting tracked or not.
124
82
  */
125
-
126
-
127
83
  isTracking() {
128
- return HyperTrackSdk.isTracking();
84
+ return HyperTrackSdk.isTracking().then(isTracking => isTracking.value);
129
85
  }
86
+
130
87
  /**
131
- * Update device state from server.
88
+ * Syncs the device state with the HyperTrack servers
132
89
  */
133
-
134
-
135
- syncDeviceSettings() {
136
- HyperTrackSdk.syncDeviceSettings();
90
+ sync() {
91
+ HyperTrackSdk.sync();
137
92
  }
93
+
138
94
  /**
139
- * Start or resume tracking location and activity events.
95
+ * Expresses an intent to start location tracking for the device
140
96
  */
141
-
142
-
143
97
  startTracking() {
144
98
  HyperTrackSdk.startTracking();
145
99
  }
100
+
146
101
  /**
147
- * Stops the SDK from listening to the user's movement updates and recording any data.
102
+ * Stops location tracking immediately
148
103
  */
149
-
150
-
151
104
  stopTracking() {
152
105
  HyperTrackSdk.stopTracking();
153
- } /// The current location of the user or an outage reason.
154
-
106
+ }
155
107
 
108
+ /**
109
+ * Reflects the current location of the user or an outage reason
110
+ */
156
111
  getLocation() {
157
- return HyperTrackSdk.getLocation();
112
+ return HyperTrackSdk.getLocation().then(locationResponse => {
113
+ return this.deserializeLocationResponse(locationResponse);
114
+ });
115
+ }
116
+
117
+ /**
118
+ * Sets the name for the device
119
+ * @param {string} name
120
+ */
121
+ setName(name) {
122
+ HyperTrackSdk.setName({
123
+ type: 'deviceName',
124
+ value: name
125
+ });
158
126
  }
127
+
159
128
  /**
160
- * Listen for errors.
129
+ * Sets the metadata for the device
130
+ * @param {Object} data - Metadata JSON
131
+ */
132
+ setMetadata(data) {
133
+ HyperTrackSdk.setMetadata(data);
134
+ }
135
+
136
+ /**
137
+ * Adds a new geotag
138
+ * @param {Object} data - Geotad data JSON
139
+ * @returns current location if success or LocationError if failure
140
+ */
141
+ addGeotag(data) {
142
+ return HyperTrackSdk.addGeotag({
143
+ data
144
+ }).then(locationResponse => {
145
+ return this.deserializeLocationResponse(locationResponse);
146
+ });
147
+ }
148
+
149
+ /**
150
+ * Subscribe to tracking errors
161
151
  *
162
- * @param listener (errors: {code, message}) => void
152
+ * @param listener
163
153
  * @returns EmitterSubscription
164
154
  * @example
165
155
  * ```js
@@ -173,15 +163,16 @@ class HyperTrack {
173
163
  * subscription.remove()
174
164
  * ```
175
165
  */
176
-
177
-
178
166
  subscribeToErrors(listener) {
179
- return EventEmitter.addListener('onTrackingErrorHyperTrack', listener);
167
+ return EventEmitter.addListener(EVENT_ERROR, rawErrors => {
168
+ listener(this.deserializeHyperTrackErrors(rawErrors));
169
+ });
180
170
  }
171
+
181
172
  /**
182
- * Listen for tracking changes.
173
+ * Subscribe to tracking intent changes
183
174
  *
184
- * @param listener (isTracking: boolean) => void
175
+ * @param listener
185
176
  * @returns EmitterSubscription
186
177
  * @example
187
178
  * ```js
@@ -195,50 +186,59 @@ class HyperTrack {
195
186
  * subscription.remove()
196
187
  * ```
197
188
  */
198
-
199
-
200
189
  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);
190
+ return EventEmitter.addListener(EVENT_TRACKING, isTracking => {
191
+ listener(isTracking.value);
192
+ });
220
193
  }
221
- /**
222
- * @deprecated
223
- * Set a trip marker
224
- * @param {Object} _data - Include anything that can be parsed into JSON.
225
- */
226
194
 
227
-
228
- setTripMarker(_data) {
229
- throw new Error('Deprecated');
230
- }
231
195
  /**
232
- * Add geotag
233
- * @param {Object} data - Include anything that can be parsed into JSON.
196
+ * Subscribe to availability changes
197
+ *
198
+ * @param listener
199
+ * @returns EmitterSubscription
200
+ * @example
201
+ * ```js
202
+ * const subscription = HyperTrack.subscribeToAvailability(isAvailable => {
203
+ * if (isAvailable) {
204
+ * // ... ready to go
205
+ * }
206
+ * })
207
+ *
208
+ * // later, to stop listening
209
+ * subscription.remove()
210
+ * ```
234
211
  */
235
-
236
-
237
- addGeotag(data) {
238
- return HyperTrackSdk.addGeotag(data);
212
+ subscribeToAvailability(listener) {
213
+ return EventEmitter.addListener(EVENT_AVAILABILITY, isAvailable => {
214
+ listener(isAvailable.value);
215
+ });
216
+ }
217
+
218
+ /** @ignore */
219
+ deserializeHyperTrackErrors(errors) {
220
+ return errors.map(error => _HyperTrackError.HyperTrackError[error.value]);
221
+ }
222
+
223
+ /** @ignore */
224
+ deserializeLocationResponse(response) {
225
+ switch (response.type) {
226
+ case "success":
227
+ return response.value;
228
+ case "failure":
229
+ switch (response.value.type) {
230
+ case "notRunning":
231
+ case "starting":
232
+ return response.value;
233
+ case "errors":
234
+ return {
235
+ type: "errors",
236
+ value: this.deserializeHyperTrackErrors(response.value.value)
237
+ };
238
+ }
239
+ }
240
+ ;
239
241
  }
240
-
241
242
  }
242
-
243
243
  exports.default = HyperTrack;
244
244
  //# 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;;AA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F;AACA;AACA;AACA;;;EACuB,MAAfC,eAAe,CAACC,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","automaticallyRequestPermissions","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 automaticallyRequestPermissions: sdkInitParams.automaticallyRequestPermissions ?? true,\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;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ACA;AACA;AACA;AACA;EACEE,mBAAmB,CAACJ,QAAuC,EAAE;IAC3D,OAAOlC,YAAY,CAACmC,WAAW,CAC7BjD,cAAc,EACbmC,UAAsB,IAAK;MAC1Ba,QAAQ,CAACb,UAAU,CAACJ,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,OAAOlC,YAAY,CAACmC,WAAW,CAC7BhD,kBAAkB,EACjB+B,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":["/**\n * Parameters for initializing the SDK.\n */\nexport type SdkInitParams = {\n /**\n * Enable debug logging.\n * @default false\n */\n loggingEnabled?: boolean;\n\n /**\n * Allow mock locations to pass through and don’t send mock location outage.\n * @default false\n */\n allowMockLocations?: boolean;\n\n /**\n * Require Background location permissions while requiring permissions on Android.\n * @default false\n */\n requireBackgroundTrackingPermission?: boolean;\n\n /**\n * Automatically request permissions on starting tracking on iOS.\n * @default true\n */\n automaticallyRequestPermissions?: 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":""}