hypertrack-sdk-react-native 11.0.10 → 12.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.
package/README.md CHANGED
@@ -1,40 +1,3 @@
1
- # React Native HyperTrack SDK
1
+ # `hypertrack-sdk-react-native`
2
2
 
3
- [![GitHub](https://img.shields.io/github/license/hypertrack/sdk-react-native?color=orange)](./LICENSE)
4
- [![npm](https://img.shields.io/npm/v/hypertrack-sdk-react-native.svg)](https://www.npmjs.com/package/hypertrack-sdk-react-native)
5
- [![iOS SDK](https://img.shields.io/badge/iOS%20SDK-5.0.7-brightgreen.svg)](https://github.com/hypertrack/sdk-ios)
6
- [![Android SDK](https://img.shields.io/badge/Android%20SDK-7.0.9-brightgreen.svg)](https://github.com/hypertrack/sdk-android)
7
-
8
- [HyperTrack](https://www.hypertrack.com) lets you add live location tracking to your mobile app. Live location is made available along with ongoing activity, tracking controls and tracking outage with reasons.
9
-
10
- React Native HyperTrack SDK is a wrapper around native iOS and Android SDKs that allows to integrate HyperTrack into React Native apps.
11
-
12
- For information about how to get started with React Native HyperTrack SDK, please check this [Guide](https://www.hypertrack.com/docs/install-sdk-react-native).
13
-
14
- ## Installation
15
-
16
- `yarn add hypertrack-sdk-react-native`
17
-
18
- ## Sample code
19
-
20
- [Quickstart React Native app](https://github.com/hypertrack/quickstart-react-native)
21
-
22
- ## Wrapper API Documentation
23
-
24
- [Wrapper API Documentation](https://hypertrack.github.io/sdk-react-native/)
25
-
26
- ## Requirements
27
-
28
- ### Android
29
-
30
- - Gradle version 6.7.1+
31
- - compileSdkVersion 31+
32
- - minSdkVersion 19+
33
-
34
- ### iOS
35
-
36
- - iOS version 12.4+
37
-
38
- ## Contributing
39
-
40
- If you want to contribute check [CONTRIBUTING.md](CONTRIBUTING.md)
3
+ The main package for HyperTrack SDK React Native.
@@ -148,8 +148,6 @@ dependencies {
148
148
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
149
149
 
150
150
  implementation "com.hypertrack:sdk-android:$hyperTrackSdk_version"
151
- implementation "com.hypertrack:location-services-google-19-0-1:$hyperTrackSdk_version"
152
- implementation "com.hypertrack:push-service-firebase:$hyperTrackSdk_version"
153
151
  }
154
152
 
155
153
  if (isNewArchitectureEnabled()) {
@@ -1,3 +1,3 @@
1
1
  HyperTrackSdk_kotlinVersion=1.6.21
2
- HyperTrackSdk_HyperTrackSDKVersion=7.0.9
2
+ HyperTrackSdk_HyperTrackSDKVersion=7.0.11
3
3
  android.useAndroidX=true
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
18
18
  s.source_files = "ios/**/*.{h,m,mm,swift}"
19
19
 
20
20
  s.dependency "React-Core"
21
- s.dependency 'HyperTrack', '5.0.7'
21
+ s.dependency 'HyperTrack', '5.0.8'
22
22
 
23
23
  # Don't install the dependencies when we run `pod install` in the old architecture.
24
24
  if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
@@ -7,8 +7,8 @@ exports.default = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  var _HyperTrackError = require("./data_types/HyperTrackError");
9
9
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
11
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
11
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
12
12
  const EVENT_ERRORS = 'errors';
13
13
  const EVENT_IS_AVAILABLE = 'isAvailable';
14
14
  const EVENT_IS_TRACKING = 'isTracking';
@@ -40,10 +40,7 @@ class HyperTrack {
40
40
  * @returns location with deviation if success or LocationError if failure
41
41
  */
42
42
 
43
- static async addGeotag() {
44
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
45
- args[_key] = arguments[_key];
46
- }
43
+ static async addGeotag(...args) {
47
44
  if (args.length === 1 && typeof args[0] === 'object') {
48
45
  return HyperTrackSdk.addGeotag({
49
46
  data: args[0],
@@ -151,7 +148,8 @@ class HyperTrack {
151
148
  *
152
149
  * @param callback
153
150
  * @returns EmitterSubscription
154
- * @example ```js
151
+ * @example
152
+ * ```js
155
153
  * const subscription = HyperTrack.locate(location => {
156
154
  * ...
157
155
  * })
@@ -162,7 +160,7 @@ class HyperTrack {
162
160
  */
163
161
  static locate(callback) {
164
162
  var _this$locateSubscript;
165
- (_this$locateSubscript = this.locateSubscription) === null || _this$locateSubscript === void 0 ? void 0 : _this$locateSubscript.remove();
163
+ (_this$locateSubscript = this.locateSubscription) === null || _this$locateSubscript === void 0 || _this$locateSubscript.remove();
166
164
  this.locateSubscription = EventEmitter.addListener(EVENT_LOCATE, location => {
167
165
  callback(this.deserializeLocateResponse(location));
168
166
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_HyperTrackError","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","EVENT_ERRORS","EVENT_IS_AVAILABLE","EVENT_IS_TRACKING","EVENT_LOCATE","EVENT_LOCATION","LINKING_ERROR","Platform","select","ios","default","HyperTrackSdk","NativeModules","HyperTrackReactNativePlugin","Proxy","get","Error","EventEmitter","NativeEventEmitter","HyperTrack","addGeotag","_len","arguments","length","args","Array","_key","data","expectedLocation","then","locationResponse","deserializeLocationResponse","isLocation","type","latitude","longitude","deserializeLocationWithDeviationResponse","getDeviceId","deviceId","getErrors","errors","deserializeHyperTrackErrors","getIsAvailable","isAvailable","getIsTracking","isTracking","getLocation","getMetadata","metadata","deserializeMetadata","getName","name","deserializeName","locate","callback","_this$locateSubscript","locateSubscription","remove","addListener","location","deserializeLocateResponse","setIsAvailable","setIsTracking","setMetadata","setName","subscribeToErrors","listener","rawErrors","subscribeToIsAvailable","subscribeToIsTracking","subscribeToLocation","map","error","keys","HyperTrackError","find","response","deserializeLocationError","locationError","locationWithDeviationInternal","locationInternal","deviation","JSON","stringify","exports"],"sources":["HyperTrack.ts"],"sourcesContent":["import {\n NativeModules,\n Platform,\n NativeEventEmitter,\n EmitterSubscription,\n} from 'react-native';\nimport { HyperTrackError } from './data_types/HyperTrackError';\nimport type { IsAvailable } from './data_types/internal/IsAvailable';\nimport type { IsTracking } from './data_types/internal/IsTracking';\nimport type { Location } from './data_types/Location';\nimport type { LocationError } from './data_types/LocationError';\nimport type { DeviceId } from './data_types/internal/DeviceId';\nimport type { GeotagData } from './data_types/internal/GeotagData';\nimport type { Name } from './data_types/internal/Name';\nimport type { HyperTrackErrorInternal } from './data_types/internal/HyperTrackErrorInternal';\nimport type { LocationWithDeviation } from './data_types/LocationWithDeviation';\nimport type { LocationErrorInternal } from './data_types/internal/LocationErrorInternal';\nimport type { Result } from './data_types/Result';\nimport type { LocationInternal } from './data_types/internal/LocationInternal';\nimport type { LocationWithDeviationInternal } from './data_types/internal/LocationWithDeviationInternal';\nimport type { Metadata } from './data_types/internal/Metadata';\n\nconst EVENT_ERRORS = 'errors';\nconst EVENT_IS_AVAILABLE = 'isAvailable';\nconst EVENT_IS_TRACKING = 'isTracking';\nconst EVENT_LOCATE = 'locate';\nconst EVENT_LOCATION = 'location';\n\nconst LINKING_ERROR =\n `The package 'hypertrack-sdk-react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst HyperTrackSdk = NativeModules.HyperTrackReactNativePlugin\n ? NativeModules.HyperTrackReactNativePlugin\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nconst EventEmitter = new NativeEventEmitter(HyperTrackSdk);\n\nexport default class HyperTrack {\n private static locateSubscription: EmitterSubscription | undefined;\n\n /**\n * Adds a new geotag\n *\n * @param {Object} data - Geotad data JSON\n * @returns current location if success or LocationError if failure\n */\n static async addGeotag(\n data: Object\n ): Promise<Result<Location, LocationError>>;\n\n /**\n * Adds a new geotag with expected location\n *\n * @param {Object} data - Geotad data JSON\n * @param {Location} expectedLocation - Expected location\n * @returns location with deviation if success or LocationError if failure\n */\n static async addGeotag(\n data: Object,\n expectedLocation: Location\n ): Promise<Result<LocationWithDeviation, LocationError>>;\n\n static async addGeotag(\n ...args: any[]\n ): Promise<Result<Location | LocationWithDeviation, LocationError>> {\n if (args.length === 1 && typeof args[0] === 'object') {\n return HyperTrackSdk.addGeotag({\n data: args[0],\n expectedLocation: undefined,\n } as GeotagData).then(\n (locationResponse: Result<LocationInternal, LocationErrorInternal>) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n } else if (\n args.length === 2 &&\n typeof args[0] === 'object' &&\n HyperTrack.isLocation(args[1])\n ) {\n let expectedLocation = args[1] as Location;\n return HyperTrackSdk.addGeotag({\n data: args[0],\n expectedLocation: {\n type: 'location',\n value: {\n latitude: expectedLocation.latitude,\n longitude: expectedLocation.longitude,\n },\n } as LocationInternal,\n } as GeotagData).then(\n (\n locationResponse: Result<\n LocationWithDeviationInternal,\n LocationErrorInternal\n >\n ) => {\n return this.deserializeLocationWithDeviationResponse(\n locationResponse\n );\n }\n );\n } else {\n throw new Error('Invalid arguments');\n }\n }\n\n /**\n * Returns a string that is used to uniquely identify the device\n *\n * @returns {string} Device ID\n */\n static async getDeviceId(): Promise<string> {\n return HyperTrackSdk.getDeviceId().then(\n (deviceId: DeviceId) => deviceId.value\n );\n }\n\n /**\n * Returns a list of errors that blocks SDK from tracking\n *\n * @returns {HyperTrackError[]} List of errors\n */\n static async getErrors(): Promise<HyperTrackError[]> {\n return HyperTrackSdk.getErrors().then(\n (errors: HyperTrackErrorInternal[]) => {\n return this.deserializeHyperTrackErrors(errors);\n }\n );\n }\n\n /**\n * Reflects availability of the device for the Nearby search\n *\n * @returns true when is available or false when unavailable\n */\n static async getIsAvailable(): Promise<boolean> {\n return HyperTrackSdk.getIsAvailable().then(\n (isAvailable: IsAvailable) => isAvailable.value\n );\n }\n\n /**\n * Reflects the tracking intent for the device\n *\n * @returns {boolean} Whether the user's movement data is getting tracked or not.\n */\n static async getIsTracking(): Promise<boolean> {\n return HyperTrackSdk.getIsTracking().then(\n (isTracking: IsTracking) => isTracking.value\n );\n }\n\n /**\n * Reflects the current location of the user or an outage reason\n */\n static async getLocation(): Promise<Result<Location, LocationError>> {\n return HyperTrackSdk.getLocation().then(\n (locationResponse: Result<LocationInternal, LocationErrorInternal>) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n }\n\n /**\n * Gets the metadata that is set for the device\n *\n * @returns {Object} Metadata JSON\n */\n static async getMetadata(): Promise<Object> {\n return HyperTrackSdk.getMetadata().then((metadata: Metadata) => {\n return this.deserializeMetadata(metadata);\n });\n }\n\n /**\n * Gets the name that is set for the device\n *\n * @returns {string} Device name\n */\n static async getName(): Promise<string> {\n return HyperTrackSdk.getName().then((name: Name) => {\n return this.deserializeName(name);\n });\n }\n\n /**\n * Requests one-time location update and returns the location once it is available, or error.\n *\n * Only one locate subscription can be active at a time. If you re-subscribe, the old EmitterSubscription\n * will be automaticaly removed.\n *\n * This method will start location tracking if called, and will stop it when the location is received or\n * the subscription is cancelled. If any other tracking intent is present (e.g. isAvailable is set to `true`),\n * the tracking will not be stopped.\n *\n * @param callback\n * @returns EmitterSubscription\n * @example ```js\n * const subscription = HyperTrack.locate(location => {\n * ...\n * })\n *\n * // to unsubscribe\n * subscription.remove()\n * ```\n */\n static locate(\n callback: (location: Result<Location, HyperTrackError[]>) => void\n ) {\n this.locateSubscription?.remove();\n this.locateSubscription = EventEmitter.addListener(\n EVENT_LOCATE,\n (location: Result<LocationInternal, HyperTrackErrorInternal[]>) => {\n callback(this.deserializeLocateResponse(location));\n }\n );\n HyperTrackSdk.locate();\n return this.locateSubscription;\n }\n\n /**\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 static async setIsAvailable(isAvailable: boolean) {\n HyperTrackSdk.setIsAvailable({\n type: 'isAvailable',\n value: isAvailable,\n } as IsAvailable);\n }\n\n /**\n * Sets the tracking intent for the device\n *\n * @param {boolean} isTracking\n */\n static async setIsTracking(isTracking: boolean): Promise<void> {\n HyperTrackSdk.setIsTracking({\n type: 'isTracking',\n value: isTracking,\n } as IsTracking);\n }\n\n /**\n * Sets the metadata for the device\n *\n * @param {Object} data - Metadata JSON\n */\n static async setMetadata(data: Object) {\n HyperTrackSdk.setMetadata({\n type: 'metadata',\n value: data,\n });\n }\n\n /**\n * Sets the name for the device\n *\n * @param {string} name\n */\n static async setName(name: string) {\n HyperTrackSdk.setName({\n type: 'name',\n value: name,\n } as Name);\n }\n\n /**\n * Subscribe to tracking errors\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToErrors(errors => {\n * errors.forEach(error => {\n * // ... error\n * })\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToErrors(\n listener: (errors: HyperTrackError[]) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_ERRORS,\n (rawErrors: HyperTrackErrorInternal[]) => {\n listener(this.deserializeHyperTrackErrors(rawErrors));\n }\n );\n }\n\n /**\n * Subscribe to availability changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToIsAvailable(isAvailable => {\n * if (isAvailable) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToIsAvailable(\n listener: (isAvailable: boolean) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_IS_AVAILABLE,\n (isAvailable: IsAvailable) => {\n listener(isAvailable.value);\n }\n );\n }\n\n /**\n * Subscribe to tracking intent changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToIsTracking(isTracking => {\n * if (isTracking) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToIsTracking(\n listener: (isTracking: boolean) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_IS_TRACKING,\n (isTracking: IsTracking) => {\n listener(isTracking.value);\n }\n );\n }\n\n /**\n * Subscribe to location changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToLocation(location => {\n * ...\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToLocation(\n listener: (location: Result<Location, LocationError>) => void\n ) {\n return EventEmitter.addListener(\n EVENT_LOCATION,\n (location: Result<LocationInternal, LocationErrorInternal>) => {\n listener(this.deserializeLocationResponse(location));\n }\n );\n }\n\n /** @ignore */\n private static deserializeHyperTrackErrors(\n errors: HyperTrackErrorInternal[]\n ): HyperTrackError[] {\n let res = errors.map((error: HyperTrackErrorInternal) => {\n if (error.type != 'error') {\n throw new Error('Invalid error type');\n }\n return Object.keys(HyperTrackError).find(\n (key) =>\n HyperTrackError[key as keyof typeof HyperTrackError] === error.value\n ) as HyperTrackError;\n });\n return res;\n }\n\n /** @ignore */\n private static deserializeLocateResponse(\n response: Result<LocationInternal, HyperTrackErrorInternal[]>\n ): Result<Location, HyperTrackError[]> {\n switch (response.type) {\n case 'success':\n return {\n type: 'success',\n value: response.value.value,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeHyperTrackErrors(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationError(\n locationError: LocationErrorInternal\n ): LocationError {\n switch (locationError.type) {\n case 'notRunning':\n case 'starting':\n return locationError;\n case 'errors':\n return {\n type: 'errors',\n value: this.deserializeHyperTrackErrors(locationError.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationResponse(\n response: Result<LocationInternal, LocationErrorInternal>\n ): Result<Location, LocationError> {\n switch (response.type) {\n case 'success':\n return {\n type: 'success',\n value: response.value.value,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeLocationError(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationWithDeviationResponse(\n response: Result<LocationWithDeviationInternal, LocationErrorInternal>\n ): Result<LocationWithDeviation, LocationError> {\n switch (response.type) {\n case 'success':\n const locationWithDeviationInternal: LocationWithDeviationInternal =\n response.value;\n const locationInternal: LocationInternal =\n locationWithDeviationInternal.value.location;\n\n return {\n type: 'success',\n value: {\n location: locationInternal.value,\n deviation: locationWithDeviationInternal.value.deviation,\n } as LocationWithDeviation,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeLocationError(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeMetadata(metadata: Metadata): Object {\n if (metadata.type != 'metadata') {\n throw new Error(`Invalid metadata: ${JSON.stringify(metadata)}`);\n }\n return metadata.value;\n }\n\n /** @ignore */\n private static deserializeName(name: Name): string {\n if (name.type != 'name') {\n throw new Error(`Invalid name: ${JSON.stringify(name)}`);\n }\n return name.value;\n }\n\n /** @ignore */\n private static isLocation(obj: Location): obj is Location {\n return (\n 'latitude' in obj &&\n typeof obj.latitude == 'number' &&\n 'longitude' in obj &&\n typeof obj.longitude == 'number'\n );\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAMA,IAAAC,gBAAA,GAAAD,OAAA;AAA+D,SAAAE,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,K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ACxB9B,IAAI,EAAE,UAAU;MAChBpD,KAAK,EAAE8C;IACT,CAAC,CAAC;EACJ;;EAEA;AACF;AACA;AACA;AACA;EACE,aAAaqC,OAAOA,CAACb,IAAY,EAAE;IACjCxC,aAAa,CAACqD,OAAO,CAAC;MACpB/B,IAAI,EAAE,MAAM;MACZpD,KAAK,EAAEsE;IACT,CAAS,CAAC;EACZ;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOc,iBAAiBA,CACtBC,QAA6C,EACxB;IACrB,OAAOjD,YAAY,CAACyC,WAAW,CAC7BzD,YAAY,EACXkE,SAAoC,IAAK;MACxCD,QAAQ,CAAC,IAAI,CAACzB,2BAA2B,CAAC0B,SAAS,CAAC,CAAC;IACvD,CACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,sBAAsBA,CAC3BF,QAAwC,EACnB;IACrB,OAAOjD,YAAY,CAACyC,WAAW,CAC7BxD,kBAAkB,EACjByC,WAAwB,IAAK;MAC5BuB,QAAQ,CAACvB,WAAW,CAAC9D,KAAK,CAAC;IAC7B,CACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOwF,qBAAqBA,CAC1BH,QAAuC,EAClB;IACrB,OAAOjD,YAAY,CAACyC,WAAW,CAC7BvD,iBAAiB,EAChB0C,UAAsB,IAAK;MAC1BqB,QAAQ,CAACrB,UAAU,CAAChE,KAAK,CAAC;IAC5B,CACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOyF,mBAAmBA,CACxBJ,QAA6D,EAC7D;IACA,OAAOjD,YAAY,CAACyC,WAAW,CAC7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AI,CAAE,EAAC,CAAC;IAC1D;IACA,OAAOA,IAAI,CAACtE,KAAK;EACnB;;EAEA;EACA,OAAemD,UAAUA,CAACrD,GAAa,EAAmB;IACxD,OACE,UAAU,IAAIA,GAAG,IACjB,OAAOA,GAAG,CAACuD,QAAQ,IAAI,QAAQ,IAC/B,WAAW,IAAIvD,GAAG,IAClB,OAAOA,GAAG,CAACwD,SAAS,IAAI,QAAQ;EAEpC;AACF;AAACiD,OAAA,CAAA1E,OAAA,GAAAS,UAAA;AAAAzC,eAAA,CA5coByC,UAAU"}
1
+ {"version":3,"names":["_reactNative","require","_HyperTrackError","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","EVENT_ERRORS","EVENT_IS_AVAILABLE","EVENT_IS_TRACKING","EVENT_LOCATE","EVENT_LOCATION","LINKING_ERROR","Platform","select","ios","default","HyperTrackSdk","NativeModules","HyperTrackReactNativePlugin","Proxy","get","Error","EventEmitter","NativeEventEmitter","HyperTrack","addGeotag","args","length","data","expectedLocation","undefined","then","locationResponse","deserializeLocationResponse","isLocation","type","latitude","longitude","deserializeLocationWithDeviationResponse","getDeviceId","deviceId","getErrors","errors","deserializeHyperTrackErrors","getIsAvailable","isAvailable","getIsTracking","isTracking","getLocation","getMetadata","metadata","deserializeMetadata","getName","name","deserializeName","locate","callback","_this$locateSubscript","locateSubscription","remove","addListener","location","deserializeLocateResponse","setIsAvailable","setIsTracking","setMetadata","setName","subscribeToErrors","listener","rawErrors","subscribeToIsAvailable","subscribeToIsTracking","subscribeToLocation","res","map","error","keys","HyperTrackError","find","response","deserializeLocationError","locationError","locationWithDeviationInternal","locationInternal","deviation","JSON","stringify","exports"],"sources":["HyperTrack.ts"],"sourcesContent":["import {\n NativeModules,\n Platform,\n NativeEventEmitter,\n EmitterSubscription,\n} from 'react-native';\nimport { HyperTrackError } from './data_types/HyperTrackError';\nimport type { IsAvailable } from './data_types/internal/IsAvailable';\nimport type { IsTracking } from './data_types/internal/IsTracking';\nimport type { Location } from './data_types/Location';\nimport type { LocationError } from './data_types/LocationError';\nimport type { DeviceId } from './data_types/internal/DeviceId';\nimport type { GeotagData } from './data_types/internal/GeotagData';\nimport type { Name } from './data_types/internal/Name';\nimport type { HyperTrackErrorInternal } from './data_types/internal/HyperTrackErrorInternal';\nimport type { LocationWithDeviation } from './data_types/LocationWithDeviation';\nimport type { LocationErrorInternal } from './data_types/internal/LocationErrorInternal';\nimport type { Result } from './data_types/Result';\nimport type { LocationInternal } from './data_types/internal/LocationInternal';\nimport type { LocationWithDeviationInternal } from './data_types/internal/LocationWithDeviationInternal';\nimport type { Metadata } from './data_types/internal/Metadata';\n\nconst EVENT_ERRORS = 'errors';\nconst EVENT_IS_AVAILABLE = 'isAvailable';\nconst EVENT_IS_TRACKING = 'isTracking';\nconst EVENT_LOCATE = 'locate';\nconst EVENT_LOCATION = 'location';\n\nconst LINKING_ERROR =\n `The package 'hypertrack-sdk-react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst HyperTrackSdk = NativeModules.HyperTrackReactNativePlugin\n ? NativeModules.HyperTrackReactNativePlugin\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nconst EventEmitter = new NativeEventEmitter(HyperTrackSdk);\n\nexport default class HyperTrack {\n private static locateSubscription: EmitterSubscription | undefined;\n\n /**\n * Adds a new geotag\n *\n * @param {Object} data - Geotad data JSON\n * @returns current location if success or LocationError if failure\n */\n static async addGeotag(\n data: Object\n ): Promise<Result<Location, LocationError>>;\n\n /**\n * Adds a new geotag with expected location\n *\n * @param {Object} data - Geotad data JSON\n * @param {Location} expectedLocation - Expected location\n * @returns location with deviation if success or LocationError if failure\n */\n static async addGeotag(\n data: Object,\n expectedLocation: Location\n ): Promise<Result<LocationWithDeviation, LocationError>>;\n\n static async addGeotag(\n ...args: any[]\n ): Promise<Result<Location | LocationWithDeviation, LocationError>> {\n if (args.length === 1 && typeof args[0] === 'object') {\n return HyperTrackSdk.addGeotag({\n data: args[0],\n expectedLocation: undefined,\n } as GeotagData).then(\n (locationResponse: Result<LocationInternal, LocationErrorInternal>) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n } else if (\n args.length === 2 &&\n typeof args[0] === 'object' &&\n HyperTrack.isLocation(args[1])\n ) {\n let expectedLocation = args[1] as Location;\n return HyperTrackSdk.addGeotag({\n data: args[0],\n expectedLocation: {\n type: 'location',\n value: {\n latitude: expectedLocation.latitude,\n longitude: expectedLocation.longitude,\n },\n } as LocationInternal,\n } as GeotagData).then(\n (\n locationResponse: Result<\n LocationWithDeviationInternal,\n LocationErrorInternal\n >\n ) => {\n return this.deserializeLocationWithDeviationResponse(\n locationResponse\n );\n }\n );\n } else {\n throw new Error('Invalid arguments');\n }\n }\n\n /**\n * Returns a string that is used to uniquely identify the device\n *\n * @returns {string} Device ID\n */\n static async getDeviceId(): Promise<string> {\n return HyperTrackSdk.getDeviceId().then(\n (deviceId: DeviceId) => deviceId.value\n );\n }\n\n /**\n * Returns a list of errors that blocks SDK from tracking\n *\n * @returns {HyperTrackError[]} List of errors\n */\n static async getErrors(): Promise<HyperTrackError[]> {\n return HyperTrackSdk.getErrors().then(\n (errors: HyperTrackErrorInternal[]) => {\n return this.deserializeHyperTrackErrors(errors);\n }\n );\n }\n\n /**\n * Reflects availability of the device for the Nearby search\n *\n * @returns true when is available or false when unavailable\n */\n static async getIsAvailable(): Promise<boolean> {\n return HyperTrackSdk.getIsAvailable().then(\n (isAvailable: IsAvailable) => isAvailable.value\n );\n }\n\n /**\n * Reflects the tracking intent for the device\n *\n * @returns {boolean} Whether the user's movement data is getting tracked or not.\n */\n static async getIsTracking(): Promise<boolean> {\n return HyperTrackSdk.getIsTracking().then(\n (isTracking: IsTracking) => isTracking.value\n );\n }\n\n /**\n * Reflects the current location of the user or an outage reason\n */\n static async getLocation(): Promise<Result<Location, LocationError>> {\n return HyperTrackSdk.getLocation().then(\n (locationResponse: Result<LocationInternal, LocationErrorInternal>) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n }\n\n /**\n * Gets the metadata that is set for the device\n *\n * @returns {Object} Metadata JSON\n */\n static async getMetadata(): Promise<Object> {\n return HyperTrackSdk.getMetadata().then((metadata: Metadata) => {\n return this.deserializeMetadata(metadata);\n });\n }\n\n /**\n * Gets the name that is set for the device\n *\n * @returns {string} Device name\n */\n static async getName(): Promise<string> {\n return HyperTrackSdk.getName().then((name: Name) => {\n return this.deserializeName(name);\n });\n }\n\n /**\n * Requests one-time location update and returns the location once it is available, or error.\n *\n * Only one locate subscription can be active at a time. If you re-subscribe, the old EmitterSubscription\n * will be automaticaly removed.\n *\n * This method will start location tracking if called, and will stop it when the location is received or\n * the subscription is cancelled. If any other tracking intent is present (e.g. isAvailable is set to `true`),\n * the tracking will not be stopped.\n *\n * @param callback\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.locate(location => {\n * ...\n * })\n *\n * // to unsubscribe\n * subscription.remove()\n * ```\n */\n static locate(\n callback: (location: Result<Location, HyperTrackError[]>) => void\n ) {\n this.locateSubscription?.remove();\n this.locateSubscription = EventEmitter.addListener(\n EVENT_LOCATE,\n (location: Result<LocationInternal, HyperTrackErrorInternal[]>) => {\n callback(this.deserializeLocateResponse(location));\n }\n );\n HyperTrackSdk.locate();\n return this.locateSubscription;\n }\n\n /**\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 static async setIsAvailable(isAvailable: boolean) {\n HyperTrackSdk.setIsAvailable({\n type: 'isAvailable',\n value: isAvailable,\n } as IsAvailable);\n }\n\n /**\n * Sets the tracking intent for the device\n *\n * @param {boolean} isTracking\n */\n static async setIsTracking(isTracking: boolean): Promise<void> {\n HyperTrackSdk.setIsTracking({\n type: 'isTracking',\n value: isTracking,\n } as IsTracking);\n }\n\n /**\n * Sets the metadata for the device\n *\n * @param {Object} data - Metadata JSON\n */\n static async setMetadata(data: Object) {\n HyperTrackSdk.setMetadata({\n type: 'metadata',\n value: data,\n });\n }\n\n /**\n * Sets the name for the device\n *\n * @param {string} name\n */\n static async setName(name: string) {\n HyperTrackSdk.setName({\n type: 'name',\n value: name,\n } as Name);\n }\n\n /**\n * Subscribe to tracking errors\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToErrors(errors => {\n * errors.forEach(error => {\n * // ... error\n * })\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToErrors(\n listener: (errors: HyperTrackError[]) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_ERRORS,\n (rawErrors: HyperTrackErrorInternal[]) => {\n listener(this.deserializeHyperTrackErrors(rawErrors));\n }\n );\n }\n\n /**\n * Subscribe to availability changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToIsAvailable(isAvailable => {\n * if (isAvailable) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToIsAvailable(\n listener: (isAvailable: boolean) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_IS_AVAILABLE,\n (isAvailable: IsAvailable) => {\n listener(isAvailable.value);\n }\n );\n }\n\n /**\n * Subscribe to tracking intent changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToIsTracking(isTracking => {\n * if (isTracking) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToIsTracking(\n listener: (isTracking: boolean) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_IS_TRACKING,\n (isTracking: IsTracking) => {\n listener(isTracking.value);\n }\n );\n }\n\n /**\n * Subscribe to location changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToLocation(location => {\n * ...\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToLocation(\n listener: (location: Result<Location, LocationError>) => void\n ) {\n return EventEmitter.addListener(\n EVENT_LOCATION,\n (location: Result<LocationInternal, LocationErrorInternal>) => {\n listener(this.deserializeLocationResponse(location));\n }\n );\n }\n\n /** @ignore */\n private static deserializeHyperTrackErrors(\n errors: HyperTrackErrorInternal[]\n ): HyperTrackError[] {\n let res = errors.map((error: HyperTrackErrorInternal) => {\n if (error.type != 'error') {\n throw new Error('Invalid error type');\n }\n return Object.keys(HyperTrackError).find(\n (key) =>\n HyperTrackError[key as keyof typeof HyperTrackError] === error.value\n ) as HyperTrackError;\n });\n return res;\n }\n\n /** @ignore */\n private static deserializeLocateResponse(\n response: Result<LocationInternal, HyperTrackErrorInternal[]>\n ): Result<Location, HyperTrackError[]> {\n switch (response.type) {\n case 'success':\n return {\n type: 'success',\n value: response.value.value,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeHyperTrackErrors(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationError(\n locationError: LocationErrorInternal\n ): LocationError {\n switch (locationError.type) {\n case 'notRunning':\n case 'starting':\n return locationError;\n case 'errors':\n return {\n type: 'errors',\n value: this.deserializeHyperTrackErrors(locationError.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationResponse(\n response: Result<LocationInternal, LocationErrorInternal>\n ): Result<Location, LocationError> {\n switch (response.type) {\n case 'success':\n return {\n type: 'success',\n value: response.value.value,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeLocationError(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationWithDeviationResponse(\n response: Result<LocationWithDeviationInternal, LocationErrorInternal>\n ): Result<LocationWithDeviation, LocationError> {\n switch (response.type) {\n case 'success':\n const locationWithDeviationInternal: LocationWithDeviationInternal =\n response.value;\n const locationInternal: LocationInternal =\n locationWithDeviationInternal.value.location;\n\n return {\n type: 'success',\n value: {\n location: locationInternal.value,\n deviation: locationWithDeviationInternal.value.deviation,\n } as LocationWithDeviation,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeLocationError(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeMetadata(metadata: Metadata): Object {\n if (metadata.type != 'metadata') {\n throw new Error(`Invalid metadata: ${JSON.stringify(metadata)}`);\n }\n return metadata.value;\n }\n\n /** @ignore */\n private static deserializeName(name: Name): string {\n if (name.type != 'name') {\n throw new Error(`Invalid name: ${JSON.stringify(name)}`);\n }\n return name.value;\n }\n\n /** @ignore */\n private static isLocation(obj: Location): obj is Location {\n return (\n 'latitude' in obj &&\n typeof obj.latitude == 'number' &&\n 'longitude' in obj &&\n typeof obj.longitude == 'number'\n );\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAMA,IAAAC,gBAAA,GAAAD,OAAA;AAA+D,SAAAE,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAE,MAAA,CAAAF,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAI,CAAA,2BAAAJ,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAK,CAAA,GAAAL,CAAA,CAAAM,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAJ,CAAA,GAAAI,CAAA,C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EAAE,IAAI,CAAC4F,wBAAwB,CAACD,QAAQ,CAAC3F,KAAK;QACrD,CAAC;IACL;EACF;;EAEA;EACA,OAAe+D,mBAAmBA,CAACD,QAAkB,EAAU;IAC7D,IAAIA,QAAQ,CAACf,IAAI,IAAI,UAAU,EAAE;MAC/B,MAAM,IAAId,KAAK,CAAE,qBAAoBgE,IAAI,CAACC,SAAS,CAACpC,QAAQ,CAAE,EAAC,CAAC;IAClE;IACA,OAAOA,QAAQ,CAAC9D,KAAK;EACvB;;EAEA;EACA,OAAekE,eAAeA,CAACD,IAAU,EAAU;IACjD,IAAIA,IAAI,CAAClB,IAAI,IAAI,MAAM,EAAE;MACvB,MAAM,IAAId,KAAK,CAAE,iBAAgBgE,IAAI,CAACC,SAAS,CAACjC,IAAI,CAAE,EAAC,CAAC;IAC1D;IACA,OAAOA,IAAI,CAACjE,KAAK;EACnB;;EAEA;EACA,OAAe8C,UAAUA,CAAChD,GAAa,EAAmB;IACxD,OACE,UAAU,IAAIA,GAAG,IACjB,OAAOA,GAAG,CAACkD,QAAQ,IAAI,QAAQ,IAC/B,WAAW,IAAIlD,GAAG,IAClB,OAAOA,GAAG,CAACmD,SAAS,IAAI,QAAQ;EAEpC;AACF;AAACkD,OAAA,CAAAxE,OAAA,GAAAS,UAAA;AAAAvC,eAAA,CA7coBuC,UAAU"}
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.HyperTrackError = void 0;
7
7
  // enum naming convention is ignored to make datatype sync
8
8
  // across platforms easier
9
- let HyperTrackError = /*#__PURE__*/function (HyperTrackError) {
9
+ let HyperTrackError = exports.HyperTrackError = /*#__PURE__*/function (HyperTrackError) {
10
10
  HyperTrackError["blockedFromRunning"] = "blockedFromRunning";
11
11
  HyperTrackError["invalidPublishableKey"] = "invalidPublishableKey";
12
12
  HyperTrackError["locationMocked"] = "location.mocked";
@@ -23,5 +23,4 @@ let HyperTrackError = /*#__PURE__*/function (HyperTrackError) {
23
23
  HyperTrackError["permissionsNotificationsDenied"] = "permissions.notifications.denied";
24
24
  return HyperTrackError;
25
25
  }({});
26
- exports.HyperTrackError = HyperTrackError;
27
26
  //# sourceMappingURL=HyperTrackError.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["HyperTrackError","exports"],"sources":["HyperTrackError.ts"],"sourcesContent":["// enum naming convention is ignored to make datatype sync\n// across platforms easier\nexport enum HyperTrackError {\n /**\n * The SDK was remotely blocked from running.\n */\n blockedFromRunning = 'blockedFromRunning',\n\n /**\n * The publishable key is invalid.\n */\n invalidPublishableKey = 'invalidPublishableKey',\n\n /**\n * The user enabled mock location app while mocking locations is prohibited.\n */\n locationMocked = 'location.mocked',\n\n /**\n * The user disabled location services systemwide.\n */\n locationServicesDisabled = 'location.servicesDisabled',\n\n /**\n * [Android only] The device doesn't have location services.\n */\n locationServicesUnavailable = 'location.servicesUnavailable',\n\n /**\n * GPS satellites are not in view.\n */\n locationSignalLost = 'location.signalLost',\n\n /**\n * [Android only] The SDK wasn't able to start tracking because of the limitations imposed by the OS.\n * The exempt from background execution conditions weren't met.\n * {@link https://developer.android.com/guide/components/foreground-services#background-start-restriction-exemptions}\n */\n noExemptionFromBackgroundStartRestrictions = 'noExemptionFromBackgroundStartRestrictions',\n\n /**\n * The user denied location permissions.\n */\n permissionsLocationDenied = 'permissions.location.denied',\n\n /**\n * Can’t start tracking in background with When In Use location permissions.\n * SDK will automatically start tracking when app will return to foreground.\n */\n permissionsLocationInsufficientForBackground = 'permissions.location.insufficientForBackground',\n\n /**\n * [iOS only] The user has not chosen whether the app can use location services.\n */\n permissionsLocationNotDetermined = 'permissions.location.notDetermined',\n\n /**\n * [iOS only] The app is in Provisional Always authorization state, which stops sending locations when app is in background.\n */\n permissionsLocationProvisional = 'permissions.location.provisional',\n\n /**\n * The user didn't grant precise location permissions or downgraded permissions to imprecise.\n */\n permissionsLocationReducedAccuracy = 'permissions.location.reducedAccuracy',\n\n /**\n * [iOS only] The app is not authorized to use location services.\n */\n permissionsLocationRestricted = 'permissions.location.restricted',\n\n /**\n * [Android only] The user denied notification permissions needed to display a persistent notification\n * needed for foreground location tracking.\n */\n permissionsNotificationsDenied = 'permissions.notifications.denied',\n}\n"],"mappings":";;;;;;AAAA;AACA;AAAA,IACYA,eAAe,0BAAfA,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;EAAA,OAAfA,eAAe;AAAA;AAAAC,OAAA,CAAAD,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"names":["HyperTrackError","exports"],"sources":["HyperTrackError.ts"],"sourcesContent":["// enum naming convention is ignored to make datatype sync\n// across platforms easier\nexport enum HyperTrackError {\n /**\n * The SDK was remotely blocked from running.\n */\n blockedFromRunning = 'blockedFromRunning',\n\n /**\n * The publishable key is invalid.\n */\n invalidPublishableKey = 'invalidPublishableKey',\n\n /**\n * The user enabled mock location app while mocking locations is prohibited.\n */\n locationMocked = 'location.mocked',\n\n /**\n * The user disabled location services systemwide.\n */\n locationServicesDisabled = 'location.servicesDisabled',\n\n /**\n * [Android only] The device doesn't have location services.\n */\n locationServicesUnavailable = 'location.servicesUnavailable',\n\n /**\n * GPS satellites are not in view.\n */\n locationSignalLost = 'location.signalLost',\n\n /**\n * [Android only] The SDK wasn't able to start tracking because of the limitations imposed by the OS.\n * The exempt from background execution conditions weren't met.\n * {@link https://developer.android.com/guide/components/foreground-services#background-start-restriction-exemptions}\n */\n noExemptionFromBackgroundStartRestrictions = 'noExemptionFromBackgroundStartRestrictions',\n\n /**\n * The user denied location permissions.\n */\n permissionsLocationDenied = 'permissions.location.denied',\n\n /**\n * Can’t start tracking in background with When In Use location permissions.\n * SDK will automatically start tracking when app will return to foreground.\n */\n permissionsLocationInsufficientForBackground = 'permissions.location.insufficientForBackground',\n\n /**\n * [iOS only] The user has not chosen whether the app can use location services.\n */\n permissionsLocationNotDetermined = 'permissions.location.notDetermined',\n\n /**\n * [iOS only] The app is in Provisional Always authorization state, which stops sending locations when app is in background.\n */\n permissionsLocationProvisional = 'permissions.location.provisional',\n\n /**\n * The user didn't grant precise location permissions or downgraded permissions to imprecise.\n */\n permissionsLocationReducedAccuracy = 'permissions.location.reducedAccuracy',\n\n /**\n * [iOS only] The app is not authorized to use location services.\n */\n permissionsLocationRestricted = 'permissions.location.restricted',\n\n /**\n * [Android only] The user denied notification permissions needed to display a persistent notification\n * needed for foreground location tracking.\n */\n permissionsNotificationsDenied = 'permissions.notifications.denied',\n}\n"],"mappings":";;;;;;AAAA;AACA;AAAA,IACYA,eAAe,GAAAC,OAAA,CAAAD,eAAA,0BAAfA,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;EAAA,OAAfA,eAAe;AAAA"}
@@ -78,6 +78,5 @@ var _LocationWithDeviation = require("./HyperTrack/data_types/LocationWithDeviat
78
78
  var _Location = require("./HyperTrack/data_types/Location");
79
79
  var _Result = require("./HyperTrack/data_types/Result");
80
80
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
81
- var _default = _HyperTrack.default;
82
- exports.default = _default;
81
+ var _default = exports.default = _HyperTrack.default;
83
82
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_HyperTrack","_interopRequireDefault","require","_HyperTrackError","_LocationErrorInternal","_LocationError","_LocationWithDeviation","_Location","_Result","obj","__esModule","default","_default","HyperTrack","exports"],"sources":["index.tsx"],"sourcesContent":["import HyperTrack from './HyperTrack/HyperTrack';\nexport default HyperTrack;\nexport { HyperTrack };\n\nexport { HyperTrackError } from './HyperTrack/data_types/HyperTrackError';\nexport {\n NotRunning,\n Starting,\n} from './HyperTrack/data_types/internal/LocationErrorInternal';\nexport { LocationError, Errors } from './HyperTrack/data_types/LocationError';\nexport { LocationWithDeviation } from './HyperTrack/data_types/LocationWithDeviation';\nexport { Location } from './HyperTrack/data_types/Location';\nexport { Result, Success, Failure } from './HyperTrack/data_types/Result';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAIA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAA0E,SAAAD,uBAAAQ,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,IAAAG,QAAA,GAX3DC,mBAAU;AAAAC,OAAA,CAAAH,OAAA,GAAAC,QAAA"}
1
+ {"version":3,"names":["_HyperTrack","_interopRequireDefault","require","_HyperTrackError","_LocationErrorInternal","_LocationError","_LocationWithDeviation","_Location","_Result","obj","__esModule","default","_default","exports","HyperTrack"],"sources":["index.tsx"],"sourcesContent":["import HyperTrack from './HyperTrack/HyperTrack';\nexport default HyperTrack;\nexport { HyperTrack };\n\nexport { HyperTrackError } from './HyperTrack/data_types/HyperTrackError';\nexport {\n NotRunning,\n Starting,\n} from './HyperTrack/data_types/internal/LocationErrorInternal';\nexport { LocationError, Errors } from './HyperTrack/data_types/LocationError';\nexport { LocationWithDeviation } from './HyperTrack/data_types/LocationWithDeviation';\nexport { Location } from './HyperTrack/data_types/Location';\nexport { Result, Success, Failure } from './HyperTrack/data_types/Result';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAIA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAA0E,SAAAD,uBAAAQ,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAX3DG,mBAAU"}
@@ -1,6 +1,6 @@
1
1
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
4
  import { NativeModules, Platform, NativeEventEmitter } from 'react-native';
5
5
  import { HyperTrackError } from './data_types/HyperTrackError';
6
6
  const EVENT_ERRORS = 'errors';
@@ -34,10 +34,7 @@ export default class HyperTrack {
34
34
  * @returns location with deviation if success or LocationError if failure
35
35
  */
36
36
 
37
- static async addGeotag() {
38
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
39
- args[_key] = arguments[_key];
40
- }
37
+ static async addGeotag(...args) {
41
38
  if (args.length === 1 && typeof args[0] === 'object') {
42
39
  return HyperTrackSdk.addGeotag({
43
40
  data: args[0],
@@ -145,7 +142,8 @@ export default class HyperTrack {
145
142
  *
146
143
  * @param callback
147
144
  * @returns EmitterSubscription
148
- * @example ```js
145
+ * @example
146
+ * ```js
149
147
  * const subscription = HyperTrack.locate(location => {
150
148
  * ...
151
149
  * })
@@ -156,7 +154,7 @@ export default class HyperTrack {
156
154
  */
157
155
  static locate(callback) {
158
156
  var _this$locateSubscript;
159
- (_this$locateSubscript = this.locateSubscription) === null || _this$locateSubscript === void 0 ? void 0 : _this$locateSubscript.remove();
157
+ (_this$locateSubscript = this.locateSubscription) === null || _this$locateSubscript === void 0 || _this$locateSubscript.remove();
160
158
  this.locateSubscription = EventEmitter.addListener(EVENT_LOCATE, location => {
161
159
  callback(this.deserializeLocateResponse(location));
162
160
  });
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","NativeEventEmitter","HyperTrackError","EVENT_ERRORS","EVENT_IS_AVAILABLE","EVENT_IS_TRACKING","EVENT_LOCATE","EVENT_LOCATION","LINKING_ERROR","select","ios","default","HyperTrackSdk","HyperTrackReactNativePlugin","Proxy","get","Error","EventEmitter","HyperTrack","addGeotag","_len","arguments","length","args","Array","_key","data","expectedLocation","undefined","then","locationResponse","deserializeLocationResponse","isLocation","type","value","latitude","longitude","deserializeLocationWithDeviationResponse","getDeviceId","deviceId","getErrors","errors","deserializeHyperTrackErrors","getIsAvailable","isAvailable","getIsTracking","isTracking","getLocation","getMetadata","metadata","deserializeMetadata","getName","name","deserializeName","locate","callback","_this$locateSubscript","locateSubscription","remove","addListener","location","deserializeLocateResponse","setIsAvailable","setIsTracking","setMetadata","setName","subscribeToErrors","listener","rawErrors","subscribeToIsAvailable","subscribeToIsTracking","subscribeToLocation","res","map","error","Object","keys","find","key","response","deserializeLocationError","locationError","locationWithDeviationInternal","locationInternal","deviation","JSON","stringify","obj","_defineProperty"],"sources":["HyperTrack.ts"],"sourcesContent":["import {\n NativeModules,\n Platform,\n NativeEventEmitter,\n EmitterSubscription,\n} from 'react-native';\nimport { HyperTrackError } from './data_types/HyperTrackError';\nimport type { IsAvailable } from './data_types/internal/IsAvailable';\nimport type { IsTracking } from './data_types/internal/IsTracking';\nimport type { Location } from './data_types/Location';\nimport type { LocationError } from './data_types/LocationError';\nimport type { DeviceId } from './data_types/internal/DeviceId';\nimport type { GeotagData } from './data_types/internal/GeotagData';\nimport type { Name } from './data_types/internal/Name';\nimport type { HyperTrackErrorInternal } from './data_types/internal/HyperTrackErrorInternal';\nimport type { LocationWithDeviation } from './data_types/LocationWithDeviation';\nimport type { LocationErrorInternal } from './data_types/internal/LocationErrorInternal';\nimport type { Result } from './data_types/Result';\nimport type { LocationInternal } from './data_types/internal/LocationInternal';\nimport type { LocationWithDeviationInternal } from './data_types/internal/LocationWithDeviationInternal';\nimport type { Metadata } from './data_types/internal/Metadata';\n\nconst EVENT_ERRORS = 'errors';\nconst EVENT_IS_AVAILABLE = 'isAvailable';\nconst EVENT_IS_TRACKING = 'isTracking';\nconst EVENT_LOCATE = 'locate';\nconst EVENT_LOCATION = 'location';\n\nconst LINKING_ERROR =\n `The package 'hypertrack-sdk-react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst HyperTrackSdk = NativeModules.HyperTrackReactNativePlugin\n ? NativeModules.HyperTrackReactNativePlugin\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nconst EventEmitter = new NativeEventEmitter(HyperTrackSdk);\n\nexport default class HyperTrack {\n private static locateSubscription: EmitterSubscription | undefined;\n\n /**\n * Adds a new geotag\n *\n * @param {Object} data - Geotad data JSON\n * @returns current location if success or LocationError if failure\n */\n static async addGeotag(\n data: Object\n ): Promise<Result<Location, LocationError>>;\n\n /**\n * Adds a new geotag with expected location\n *\n * @param {Object} data - Geotad data JSON\n * @param {Location} expectedLocation - Expected location\n * @returns location with deviation if success or LocationError if failure\n */\n static async addGeotag(\n data: Object,\n expectedLocation: Location\n ): Promise<Result<LocationWithDeviation, LocationError>>;\n\n static async addGeotag(\n ...args: any[]\n ): Promise<Result<Location | LocationWithDeviation, LocationError>> {\n if (args.length === 1 && typeof args[0] === 'object') {\n return HyperTrackSdk.addGeotag({\n data: args[0],\n expectedLocation: undefined,\n } as GeotagData).then(\n (locationResponse: Result<LocationInternal, LocationErrorInternal>) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n } else if (\n args.length === 2 &&\n typeof args[0] === 'object' &&\n HyperTrack.isLocation(args[1])\n ) {\n let expectedLocation = args[1] as Location;\n return HyperTrackSdk.addGeotag({\n data: args[0],\n expectedLocation: {\n type: 'location',\n value: {\n latitude: expectedLocation.latitude,\n longitude: expectedLocation.longitude,\n },\n } as LocationInternal,\n } as GeotagData).then(\n (\n locationResponse: Result<\n LocationWithDeviationInternal,\n LocationErrorInternal\n >\n ) => {\n return this.deserializeLocationWithDeviationResponse(\n locationResponse\n );\n }\n );\n } else {\n throw new Error('Invalid arguments');\n }\n }\n\n /**\n * Returns a string that is used to uniquely identify the device\n *\n * @returns {string} Device ID\n */\n static async getDeviceId(): Promise<string> {\n return HyperTrackSdk.getDeviceId().then(\n (deviceId: DeviceId) => deviceId.value\n );\n }\n\n /**\n * Returns a list of errors that blocks SDK from tracking\n *\n * @returns {HyperTrackError[]} List of errors\n */\n static async getErrors(): Promise<HyperTrackError[]> {\n return HyperTrackSdk.getErrors().then(\n (errors: HyperTrackErrorInternal[]) => {\n return this.deserializeHyperTrackErrors(errors);\n }\n );\n }\n\n /**\n * Reflects availability of the device for the Nearby search\n *\n * @returns true when is available or false when unavailable\n */\n static async getIsAvailable(): Promise<boolean> {\n return HyperTrackSdk.getIsAvailable().then(\n (isAvailable: IsAvailable) => isAvailable.value\n );\n }\n\n /**\n * Reflects the tracking intent for the device\n *\n * @returns {boolean} Whether the user's movement data is getting tracked or not.\n */\n static async getIsTracking(): Promise<boolean> {\n return HyperTrackSdk.getIsTracking().then(\n (isTracking: IsTracking) => isTracking.value\n );\n }\n\n /**\n * Reflects the current location of the user or an outage reason\n */\n static async getLocation(): Promise<Result<Location, LocationError>> {\n return HyperTrackSdk.getLocation().then(\n (locationResponse: Result<LocationInternal, LocationErrorInternal>) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n }\n\n /**\n * Gets the metadata that is set for the device\n *\n * @returns {Object} Metadata JSON\n */\n static async getMetadata(): Promise<Object> {\n return HyperTrackSdk.getMetadata().then((metadata: Metadata) => {\n return this.deserializeMetadata(metadata);\n });\n }\n\n /**\n * Gets the name that is set for the device\n *\n * @returns {string} Device name\n */\n static async getName(): Promise<string> {\n return HyperTrackSdk.getName().then((name: Name) => {\n return this.deserializeName(name);\n });\n }\n\n /**\n * Requests one-time location update and returns the location once it is available, or error.\n *\n * Only one locate subscription can be active at a time. If you re-subscribe, the old EmitterSubscription\n * will be automaticaly removed.\n *\n * This method will start location tracking if called, and will stop it when the location is received or\n * the subscription is cancelled. If any other tracking intent is present (e.g. isAvailable is set to `true`),\n * the tracking will not be stopped.\n *\n * @param callback\n * @returns EmitterSubscription\n * @example ```js\n * const subscription = HyperTrack.locate(location => {\n * ...\n * })\n *\n * // to unsubscribe\n * subscription.remove()\n * ```\n */\n static locate(\n callback: (location: Result<Location, HyperTrackError[]>) => void\n ) {\n this.locateSubscription?.remove();\n this.locateSubscription = EventEmitter.addListener(\n EVENT_LOCATE,\n (location: Result<LocationInternal, HyperTrackErrorInternal[]>) => {\n callback(this.deserializeLocateResponse(location));\n }\n );\n HyperTrackSdk.locate();\n return this.locateSubscription;\n }\n\n /**\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 static async setIsAvailable(isAvailable: boolean) {\n HyperTrackSdk.setIsAvailable({\n type: 'isAvailable',\n value: isAvailable,\n } as IsAvailable);\n }\n\n /**\n * Sets the tracking intent for the device\n *\n * @param {boolean} isTracking\n */\n static async setIsTracking(isTracking: boolean): Promise<void> {\n HyperTrackSdk.setIsTracking({\n type: 'isTracking',\n value: isTracking,\n } as IsTracking);\n }\n\n /**\n * Sets the metadata for the device\n *\n * @param {Object} data - Metadata JSON\n */\n static async setMetadata(data: Object) {\n HyperTrackSdk.setMetadata({\n type: 'metadata',\n value: data,\n });\n }\n\n /**\n * Sets the name for the device\n *\n * @param {string} name\n */\n static async setName(name: string) {\n HyperTrackSdk.setName({\n type: 'name',\n value: name,\n } as Name);\n }\n\n /**\n * Subscribe to tracking errors\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToErrors(errors => {\n * errors.forEach(error => {\n * // ... error\n * })\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToErrors(\n listener: (errors: HyperTrackError[]) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_ERRORS,\n (rawErrors: HyperTrackErrorInternal[]) => {\n listener(this.deserializeHyperTrackErrors(rawErrors));\n }\n );\n }\n\n /**\n * Subscribe to availability changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToIsAvailable(isAvailable => {\n * if (isAvailable) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToIsAvailable(\n listener: (isAvailable: boolean) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_IS_AVAILABLE,\n (isAvailable: IsAvailable) => {\n listener(isAvailable.value);\n }\n );\n }\n\n /**\n * Subscribe to tracking intent changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToIsTracking(isTracking => {\n * if (isTracking) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToIsTracking(\n listener: (isTracking: boolean) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_IS_TRACKING,\n (isTracking: IsTracking) => {\n listener(isTracking.value);\n }\n );\n }\n\n /**\n * Subscribe to location changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToLocation(location => {\n * ...\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToLocation(\n listener: (location: Result<Location, LocationError>) => void\n ) {\n return EventEmitter.addListener(\n EVENT_LOCATION,\n (location: Result<LocationInternal, LocationErrorInternal>) => {\n listener(this.deserializeLocationResponse(location));\n }\n );\n }\n\n /** @ignore */\n private static deserializeHyperTrackErrors(\n errors: HyperTrackErrorInternal[]\n ): HyperTrackError[] {\n let res = errors.map((error: HyperTrackErrorInternal) => {\n if (error.type != 'error') {\n throw new Error('Invalid error type');\n }\n return Object.keys(HyperTrackError).find(\n (key) =>\n HyperTrackError[key as keyof typeof HyperTrackError] === error.value\n ) as HyperTrackError;\n });\n return res;\n }\n\n /** @ignore */\n private static deserializeLocateResponse(\n response: Result<LocationInternal, HyperTrackErrorInternal[]>\n ): Result<Location, HyperTrackError[]> {\n switch (response.type) {\n case 'success':\n return {\n type: 'success',\n value: response.value.value,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeHyperTrackErrors(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationError(\n locationError: LocationErrorInternal\n ): LocationError {\n switch (locationError.type) {\n case 'notRunning':\n case 'starting':\n return locationError;\n case 'errors':\n return {\n type: 'errors',\n value: this.deserializeHyperTrackErrors(locationError.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationResponse(\n response: Result<LocationInternal, LocationErrorInternal>\n ): Result<Location, LocationError> {\n switch (response.type) {\n case 'success':\n return {\n type: 'success',\n value: response.value.value,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeLocationError(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationWithDeviationResponse(\n response: Result<LocationWithDeviationInternal, LocationErrorInternal>\n ): Result<LocationWithDeviation, LocationError> {\n switch (response.type) {\n case 'success':\n const locationWithDeviationInternal: LocationWithDeviationInternal =\n response.value;\n const locationInternal: LocationInternal =\n locationWithDeviationInternal.value.location;\n\n return {\n type: 'success',\n value: {\n location: locationInternal.value,\n deviation: locationWithDeviationInternal.value.deviation,\n } as LocationWithDeviation,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeLocationError(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeMetadata(metadata: Metadata): Object {\n if (metadata.type != 'metadata') {\n throw new Error(`Invalid metadata: ${JSON.stringify(metadata)}`);\n }\n return metadata.value;\n }\n\n /** @ignore */\n private static deserializeName(name: Name): string {\n if (name.type != 'name') {\n throw new Error(`Invalid name: ${JSON.stringify(name)}`);\n }\n return name.value;\n }\n\n /** @ignore */\n private static isLocation(obj: Location): obj is Location {\n return (\n 'latitude' in obj &&\n typeof obj.latitude == 'number' &&\n 'longitude' in obj &&\n typeof obj.longitude == 'number'\n );\n }\n}\n"],"mappings":";;;AAAA,SACEA,aAAa,EACbC,QAAQ,EACRC,kBAAkB,QAEb,cAAc;AACrB,SAASC,eAAe,QAAQ,8BAA8B;AAgB9D,MAAMC,YAAY,GAAG,QAAQ;AAC7B,MAAMC,kBAAkB,GAAG,aAAa;AACxC,MAAMC,iBAAiB,GAAG,YAAY;AACtC,MAAMC,YAAY,GAAG,QAAQ;AAC7B,MAAMC,cAAc,GAAG,UAAU;AAEjC,MAAMC,aAAa,GAChB,sFAAqF,GACtFR,QAAQ,CAACS,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAA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C;IAClE;IACA,OAAOA,QAAQ,CAACf,KAAK;EACvB;;EAEA;EACA,OAAemB,eAAeA,CAACD,IAAU,EAAU;IACjD,IAAIA,IAAI,CAACnB,IAAI,IAAI,MAAM,EAAE;MACvB,MAAM,IAAIjB,KAAK,CAAE,iBAAgBqE,IAAI,CAACC,SAAS,CAAClC,IAAI,CAAE,EAAC,CAAC;IAC1D;IACA,OAAOA,IAAI,CAAClB,KAAK;EACnB;;EAEA;EACA,OAAeF,UAAUA,CAACuD,GAAa,EAAmB;IACxD,OACE,UAAU,IAAIA,GAAG,IACjB,OAAOA,GAAG,CAACpD,QAAQ,IAAI,QAAQ,IAC/B,WAAW,IAAIoD,GAAG,IAClB,OAAOA,GAAG,CAACnD,SAAS,IAAI,QAAQ;EAEpC;AACF;AAACoD,eAAA,CA5coBtE,UAAU"}
1
+ {"version":3,"names":["NativeModules","Platform","NativeEventEmitter","HyperTrackError","EVENT_ERRORS","EVENT_IS_AVAILABLE","EVENT_IS_TRACKING","EVENT_LOCATE","EVENT_LOCATION","LINKING_ERROR","select","ios","default","HyperTrackSdk","HyperTrackReactNativePlugin","Proxy","get","Error","EventEmitter","HyperTrack","addGeotag","args","length","data","expectedLocation","undefined","then","locationResponse","deserializeLocationResponse","isLocation","type","value","latitude","longitude","deserializeLocationWithDeviationResponse","getDeviceId","deviceId","getErrors","errors","deserializeHyperTrackErrors","getIsAvailable","isAvailable","getIsTracking","isTracking","getLocation","getMetadata","metadata","deserializeMetadata","getName","name","deserializeName","locate","callback","_this$locateSubscript","locateSubscription","remove","addListener","location","deserializeLocateResponse","setIsAvailable","setIsTracking","setMetadata","setName","subscribeToErrors","listener","rawErrors","subscribeToIsAvailable","subscribeToIsTracking","subscribeToLocation","res","map","error","Object","keys","find","key","response","deserializeLocationError","locationError","locationWithDeviationInternal","locationInternal","deviation","JSON","stringify","obj","_defineProperty"],"sources":["HyperTrack.ts"],"sourcesContent":["import {\n NativeModules,\n Platform,\n NativeEventEmitter,\n EmitterSubscription,\n} from 'react-native';\nimport { HyperTrackError } from './data_types/HyperTrackError';\nimport type { IsAvailable } from './data_types/internal/IsAvailable';\nimport type { IsTracking } from './data_types/internal/IsTracking';\nimport type { Location } from './data_types/Location';\nimport type { LocationError } from './data_types/LocationError';\nimport type { DeviceId } from './data_types/internal/DeviceId';\nimport type { GeotagData } from './data_types/internal/GeotagData';\nimport type { Name } from './data_types/internal/Name';\nimport type { HyperTrackErrorInternal } from './data_types/internal/HyperTrackErrorInternal';\nimport type { LocationWithDeviation } from './data_types/LocationWithDeviation';\nimport type { LocationErrorInternal } from './data_types/internal/LocationErrorInternal';\nimport type { Result } from './data_types/Result';\nimport type { LocationInternal } from './data_types/internal/LocationInternal';\nimport type { LocationWithDeviationInternal } from './data_types/internal/LocationWithDeviationInternal';\nimport type { Metadata } from './data_types/internal/Metadata';\n\nconst EVENT_ERRORS = 'errors';\nconst EVENT_IS_AVAILABLE = 'isAvailable';\nconst EVENT_IS_TRACKING = 'isTracking';\nconst EVENT_LOCATE = 'locate';\nconst EVENT_LOCATION = 'location';\n\nconst LINKING_ERROR =\n `The package 'hypertrack-sdk-react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst HyperTrackSdk = NativeModules.HyperTrackReactNativePlugin\n ? NativeModules.HyperTrackReactNativePlugin\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nconst EventEmitter = new NativeEventEmitter(HyperTrackSdk);\n\nexport default class HyperTrack {\n private static locateSubscription: EmitterSubscription | undefined;\n\n /**\n * Adds a new geotag\n *\n * @param {Object} data - Geotad data JSON\n * @returns current location if success or LocationError if failure\n */\n static async addGeotag(\n data: Object\n ): Promise<Result<Location, LocationError>>;\n\n /**\n * Adds a new geotag with expected location\n *\n * @param {Object} data - Geotad data JSON\n * @param {Location} expectedLocation - Expected location\n * @returns location with deviation if success or LocationError if failure\n */\n static async addGeotag(\n data: Object,\n expectedLocation: Location\n ): Promise<Result<LocationWithDeviation, LocationError>>;\n\n static async addGeotag(\n ...args: any[]\n ): Promise<Result<Location | LocationWithDeviation, LocationError>> {\n if (args.length === 1 && typeof args[0] === 'object') {\n return HyperTrackSdk.addGeotag({\n data: args[0],\n expectedLocation: undefined,\n } as GeotagData).then(\n (locationResponse: Result<LocationInternal, LocationErrorInternal>) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n } else if (\n args.length === 2 &&\n typeof args[0] === 'object' &&\n HyperTrack.isLocation(args[1])\n ) {\n let expectedLocation = args[1] as Location;\n return HyperTrackSdk.addGeotag({\n data: args[0],\n expectedLocation: {\n type: 'location',\n value: {\n latitude: expectedLocation.latitude,\n longitude: expectedLocation.longitude,\n },\n } as LocationInternal,\n } as GeotagData).then(\n (\n locationResponse: Result<\n LocationWithDeviationInternal,\n LocationErrorInternal\n >\n ) => {\n return this.deserializeLocationWithDeviationResponse(\n locationResponse\n );\n }\n );\n } else {\n throw new Error('Invalid arguments');\n }\n }\n\n /**\n * Returns a string that is used to uniquely identify the device\n *\n * @returns {string} Device ID\n */\n static async getDeviceId(): Promise<string> {\n return HyperTrackSdk.getDeviceId().then(\n (deviceId: DeviceId) => deviceId.value\n );\n }\n\n /**\n * Returns a list of errors that blocks SDK from tracking\n *\n * @returns {HyperTrackError[]} List of errors\n */\n static async getErrors(): Promise<HyperTrackError[]> {\n return HyperTrackSdk.getErrors().then(\n (errors: HyperTrackErrorInternal[]) => {\n return this.deserializeHyperTrackErrors(errors);\n }\n );\n }\n\n /**\n * Reflects availability of the device for the Nearby search\n *\n * @returns true when is available or false when unavailable\n */\n static async getIsAvailable(): Promise<boolean> {\n return HyperTrackSdk.getIsAvailable().then(\n (isAvailable: IsAvailable) => isAvailable.value\n );\n }\n\n /**\n * Reflects the tracking intent for the device\n *\n * @returns {boolean} Whether the user's movement data is getting tracked or not.\n */\n static async getIsTracking(): Promise<boolean> {\n return HyperTrackSdk.getIsTracking().then(\n (isTracking: IsTracking) => isTracking.value\n );\n }\n\n /**\n * Reflects the current location of the user or an outage reason\n */\n static async getLocation(): Promise<Result<Location, LocationError>> {\n return HyperTrackSdk.getLocation().then(\n (locationResponse: Result<LocationInternal, LocationErrorInternal>) => {\n return this.deserializeLocationResponse(locationResponse);\n }\n );\n }\n\n /**\n * Gets the metadata that is set for the device\n *\n * @returns {Object} Metadata JSON\n */\n static async getMetadata(): Promise<Object> {\n return HyperTrackSdk.getMetadata().then((metadata: Metadata) => {\n return this.deserializeMetadata(metadata);\n });\n }\n\n /**\n * Gets the name that is set for the device\n *\n * @returns {string} Device name\n */\n static async getName(): Promise<string> {\n return HyperTrackSdk.getName().then((name: Name) => {\n return this.deserializeName(name);\n });\n }\n\n /**\n * Requests one-time location update and returns the location once it is available, or error.\n *\n * Only one locate subscription can be active at a time. If you re-subscribe, the old EmitterSubscription\n * will be automaticaly removed.\n *\n * This method will start location tracking if called, and will stop it when the location is received or\n * the subscription is cancelled. If any other tracking intent is present (e.g. isAvailable is set to `true`),\n * the tracking will not be stopped.\n *\n * @param callback\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.locate(location => {\n * ...\n * })\n *\n * // to unsubscribe\n * subscription.remove()\n * ```\n */\n static locate(\n callback: (location: Result<Location, HyperTrackError[]>) => void\n ) {\n this.locateSubscription?.remove();\n this.locateSubscription = EventEmitter.addListener(\n EVENT_LOCATE,\n (location: Result<LocationInternal, HyperTrackErrorInternal[]>) => {\n callback(this.deserializeLocateResponse(location));\n }\n );\n HyperTrackSdk.locate();\n return this.locateSubscription;\n }\n\n /**\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 static async setIsAvailable(isAvailable: boolean) {\n HyperTrackSdk.setIsAvailable({\n type: 'isAvailable',\n value: isAvailable,\n } as IsAvailable);\n }\n\n /**\n * Sets the tracking intent for the device\n *\n * @param {boolean} isTracking\n */\n static async setIsTracking(isTracking: boolean): Promise<void> {\n HyperTrackSdk.setIsTracking({\n type: 'isTracking',\n value: isTracking,\n } as IsTracking);\n }\n\n /**\n * Sets the metadata for the device\n *\n * @param {Object} data - Metadata JSON\n */\n static async setMetadata(data: Object) {\n HyperTrackSdk.setMetadata({\n type: 'metadata',\n value: data,\n });\n }\n\n /**\n * Sets the name for the device\n *\n * @param {string} name\n */\n static async setName(name: string) {\n HyperTrackSdk.setName({\n type: 'name',\n value: name,\n } as Name);\n }\n\n /**\n * Subscribe to tracking errors\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToErrors(errors => {\n * errors.forEach(error => {\n * // ... error\n * })\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToErrors(\n listener: (errors: HyperTrackError[]) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_ERRORS,\n (rawErrors: HyperTrackErrorInternal[]) => {\n listener(this.deserializeHyperTrackErrors(rawErrors));\n }\n );\n }\n\n /**\n * Subscribe to availability changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToIsAvailable(isAvailable => {\n * if (isAvailable) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToIsAvailable(\n listener: (isAvailable: boolean) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_IS_AVAILABLE,\n (isAvailable: IsAvailable) => {\n listener(isAvailable.value);\n }\n );\n }\n\n /**\n * Subscribe to tracking intent changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToIsTracking(isTracking => {\n * if (isTracking) {\n * // ... ready to go\n * }\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToIsTracking(\n listener: (isTracking: boolean) => void\n ): EmitterSubscription {\n return EventEmitter.addListener(\n EVENT_IS_TRACKING,\n (isTracking: IsTracking) => {\n listener(isTracking.value);\n }\n );\n }\n\n /**\n * Subscribe to location changes\n *\n * @param listener\n * @returns EmitterSubscription\n * @example\n * ```js\n * const subscription = HyperTrack.subscribeToLocation(location => {\n * ...\n * })\n *\n * // later, to stop listening\n * subscription.remove()\n * ```\n */\n static subscribeToLocation(\n listener: (location: Result<Location, LocationError>) => void\n ) {\n return EventEmitter.addListener(\n EVENT_LOCATION,\n (location: Result<LocationInternal, LocationErrorInternal>) => {\n listener(this.deserializeLocationResponse(location));\n }\n );\n }\n\n /** @ignore */\n private static deserializeHyperTrackErrors(\n errors: HyperTrackErrorInternal[]\n ): HyperTrackError[] {\n let res = errors.map((error: HyperTrackErrorInternal) => {\n if (error.type != 'error') {\n throw new Error('Invalid error type');\n }\n return Object.keys(HyperTrackError).find(\n (key) =>\n HyperTrackError[key as keyof typeof HyperTrackError] === error.value\n ) as HyperTrackError;\n });\n return res;\n }\n\n /** @ignore */\n private static deserializeLocateResponse(\n response: Result<LocationInternal, HyperTrackErrorInternal[]>\n ): Result<Location, HyperTrackError[]> {\n switch (response.type) {\n case 'success':\n return {\n type: 'success',\n value: response.value.value,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeHyperTrackErrors(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationError(\n locationError: LocationErrorInternal\n ): LocationError {\n switch (locationError.type) {\n case 'notRunning':\n case 'starting':\n return locationError;\n case 'errors':\n return {\n type: 'errors',\n value: this.deserializeHyperTrackErrors(locationError.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationResponse(\n response: Result<LocationInternal, LocationErrorInternal>\n ): Result<Location, LocationError> {\n switch (response.type) {\n case 'success':\n return {\n type: 'success',\n value: response.value.value,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeLocationError(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeLocationWithDeviationResponse(\n response: Result<LocationWithDeviationInternal, LocationErrorInternal>\n ): Result<LocationWithDeviation, LocationError> {\n switch (response.type) {\n case 'success':\n const locationWithDeviationInternal: LocationWithDeviationInternal =\n response.value;\n const locationInternal: LocationInternal =\n locationWithDeviationInternal.value.location;\n\n return {\n type: 'success',\n value: {\n location: locationInternal.value,\n deviation: locationWithDeviationInternal.value.deviation,\n } as LocationWithDeviation,\n };\n case 'failure':\n return {\n type: 'failure',\n value: this.deserializeLocationError(response.value),\n };\n }\n }\n\n /** @ignore */\n private static deserializeMetadata(metadata: Metadata): Object {\n if (metadata.type != 'metadata') {\n throw new Error(`Invalid metadata: ${JSON.stringify(metadata)}`);\n }\n return metadata.value;\n }\n\n /** @ignore */\n private static deserializeName(name: Name): string {\n if (name.type != 'name') {\n throw new Error(`Invalid name: ${JSON.stringify(name)}`);\n }\n return name.value;\n }\n\n /** @ignore */\n private static isLocation(obj: Location): obj is Location {\n return (\n 'latitude' in obj &&\n typeof obj.latitude == 'number' &&\n 'longitude' in obj &&\n typeof obj.longitude == 'number'\n );\n }\n}\n"],"mappings":";;;AAAA,SACEA,aAAa,EACbC,QAAQ,EACRC,kBAAkB,QAEb,cAAc;AACrB,SAASC,eAAe,QAAQ,8BAA8B;AAgB9D,MAAMC,YAAY,GAAG,QAAQ;AAC7B,MAAMC,kBAAkB,GAAG,aAAa;AACxC,MAAMC,iBAAiB,GAAG,YAAY;AACtC,MAAMC,YAAY,GAAG,QAAQ;AAC7B,MAAMC,cAAc,GAAG,UAAU;AAEjC,MAAMC,aAAa,GAChB,sFAAqF,GACtFR,QAAQ,CAACS,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAE/C,MAAMC,aAAa,GAAGb,aAAa,CAACc,2BAA2B,GAC3Dd,aAAa,CAACc,2BAA2B,GACzC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACR,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,WAAW,IAAIoD,GAAG,IAClB,OAAOA,GAAG,CAACnD,SAAS,IAAI,QAAQ;EAEpC;AACF;AAACoD,eAAA,CA7coBlE,UAAU"}
@@ -73,7 +73,8 @@ export default class HyperTrack {
73
73
  *
74
74
  * @param callback
75
75
  * @returns EmitterSubscription
76
- * @example ```js
76
+ * @example
77
+ * ```js
77
78
  * const subscription = HyperTrack.locate(location => {
78
79
  * ...
79
80
  * })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypertrack-sdk-react-native",
3
- "version": "11.0.10",
3
+ "version": "12.0.0",
4
4
  "description": "React Native HyperTrack SDK is a wrapper around native iOS and Android SDKs that allows to integrate HyperTrack into React Native apps.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -31,7 +31,7 @@
31
31
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
32
32
  "prepare": "bob build",
33
33
  "release": "release-it",
34
- "docs": "typedoc --options typedoc.json",
34
+ "docs": "typedoc --options typedoc.json -out ../docs",
35
35
  "bootstrap": "yarn && yarn docs"
36
36
  },
37
37
  "keywords": [
@@ -42,7 +42,11 @@
42
42
  "location",
43
43
  "tracking"
44
44
  ],
45
- "repository": "https://github.com/hypertrack/sdk-react-native",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/hypertrack/sdk-react-native.git",
48
+ "directory": "sdk"
49
+ },
46
50
  "author": "HyperTrack <help@hypertrack.com> (https://hypertrack.com)",
47
51
  "license": "MIT",
48
52
  "bugs": {
@@ -74,9 +78,9 @@
74
78
  "react-native": "^0.70.0",
75
79
  "react-native-builder-bob": "^0.18.3",
76
80
  "release-it": "^15.4.1",
77
- "typedoc": "^0.23.14",
78
- "typedoc-plugin-merge-modules": "^4.0.0",
79
- "typedoc-plugin-rename-defaults": "^0.6.1",
81
+ "typedoc": "^0.25.4",
82
+ "typedoc-plugin-merge-modules": "^5.1.0",
83
+ "typedoc-plugin-rename-defaults": "^0.7.0",
80
84
  "typescript": "^4.5.2"
81
85
  },
82
86
  "resolutions": {
@@ -205,7 +205,8 @@ export default class HyperTrack {
205
205
  *
206
206
  * @param callback
207
207
  * @returns EmitterSubscription
208
- * @example ```js
208
+ * @example
209
+ * ```js
209
210
  * const subscription = HyperTrack.locate(location => {
210
211
  * ...
211
212
  * })