import { type EmitterSubscription } from 'react-native'; import { HyperTrackError } from './data_types/HyperTrackError'; import type { Location } from './data_types/Location'; import type { LocationError } from './data_types/LocationError'; import type { LocationWithDeviation } from './data_types/LocationWithDeviation'; import type { Result } from './data_types/Result'; import type { OrderStatus } from './data_types/OrderStatus'; import type { Order } from './data_types/Order'; export default class HyperTrack { private static locateSubscription; /** * Adds a new geotag. Check [Shift tracking](https://hypertrack.com/docs/shift-tracking) and [Clock In/Out tagging](https://hypertrack.com/docs/clock-inout-tracking) docs to learn how to use Order handle and Order status params. * * @param {string} orderHandle - Order handle * @param {OrderStatus} orderStatus - Order status * @param {Object} data - Geotag data JSON * @returns current location if success or LocationError if failure */ static addGeotag(orderHandle: string, orderStatus: OrderStatus, data: Object): Promise>; /** * Adds a new geotag with expected location. Check [Shift tracking](https://hypertrack.com/docs/shift-tracking) and [Clock In/Out tagging](https://hypertrack.com/docs/clock-inout-tracking) docs to learn how to use Order handle and Order status params. * * @param {string} orderHandle - Order handle * @param {OrderStatus} orderStatus - Order status * @param {Object} data - Geotag data JSON * @param {Location} expectedLocation - Expected location * @returns location with deviation if success or LocationError if failure */ static addGeotag(orderHandle: string, orderStatus: OrderStatus, data: Object, expectedLocation: Location): Promise>; /** * @deprecated * Adds a new geotag * * @param {Object} data - Geotag data JSON * @returns current location if success or LocationError if failure */ static addGeotag(data: Object): Promise>; /** * @deprecated * Adds a new geotag with expected location * * @param {Object} data - Geotag data JSON * @param {Location} expectedLocation - Expected location * @returns location with deviation if success or LocationError if failure */ static addGeotag(data: Object, expectedLocation: Location): Promise>; /** * If disallowed, the HyperTrack platform will display and outage if mocked location is detected. * * @param {boolean} true if mock location is allowed */ static getAllowMockLocation(): Promise; /** * Returns a string that is used to uniquely identify the device * * @returns {string} Device ID */ static getDeviceId(): Promise; static getDynamicPublishableKey(): Promise; /** * Returns a list of errors that blocks SDK from tracking * * @returns {HyperTrackError[]} List of errors */ static getErrors(): Promise; /** * Reflects availability of the device for the Nearby search * * @returns true when is available or false when unavailable */ static getIsAvailable(): Promise; /** * Reflects the tracking intent for the device * * @returns {boolean} Whether the user's movement data is getting tracked or not. */ static getIsTracking(): Promise; /** * Reflects the current location of the user or an outage reason */ static getLocation(): Promise>; /** * Gets the metadata that is set for the device * * @returns {Object} Metadata JSON */ static getMetadata(): Promise; /** * Gets the name that is set for the device * * @returns {string} Device name */ static getName(): Promise; /** * Gets the active orders for the worker. The orders are sorted with the ordering in * which the worker should complete them. * * @returns {Map} Map of orders */ static getOrders(): Promise>; /** * A primary identifier that uniquely identifies the worker outside of HyperTrack. * Example: email, phone number, database id * It is usually obtained and set when the worker logs into the app. * Set it to an empty string "" when the worker logs out of the app to un-bind the device from the worker and * avoid unintentional tracking. */ static getWorkerHandle(): Promise; /** * Requests one-time location update and returns the location once it is available, or error. * * Only one locate subscription can be active at a time. If you re-subscribe, the old EmitterSubscription * will be automaticaly removed. * * This method will start location tracking if called, and will stop it when the location is received or * the subscription is cancelled. If any other tracking intent is present (e.g. isAvailable is set to `true`), * the tracking will not be stopped. * * @param callback * @returns EmitterSubscription * @example * ```js * const subscription = HyperTrack.locate(location => { * ... * }) * * // to unsubscribe * subscription.remove() * ``` */ static locate(callback: (location: Result) => void): EmitterSubscription; /** * Allows mocking location data. * * Check the [Test with mock locations](https://hypertrack.com/docs/mock-location) guide for more information. * * To avoid issues related to race conditions in your code use this API **only if** modifying the compiled `HyperTrackAllowMockLocation` AndroidManifest.xml/Info.plist value is insufficient for your needs. * Example: if for some reason you aren't able to recompile with `HyperTrackAllowMockLocation` set to `YES`/`true` for your prod app QA mock location tests and need to set up the value in runtime. * * @param true if mock location is allowed */ static setAllowMockLocation(allow: boolean): Promise; static setDynamicPublishableKey(dynamicPublishableKey: string): void; /** * Sets the availability of the device for the Nearby search * * @param isAvailable true when is available or false when unavailable */ static setIsAvailable(isAvailable: boolean): void; /** * Sets the tracking intent for the device * * @param {boolean} isTracking */ static setIsTracking(isTracking: boolean): void; /** * Sets the metadata for the device * * @param {Object} data - Metadata JSON */ static setMetadata(data: Object): void; /** * Sets the name for the device * * @param {string} name */ static setName(name: string): void; /** * A primary identifier that uniquely identifies the worker outside of HyperTrack. * Example: email, phone number, database id * It is usually obtained and set when the worker logs into the app. * Set it to an empty string "" when the worker logs out of the app to un-bind the device from the worker and * avoid unintentional tracking. * * @param {string} workerHandle */ static setWorkerHandle(workerHandle: string): void; /** * Subscribe to tracking errors * * @param listener * @returns EmitterSubscription * @example * ```js * const subscription = HyperTrack.subscribeToErrors(errors => { * errors.forEach(error => { * // ... error * }) * }) * * // later, to stop listening * subscription.remove() * ``` */ static subscribeToErrors(listener: (errors: HyperTrackError[]) => void): EmitterSubscription; /** * Subscribe to availability changes * * @param listener * @returns EmitterSubscription * @example * ```js * const subscription = HyperTrack.subscribeToIsAvailable(isAvailable => { * if (isAvailable) { * // ... ready to go * } * }) * * // later, to stop listening * subscription.remove() * ``` */ static subscribeToIsAvailable(listener: (isAvailable: boolean) => void): EmitterSubscription; /** * Subscribe to tracking intent changes * * @param listener * @returns EmitterSubscription * @example * ```js * const subscription = HyperTrack.subscribeToIsTracking(isTracking => { * if (isTracking) { * // ... ready to go * } * }) * * // later, to stop listening * subscription.remove() * ``` */ static subscribeToIsTracking(listener: (isTracking: boolean) => void): EmitterSubscription; /** * Subscribe to location changes * * @param listener * @returns EmitterSubscription * @example * ```js * const subscription = HyperTrack.subscribeToLocation(location => { * ... * }) * * // later, to stop listening * subscription.remove() * ``` */ static subscribeToLocation(listener: (location: Result) => void): EmitterSubscription; /** * Subscribe to changes in the orders assigned to the worker * * @param listener * @returns EmitterSubscription * @example * ```js * const subscription = HyperTrack.subscribeToOrders(orders => { * ... * }) * * // later, to stop listening * subscription.remove() * ``` */ static subscribeToOrders(listener: (orders: Map) => void): EmitterSubscription; /** @ignore */ private static deserializeAllowMockLocation; /** @ignore */ private static deserializeDynamicPublishableKey; /** @ignore */ private static deserializeHyperTrackErrors; /** @ignore */ private static deserializeIsInsideGeofence; /** @ignore */ private static deserializeLocateResponse; /** @ignore */ private static deserializeLocationError; /** @ignore */ private static deserializeLocationResponse; /** @ignore */ private static deserializeLocationWithDeviationResponse; /** @ignore */ private static deserializeMetadata; /** @ignore */ private static deserializeName; /** @ignore */ private static deserializeOrders; /** @ignore */ private static isLocation; /** @ignore */ private static isOrderStatus; } //# sourceMappingURL=HyperTrack.d.ts.map