hypertrack-sdk-react-native 9.2.0 → 9.2.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4
4
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [9.2.2] - 2023-06-01
7
+
8
+ ### Changed
9
+
10
+ - Updated HyperTrack iOS SDK to 4.16.0
11
+
12
+ ## [9.2.1] - 2023-05-19
13
+
14
+ ### Fixed
15
+
16
+ - Fixed `addGeotag` (with expected location) return type
17
+
6
18
  ## [9.2.0] - 2023-05-18
7
19
 
8
20
  ### Added
@@ -11,7 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
23
 
12
24
  ### Changed
13
25
 
14
- - HyperTrack iOS SDK updated to 5.15.0
26
+ - HyperTrack iOS SDK updated to 4.15.0
15
27
 
16
28
  ## [9.1.1] - 2023-03-30
17
29
 
@@ -489,6 +501,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
489
501
 
490
502
  Initial release.
491
503
 
504
+ [9.2.2]: https://github.com/hypertrack/sdk-react-native/releases/tag/9.2.2
505
+ [9.2.1]: https://github.com/hypertrack/sdk-react-native/releases/tag/9.2.1
506
+ [9.2.0]: https://github.com/hypertrack/sdk-react-native/releases/tag/9.2.0
507
+ [9.1.1]: https://github.com/hypertrack/sdk-react-native/releases/tag/9.1.1
508
+ [9.1.0]: https://github.com/hypertrack/sdk-react-native/releases/tag/9.1.0
509
+ [9.0.0]: https://github.com/hypertrack/sdk-react-native/releases/tag/9.0.0
492
510
  [8.2.2]: https://github.com/hypertrack/sdk-react-native/releases/tag/8.2.2
493
511
  [8.2.1]: https://github.com/hypertrack/sdk-react-native/releases/tag/8.2.1
494
512
  [8.2.0]: https://github.com/hypertrack/sdk-react-native/releases/tag/8.2.0
package/CONTRIBUTING.md CHANGED
@@ -5,6 +5,7 @@
5
5
  ### How to update the HyperTrack SDK version and make a release?
6
6
 
7
7
  1. Update SDK version constant
8
+
8
9
  - android
9
10
  - android/gradle.properties - HyperTrackSdk_HyperTrackSDKVersion
10
11
  - ios
@@ -12,18 +13,21 @@
12
13
  - s.dependency 'HyperTrack/Objective-C', '**version**'
13
14
 
14
15
  2. Increment wrapper version
15
-
16
+
16
17
  - package.json
17
18
  - version
18
-
19
+
19
20
  3. Update CHANGELOG.md
21
+
22
+ - Add the release link to the bottom
23
+
20
24
  4. Update badge in README.md
21
25
  5. Do the release dry run with `just release` and verify that the release is correct (checklist is in the command output)
22
26
  6. Commit and merge to master
23
27
  7. Create and push a new version tag
24
- 8. Run `npm publish` to publish the package to npm
25
- 9. Create a Github repo release
28
+ 8. Create a Github repo release
26
29
  - Release title should be the current version tag
30
+ 9. Run `npm publish` to publish the package to npm
27
31
 
28
32
  ### How to change build config
29
33
 
@@ -71,4 +75,3 @@ When you're sending a pull request:
71
75
  - Review the documentation to make sure it looks good.
72
76
  - Follow the pull request template when opening a pull request.
73
77
  - For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
74
-
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ![GitHub](https://img.shields.io/github/license/hypertrack/sdk-react-native.svg)
4
4
  ![npm](https://img.shields.io/npm/v/hypertrack-sdk-react-native.svg)
5
- ![iOS SDK](https://img.shields.io/badge/iOS%20SDK-4.15.0-brightgreen.svg)
5
+ ![iOS SDK](https://img.shields.io/badge/iOS%20SDK-4.16.0-brightgreen.svg)
6
6
  ![Android SDK](https://img.shields.io/badge/Android%20SDK-6.4.0-brightgreen.svg)
7
7
 
8
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.
@@ -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/Objective-C', '4.15.0'
21
+ s.dependency 'HyperTrack/Objective-C', '4.16.0'
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
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_HyperTrackError","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","arguments","length","undefined","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","_len","args","Array","_key","expectedLocation","isLocation","latitude","longitude","deserializeLocationWithDeviationResponse","subscribeToErrors","listener","addListener","rawErrors","deserializeHyperTrackErrors","subscribeToTracking","subscribeToAvailability","errors","map","HyperTrackError","response","deserializeLocationError","locationWithDeviationInternal","locationInternal","location","deviation","locationError","obj","exports"],"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 { 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 { GeotagData } from './data_types/internal/GeotagData';\nimport type { DeviceName } from './data_types/internal/DeviceName';\nimport type { HyperTrackErrorInternal } from './data_types/internal/HyperTrackErrorInternal';\nimport type { Result } from './data_types/Result';\nimport type { LocationWithDeviation } from './data_types/LocationWithDeviation';\nimport type { LocationErrorInternal } from './data_types/internal/LocationErrorInternal';\nimport type { LocationInternal } from './data_types/internal/LocationInternal';\nimport type { LocationWithDeviationInternal } from './data_types/internal/LocationWithDeviationInternal';\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:\n sdkInitParams.requireBackgroundTrackingPermission ?? false,\n automaticallyRequestPermissions:\n 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: Result<LocationInternal, LocationErrorInternal>) => {\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 *\n * @param {Object} data - Geotad data JSON\n * @returns current location if success or LocationError if failure\n */\n async addGeotag(data: Object): 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 async addGeotag(\n data: Object,\n expectedLocation: Location\n ): Promise<Result<Location, LocationError>>;\n\n 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 this.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 * 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(\n EVENT_ERROR,\n (rawErrors: HyperTrackErrorInternal[]) => {\n listener(this.deserializeHyperTrackErrors(rawErrors));\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.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(\n errors: HyperTrackErrorInternal[]\n ): HyperTrackError[] {\n return errors.map(\n (error: HyperTrackErrorInternal) =>\n HyperTrackError[error.value as keyof typeof HyperTrackError]\n );\n }\n\n /** @ignore */\n private 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 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 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 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;AACA,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B,GAAG,IAClB,OAAOA,GAAG,CAACnB,SAAS,IAAI,QAAQ;EAEpC;AACF;AAACoB,OAAA,CAAAtE,OAAA,GAAAS,UAAA"}
1
+ {"version":3,"names":["_reactNative","require","_HyperTrackError","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","arguments","length","undefined","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","_len","args","Array","_key","expectedLocation","isLocation","latitude","longitude","deserializeLocationWithDeviationResponse","subscribeToErrors","listener","addListener","rawErrors","deserializeHyperTrackErrors","subscribeToTracking","subscribeToAvailability","errors","map","HyperTrackError","response","deserializeLocationError","locationWithDeviationInternal","locationInternal","location","deviation","locationError","obj","exports"],"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 { 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 { GeotagData } from './data_types/internal/GeotagData';\nimport type { DeviceName } from './data_types/internal/DeviceName';\nimport type { HyperTrackErrorInternal } from './data_types/internal/HyperTrackErrorInternal';\nimport type { Result } from './data_types/Result';\nimport type { LocationWithDeviation } from './data_types/LocationWithDeviation';\nimport type { LocationErrorInternal } from './data_types/internal/LocationErrorInternal';\nimport type { LocationInternal } from './data_types/internal/LocationInternal';\nimport type { LocationWithDeviationInternal } from './data_types/internal/LocationWithDeviationInternal';\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:\n sdkInitParams.requireBackgroundTrackingPermission ?? false,\n automaticallyRequestPermissions:\n 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: Result<LocationInternal, LocationErrorInternal>) => {\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 *\n * @param {Object} data - Geotad data JSON\n * @returns current location if success or LocationError if failure\n */\n async addGeotag(data: Object): 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 async addGeotag(\n data: Object,\n expectedLocation: Location\n ): Promise<Result<LocationWithDeviation, LocationError>>;\n\n 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 this.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 * 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(\n EVENT_ERROR,\n (rawErrors: HyperTrackErrorInternal[]) => {\n listener(this.deserializeHyperTrackErrors(rawErrors));\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.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(\n errors: HyperTrackErrorInternal[]\n ): HyperTrackError[] {\n return errors.map(\n (error: HyperTrackErrorInternal) =>\n HyperTrackError[error.value as keyof typeof HyperTrackError]\n );\n }\n\n /** @ignore */\n private 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 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 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 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;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAgBA,MAAME,cAAc,GAAG,mBAAmB;AAC1C,MAAMC,kBAAkB,GAAG,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AA,GAAAS,UAAA"}
@@ -39,6 +39,12 @@ Object.defineProperty(exports, "LocationError", {
39
39
  return _LocationError.LocationError;
40
40
  }
41
41
  });
42
+ Object.defineProperty(exports, "LocationWithDeviation", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _LocationWithDeviation.LocationWithDeviation;
46
+ }
47
+ });
42
48
  Object.defineProperty(exports, "NotRunning", {
43
49
  enumerable: true,
44
50
  get: function () {
@@ -74,6 +80,7 @@ var _HyperTrack = _interopRequireDefault(require("./HyperTrack/HyperTrack"));
74
80
  var _HyperTrackError = require("./HyperTrack/data_types/HyperTrackError");
75
81
  var _LocationErrorInternal = require("./HyperTrack/data_types/internal/LocationErrorInternal");
76
82
  var _LocationError = require("./HyperTrack/data_types/LocationError");
83
+ var _LocationWithDeviation = require("./HyperTrack/data_types/LocationWithDeviation");
77
84
  var _Location = require("./HyperTrack/data_types/Location");
78
85
  var _SdkInitParams = require("./HyperTrack/data_types/SdkInitParams");
79
86
  var _Result = require("./HyperTrack/data_types/Result");
@@ -1 +1 @@
1
- {"version":3,"names":["_HyperTrack","_interopRequireDefault","require","_HyperTrackError","_LocationErrorInternal","_LocationError","_Location","_SdkInitParams","_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 { Location } from './HyperTrack/data_types/Location';\nexport { SdkInitParams } from './HyperTrack/data_types/SdkInitParams';\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,SAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,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","_SdkInitParams","_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 { SdkInitParams } from './HyperTrack/data_types/SdkInitParams';\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,cAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAA0E,SAAAD,uBAAAS,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,IAAAG,QAAA,GAZ3DC,mBAAU;AAAAC,OAAA,CAAAH,OAAA,GAAAC,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","NativeEventEmitter","HyperTrackError","EVENT_TRACKING","EVENT_AVAILABILITY","EVENT_ERROR","LINKING_ERROR","select","ios","default","HyperTrackSdk","HyperTrackReactNativePlugin","Proxy","get","Error","EventEmitter","HyperTrack","constructor","initialize","publishableKey","sdkInitParams","arguments","length","undefined","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","_len","args","Array","_key","expectedLocation","isLocation","latitude","longitude","deserializeLocationWithDeviationResponse","subscribeToErrors","listener","addListener","rawErrors","deserializeHyperTrackErrors","subscribeToTracking","subscribeToAvailability","errors","map","response","deserializeLocationError","locationWithDeviationInternal","locationInternal","location","deviation","locationError","obj"],"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 { 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 { GeotagData } from './data_types/internal/GeotagData';\nimport type { DeviceName } from './data_types/internal/DeviceName';\nimport type { HyperTrackErrorInternal } from './data_types/internal/HyperTrackErrorInternal';\nimport type { Result } from './data_types/Result';\nimport type { LocationWithDeviation } from './data_types/LocationWithDeviation';\nimport type { LocationErrorInternal } from './data_types/internal/LocationErrorInternal';\nimport type { LocationInternal } from './data_types/internal/LocationInternal';\nimport type { LocationWithDeviationInternal } from './data_types/internal/LocationWithDeviationInternal';\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:\n sdkInitParams.requireBackgroundTrackingPermission ?? false,\n automaticallyRequestPermissions:\n 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: Result<LocationInternal, LocationErrorInternal>) => {\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 *\n * @param {Object} data - Geotad data JSON\n * @returns current location if success or LocationError if failure\n */\n async addGeotag(data: Object): 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 async addGeotag(\n data: Object,\n expectedLocation: Location\n ): Promise<Result<Location, LocationError>>;\n\n 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 this.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 * 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(\n EVENT_ERROR,\n (rawErrors: HyperTrackErrorInternal[]) => {\n listener(this.deserializeHyperTrackErrors(rawErrors));\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.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(\n errors: HyperTrackErrorInternal[]\n ): HyperTrackError[] {\n return errors.map(\n (error: HyperTrackErrorInternal) =>\n HyperTrackError[error.value as keyof typeof HyperTrackError]\n );\n }\n\n /** @ignore */\n private 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 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 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 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,SAASA,aAAa,EAAEC,QAAQ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B,QAAQ,IAAI,QAAQ,IAC/B,WAAW,IAAImB,GAAG,IAClB,OAAOA,GAAG,CAAClB,SAAS,IAAI,QAAQ;EAEpC;AACF"}
1
+ {"version":3,"names":["NativeModules","Platform","NativeEventEmitter","HyperTrackError","EVENT_TRACKING","EVENT_AVAILABILITY","EVENT_ERROR","LINKING_ERROR","select","ios","default","HyperTrackSdk","HyperTrackReactNativePlugin","Proxy","get","Error","EventEmitter","HyperTrack","constructor","initialize","publishableKey","sdkInitParams","arguments","length","undefined","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","_len","args","Array","_key","expectedLocation","isLocation","latitude","longitude","deserializeLocationWithDeviationResponse","subscribeToErrors","listener","addListener","rawErrors","deserializeHyperTrackErrors","subscribeToTracking","subscribeToAvailability","errors","map","response","deserializeLocationError","locationWithDeviationInternal","locationInternal","location","deviation","locationError","obj"],"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 { 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 { GeotagData } from './data_types/internal/GeotagData';\nimport type { DeviceName } from './data_types/internal/DeviceName';\nimport type { HyperTrackErrorInternal } from './data_types/internal/HyperTrackErrorInternal';\nimport type { Result } from './data_types/Result';\nimport type { LocationWithDeviation } from './data_types/LocationWithDeviation';\nimport type { LocationErrorInternal } from './data_types/internal/LocationErrorInternal';\nimport type { LocationInternal } from './data_types/internal/LocationInternal';\nimport type { LocationWithDeviationInternal } from './data_types/internal/LocationWithDeviationInternal';\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:\n sdkInitParams.requireBackgroundTrackingPermission ?? false,\n automaticallyRequestPermissions:\n 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: Result<LocationInternal, LocationErrorInternal>) => {\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 *\n * @param {Object} data - Geotad data JSON\n * @returns current location if success or LocationError if failure\n */\n async addGeotag(data: Object): 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 async addGeotag(\n data: Object,\n expectedLocation: Location\n ): Promise<Result<LocationWithDeviation, LocationError>>;\n\n 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 this.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 * 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(\n EVENT_ERROR,\n (rawErrors: HyperTrackErrorInternal[]) => {\n listener(this.deserializeHyperTrackErrors(rawErrors));\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.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(\n errors: HyperTrackErrorInternal[]\n ): HyperTrackError[] {\n return errors.map(\n (error: HyperTrackErrorInternal) =>\n HyperTrackError[error.value as keyof typeof HyperTrackError]\n );\n }\n\n /** @ignore */\n private 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 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 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 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,SAASA,aAAa,EAAEC,QAAQ,EAAEC,kBAAkB,QAAQ,cAAc;AAC1E,SAASC,eAAe,QAAQ,8BAA8B;AAgB9D,MAAMC,cAAc,GAAG,mBAAmB;AAC1C,MAAMC,kBAAkB,GA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 export { HyperTrack };
4
4
  export { HyperTrackError } from './HyperTrack/data_types/HyperTrackError';
5
5
  export { NotRunning, Starting } from './HyperTrack/data_types/internal/LocationErrorInternal';
6
6
  export { LocationError, Errors } from './HyperTrack/data_types/LocationError';
7
+ export { LocationWithDeviation } from './HyperTrack/data_types/LocationWithDeviation';
7
8
  export { Location } from './HyperTrack/data_types/Location';
8
9
  export { SdkInitParams } from './HyperTrack/data_types/SdkInitParams';
9
10
  export { Result, Success, Failure } from './HyperTrack/data_types/Result';
@@ -1 +1 @@
1
- {"version":3,"names":["HyperTrack","HyperTrackError","NotRunning","Starting","LocationError","Errors","Location","SdkInitParams","Result","Success","Failure"],"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 { Location } from './HyperTrack/data_types/Location';\nexport { SdkInitParams } from './HyperTrack/data_types/SdkInitParams';\nexport { Result, Success, Failure } from './HyperTrack/data_types/Result';\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,yBAAyB;AAChD,eAAeA,UAAU;AACzB,SAASA,UAAU;AAEnB,SAASC,eAAe,QAAQ,yCAAyC;AACzE,SACEC,UAAU,EACVC,QAAQ,QACH,wDAAwD;AAC/D,SAASC,aAAa,EAAEC,MAAM,QAAQ,uCAAuC;AAC7E,SAASC,QAAQ,QAAQ,kCAAkC;AAC3D,SAASC,aAAa,QAAQ,uCAAuC;AACrE,SAASC,MAAM,EAAEC,OAAO,EAAEC,OAAO,QAAQ,gCAAgC"}
1
+ {"version":3,"names":["HyperTrack","HyperTrackError","NotRunning","Starting","LocationError","Errors","LocationWithDeviation","Location","SdkInitParams","Result","Success","Failure"],"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 { SdkInitParams } from './HyperTrack/data_types/SdkInitParams';\nexport { Result, Success, Failure } from './HyperTrack/data_types/Result';\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,yBAAyB;AAChD,eAAeA,UAAU;AACzB,SAASA,UAAU;AAEnB,SAASC,eAAe,QAAQ,yCAAyC;AACzE,SACEC,UAAU,EACVC,QAAQ,QACH,wDAAwD;AAC/D,SAASC,aAAa,EAAEC,MAAM,QAAQ,uCAAuC;AAC7E,SAASC,qBAAqB,QAAQ,+CAA+C;AACrF,SAASC,QAAQ,QAAQ,kCAAkC;AAC3D,SAASC,aAAa,QAAQ,uCAAuC;AACrE,SAASC,MAAM,EAAEC,OAAO,EAAEC,OAAO,QAAQ,gCAAgC"}
@@ -3,6 +3,7 @@ import type { Location } from './data_types/Location';
3
3
  import type { LocationError } from './data_types/LocationError';
4
4
  import type { SdkInitParams } from './data_types/SdkInitParams';
5
5
  import type { Result } from './data_types/Result';
6
+ import type { LocationWithDeviation } from './data_types/LocationWithDeviation';
6
7
  export default class HyperTrack {
7
8
  private constructor();
8
9
  /**
@@ -75,7 +76,7 @@ export default class HyperTrack {
75
76
  * @param {Location} expectedLocation - Expected location
76
77
  * @returns location with deviation if success or LocationError if failure
77
78
  */
78
- addGeotag(data: Object, expectedLocation: Location): Promise<Result<Location, LocationError>>;
79
+ addGeotag(data: Object, expectedLocation: Location): Promise<Result<LocationWithDeviation, LocationError>>;
79
80
  /**
80
81
  * Subscribe to tracking errors
81
82
  *
@@ -4,6 +4,7 @@ export { HyperTrack };
4
4
  export { HyperTrackError } from './HyperTrack/data_types/HyperTrackError';
5
5
  export { NotRunning, Starting, } from './HyperTrack/data_types/internal/LocationErrorInternal';
6
6
  export { LocationError, Errors } from './HyperTrack/data_types/LocationError';
7
+ export { LocationWithDeviation } from './HyperTrack/data_types/LocationWithDeviation';
7
8
  export { Location } from './HyperTrack/data_types/Location';
8
9
  export { SdkInitParams } from './HyperTrack/data_types/SdkInitParams';
9
10
  export { Result, Success, Failure } from './HyperTrack/data_types/Result';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypertrack-sdk-react-native",
3
- "version": "9.2.0",
3
+ "version": "9.2.2",
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",
@@ -182,7 +182,7 @@ export default class HyperTrack {
182
182
  async addGeotag(
183
183
  data: Object,
184
184
  expectedLocation: Location
185
- ): Promise<Result<Location, LocationError>>;
185
+ ): Promise<Result<LocationWithDeviation, LocationError>>;
186
186
 
187
187
  async addGeotag(
188
188
  ...args: any[]
package/src/index.tsx CHANGED
@@ -8,6 +8,7 @@ export {
8
8
  Starting,
9
9
  } from './HyperTrack/data_types/internal/LocationErrorInternal';
10
10
  export { LocationError, Errors } from './HyperTrack/data_types/LocationError';
11
+ export { LocationWithDeviation } from './HyperTrack/data_types/LocationWithDeviation';
11
12
  export { Location } from './HyperTrack/data_types/Location';
12
13
  export { SdkInitParams } from './HyperTrack/data_types/SdkInitParams';
13
14
  export { Result, Success, Failure } from './HyperTrack/data_types/Result';