@situm/react-native 3.4.0 → 3.4.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/README.md +9 -1
- package/android/src/main/java/com/situm/plugin/PluginHelper.java +6 -2
- package/android/src/main/java/com/situm/plugin/SitumMapper.java +17 -7
- package/ios/SitumPlugin.m +22 -6
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/sdk/index.js +27 -12
- package/lib/commonjs/sdk/index.js.map +1 -1
- package/lib/commonjs/sdk/types/constants.js +1 -1
- package/lib/commonjs/sdk/types/index.js +352 -0
- package/lib/commonjs/sdk/types/index.js.map +1 -1
- package/lib/commonjs/sdk/utils.js +49 -5
- package/lib/commonjs/sdk/utils.js.map +1 -1
- package/lib/commonjs/utils/requestPermission.js +2 -15
- package/lib/commonjs/utils/requestPermission.js.map +1 -1
- package/lib/commonjs/wayfinding/hooks/index.js +6 -8
- package/lib/commonjs/wayfinding/hooks/index.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/sdk/index.js +28 -13
- package/lib/module/sdk/index.js.map +1 -1
- package/lib/module/sdk/types/constants.js +1 -1
- package/lib/module/sdk/types/index.js +382 -1
- package/lib/module/sdk/types/index.js.map +1 -1
- package/lib/module/sdk/utils.js +46 -4
- package/lib/module/sdk/utils.js.map +1 -1
- package/lib/module/utils/requestPermission.js +2 -15
- package/lib/module/utils/requestPermission.js.map +1 -1
- package/lib/module/wayfinding/hooks/index.js +6 -8
- package/lib/module/wayfinding/hooks/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/sdk/index.d.ts +3 -6
- package/lib/typescript/src/sdk/index.d.ts.map +1 -1
- package/lib/typescript/src/sdk/types/constants.d.ts +1 -1
- package/lib/typescript/src/sdk/types/index.d.ts +79 -1
- package/lib/typescript/src/sdk/types/index.d.ts.map +1 -1
- package/lib/typescript/src/sdk/utils.d.ts +1 -0
- package/lib/typescript/src/sdk/utils.d.ts.map +1 -1
- package/lib/typescript/src/utils/requestPermission.d.ts.map +1 -1
- package/lib/typescript/src/wayfinding/hooks/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -1
- package/src/sdk/index.ts +52 -32
- package/src/sdk/types/constants.ts +1 -1
- package/src/sdk/types/index.ts +82 -1
- package/src/sdk/utils.ts +42 -2
- package/src/utils/requestPermission.ts +2 -19
- package/src/wayfinding/hooks/index.ts +11 -4
|
@@ -3,4 +3,356 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.ErrorType = exports.ErrorCode = void 0;
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
+
/**
|
|
9
|
+
* @name Building
|
|
10
|
+
* @description A Building object definition
|
|
11
|
+
*
|
|
12
|
+
* @property {string} buildingIdentifier - The unique identifier of the resource
|
|
13
|
+
* @property {string} name - The building name that is appropriate for display to the user.
|
|
14
|
+
* @property {string} address - Te building address.
|
|
15
|
+
* @property {Bounds} bounds - Compute corners of this building, without rotation, in earth coordinates.
|
|
16
|
+
* @property {Bounds} boundsRotated - Compute corners of this building, with rotation, in earth coordinates.
|
|
17
|
+
* @property {Coordinate} center - Center of the building's base, as geographical coordinate.
|
|
18
|
+
* @property {Dimensions} Dimensions - Dimensions of building's base (height and width) in meters.
|
|
19
|
+
* @property {string} infoHtml - Additional information about building, formatted with HTML
|
|
20
|
+
* @property {string} pictureThumbUrl - The URL of building thumbnail image
|
|
21
|
+
* @property {string} pictureUrl - The URL of building image
|
|
22
|
+
* @property {number} rotation - Rotation angle of the building's base, relative to the west-east axis, increasing in counter-clockwise, being 0 the west-east axis.
|
|
23
|
+
* @property {string} userIdentifier - Unique identifier of the owner user of the building
|
|
24
|
+
* @property {object} customFields - Map of custom fields, indexed by their name.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* @name BuildingInfo
|
|
28
|
+
* @description Full information of a building
|
|
29
|
+
*
|
|
30
|
+
* @property {Building} building - Building basic information
|
|
31
|
+
* @property {Floor[]} floors - Array with the information of each floor
|
|
32
|
+
* @property {Poi[]} indoorPOIs - Array with the information of each indoor POI
|
|
33
|
+
* @property {Poi[]} outdoorPOIs - Array with the information of each outdoor POI
|
|
34
|
+
* @property {Geofence} geofences - Array with the information of each geofence
|
|
35
|
+
*/
|
|
36
|
+
/** @name Bounds
|
|
37
|
+
* @description Represents a rectangle bounds in a greographic 2D space.
|
|
38
|
+
*
|
|
39
|
+
* @property {Coordinate} northEast - The coordinate of the north-east corner of the bound.
|
|
40
|
+
* @property {Coordinate} northWest - The coordinate of the north-west corner of the bound.
|
|
41
|
+
* @property {Coordinate} southEast - The coordinate of the south-east corner of the bound.
|
|
42
|
+
* @property {Coordinate} southWest - The coordinate of the south-east corner of the bound.
|
|
43
|
+
*/
|
|
44
|
+
/** @name Dimensions
|
|
45
|
+
* @description Define 2D dimensions of a rectangular area.
|
|
46
|
+
*
|
|
47
|
+
* @property {number} width - Width of rectangle in meters
|
|
48
|
+
* @property {number} height - Height of rectangle in meters.
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* @name Coordinate
|
|
52
|
+
* @description A structure that contains geographical coordinate.
|
|
53
|
+
*
|
|
54
|
+
* @property {number} latitude - Latitude in degrees
|
|
55
|
+
* @property {number} longitude - Longitude in degrees
|
|
56
|
+
*/
|
|
57
|
+
/**
|
|
58
|
+
* @name CartesianCoordinate
|
|
59
|
+
* @description A structure that contains cartesian coordinate.
|
|
60
|
+
*
|
|
61
|
+
* @property {number} x - Value of coordinate at x-axis
|
|
62
|
+
* @property {number} y - Value of coordinate at y-axis
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* @name Floor
|
|
66
|
+
* @description Floor of a building.
|
|
67
|
+
*
|
|
68
|
+
* @property {number} altitude - Altitude of the floor above ground level, in meters.
|
|
69
|
+
* @property {string} buildingIdentifier - The identifier of building which this floor belongs.
|
|
70
|
+
* @property {number} level - The number of the floor.
|
|
71
|
+
* @property {string} name - The name of the floor
|
|
72
|
+
* @property {string} mapUrl - The floor map image url
|
|
73
|
+
* @property {number} scale - The scale of the floor image, in px/meters
|
|
74
|
+
* @property {string} floorIdentifier - The unique identifier of the resource
|
|
75
|
+
*/
|
|
76
|
+
/**
|
|
77
|
+
* @name POI
|
|
78
|
+
* @description Point of Interest, associated to a building, regardless of whether it's place inside or outside the building.
|
|
79
|
+
*
|
|
80
|
+
* @property {string} identifier - The unique identifier of the resource
|
|
81
|
+
* @property {string} buildingIdentifier - Identifier of building to which the POI belongs.
|
|
82
|
+
* @property {CartesianCoordinate} cartesianCoordinate - Cartesian coordinate of this position, relative to building {@link Bounds}.
|
|
83
|
+
* @property {Coordinate} coordinate - Geographical coordinate of this position
|
|
84
|
+
* @property {string} floorIdentifier - If this POI is outside the building (isOutdoor == true), this field has no meaning.
|
|
85
|
+
* @property {string} poiName - A name for the POI, appropriate for display to the user.
|
|
86
|
+
* @property {Point} position - {@link Point} where the point is located.
|
|
87
|
+
* @property {boolean} isIndoor - Whether the POI is placed outside the building or not.
|
|
88
|
+
* @property {boolean} isOutdoor - Whether the POI is placed outside the building or not.
|
|
89
|
+
* @property {PoiCategory} category - Category of the POI
|
|
90
|
+
* @property {string} infoHtml - Additional information about POI, in HTML
|
|
91
|
+
* @property {object} customFields - Map of custom fields, indexed by their name.
|
|
92
|
+
*/
|
|
93
|
+
/**
|
|
94
|
+
* @name Geofence
|
|
95
|
+
* @description Point of Interest, associated to a building, regardless of whether it's place inside or outside the building.
|
|
96
|
+
*
|
|
97
|
+
* @property {string} identifier - The unique identifier of the resource
|
|
98
|
+
* @property {string} buildingIdentifier - Identifier of building to which the POI belongs.
|
|
99
|
+
* @property {string} floorIdentifier - If this POI is outside the building (isOutdoor == true), this field has no meaning.
|
|
100
|
+
* @property {string} name - A name for the geofence, appropriate for display to the user.
|
|
101
|
+
* @property {string} infoHtml - Additional information about POI, in HTML
|
|
102
|
+
* @property {Point[]} polygonPoints - List of points of that define the area of the geofence
|
|
103
|
+
* @property {object} customFields - Map of custom fields, indexed by their name.
|
|
104
|
+
*/
|
|
105
|
+
/**
|
|
106
|
+
* @name PoiCategory
|
|
107
|
+
* @description Category of Point of Interest.
|
|
108
|
+
*
|
|
109
|
+
* @property {string} poiCategoryCode - Unique code of the category
|
|
110
|
+
* @property {string} poiCategoryName - The category name appropriate for display to the user
|
|
111
|
+
* @property {string} icon_selected - The selected icon url
|
|
112
|
+
* @property {string} icon_unselected - The unselected icon url
|
|
113
|
+
* @property {boolean} public - Whether the category is public or not
|
|
114
|
+
*/
|
|
115
|
+
/**
|
|
116
|
+
* @name PoiIcon
|
|
117
|
+
* @description Category of Point of Interest.
|
|
118
|
+
*
|
|
119
|
+
* @property {string} data - Base64 POI icon image
|
|
120
|
+
*/
|
|
121
|
+
/**
|
|
122
|
+
* @name Point
|
|
123
|
+
* @description Associate geographical coordinate (Location) with Building and Floor (Cartography) and cartesian coordinate relative to that building.
|
|
124
|
+
*
|
|
125
|
+
* @property {string} buildingIdentifier - Unique identifier for the building to which this point belongs
|
|
126
|
+
* @property {CartesianCoordinate} cartesianCoordinate - Cartesian coordinate (in meters) relative to the Bounds of building's base.
|
|
127
|
+
* @property {Coordinate} coordinate - Geographic coordinate (latitude, longitude) of the point, regardless of whether it's placed inside or outside the building.
|
|
128
|
+
* @property {string} floorIdentifier - Floor identifier (inside the building) where this point is placed.
|
|
129
|
+
* @property {boolean} isIndoor - If the POI is inside the building.
|
|
130
|
+
* @property {boolean} idOutdoor - If the POI is outside the building.
|
|
131
|
+
*/
|
|
132
|
+
/**
|
|
133
|
+
* @name Route
|
|
134
|
+
* @description Route between two points.
|
|
135
|
+
*
|
|
136
|
+
* @property {RouteStep[]} edges - Ordered list of steps to go to the goal point
|
|
137
|
+
* @property {RouteStep} firstStep - First step
|
|
138
|
+
* @property {Point} from - Point where the route starts.
|
|
139
|
+
* @property {Indication} indications - Ordered list of instructions to go to the destination
|
|
140
|
+
* @property {RouteStep} lastStep - Last step
|
|
141
|
+
* @property {Point[]} nodes - A collection of points of the route (not ordered)
|
|
142
|
+
* @property {Point[]} points - List of ordered points of the route
|
|
143
|
+
* @property {Point} to - Last point and goal of the route.
|
|
144
|
+
* @property {RouteStep[]} steps - Ordered list of steps to go to the goal point
|
|
145
|
+
* @property {RouteSegment[]} segments - List of segments formed by consecutive points and a floor identifier
|
|
146
|
+
*/
|
|
147
|
+
/**
|
|
148
|
+
* @name RouteStep
|
|
149
|
+
* @description A fragment of a route, described by the initial point from and the last point to of the fragment, and some information about the step within the route.
|
|
150
|
+
*
|
|
151
|
+
* @property {number} distance - Distance between from and to in meters.
|
|
152
|
+
* @property {number} distanceToGoal - Distance in meters between the start point of this step (from) and the last point in the route ('to' of the last step).
|
|
153
|
+
* @property {Point} from - Start point of this step.
|
|
154
|
+
* @property {number} id - Position of this RouteStep in the list of steps (Route.steps) of the route to which it belongs.
|
|
155
|
+
* @property {Point} to - End point of this step.
|
|
156
|
+
* @property {boolean} isFirst - Returns true if this is the first step in the route.
|
|
157
|
+
* @property {boolean} isLast - Returns true if this is the last step in the route.
|
|
158
|
+
*/
|
|
159
|
+
/**
|
|
160
|
+
* @name RouteSegment
|
|
161
|
+
* @description A fragment of a route, described by a floor identifier and a list of consecutive points from the same floor
|
|
162
|
+
*
|
|
163
|
+
* @property {string} floorIdentifier - Identifier of the floor containing the points in this segment
|
|
164
|
+
* @property {Point[]} points - Consecutive points in the same floor forming a path
|
|
165
|
+
*/
|
|
166
|
+
/**
|
|
167
|
+
* @name Indication
|
|
168
|
+
* @description Represents the instruction that a user should follow when on a RouteStep to continue the route.
|
|
169
|
+
*
|
|
170
|
+
* @property {number} distance - The distance between the origin and destination
|
|
171
|
+
* @property {number} distanceToNextLevel - The number of levels between the origin and destination
|
|
172
|
+
* @property {string} indicationType - The Indication.Action of the instruction as String
|
|
173
|
+
* @property {number} orientation - The angle a user should change his direction in order to go from the origin to the destination.
|
|
174
|
+
* @property {string} orientationType - The Indication.Orientation of the instruction as String
|
|
175
|
+
* @property {number} stepIdxDestination - The index of the indication's step of destination.
|
|
176
|
+
* @property {number} stepIdxOrigin - The index of the indication's step of origin
|
|
177
|
+
* @property {boolean} neededLevelChange - If the user should change the level in order to arrive at the destination.
|
|
178
|
+
*/
|
|
179
|
+
/**
|
|
180
|
+
* @name NavigationProgress
|
|
181
|
+
* @description Provides information of the progress of a user while following a route.
|
|
182
|
+
*
|
|
183
|
+
* @property {Location} closestLocationInRoute - Closest location in the route from the user location provided .
|
|
184
|
+
* @property {number} distanceToClosestPointInRoute - Distance between the real user location (provided to updateWithLocation(Location)) and the closest route location.
|
|
185
|
+
* @property {Indication} currentIndication - The current indication.
|
|
186
|
+
* @property {Indication} nextIndication - The next indication.
|
|
187
|
+
* @property {number} currentStepIndex - The index of the closest route step to the user, where closestLocationInRoute is.
|
|
188
|
+
* @property {number} distanceToGoal - The distance in meters from closestLocationInRoute to route's goal point.
|
|
189
|
+
* @property {number} distanceToEndStep - The distance in meters to go from closestLocationInRoute to the end of the current step.
|
|
190
|
+
* @property {number} timeToEndStep - The estimated time to go from closestLocationInRoute to the end of the current route step, considering a speed of 1 meter/second.
|
|
191
|
+
* @property {number} timeToGoal - The estimated time to go from closestLocationInRoute to the goal/end of route, considering a speed of 1 meter/second.
|
|
192
|
+
* @property {RouteStep} routeStep - The closest route step to the user, where closestLocationInRoute is.
|
|
193
|
+
* @property {Point[]} points - List of ordered points of the remaining route
|
|
194
|
+
* @property {RouteSegment[]} segments - List of segments formed by consecutive points and a floor identifier
|
|
195
|
+
*/
|
|
196
|
+
/**
|
|
197
|
+
* @name LocationRequest
|
|
198
|
+
* @description A data object that contains parameters for the location service, LocationManager.
|
|
199
|
+
*
|
|
200
|
+
* @property {number} buildingIdentifier - Identifier of the building on which the positioning will be started
|
|
201
|
+
* @property {number} interval - Default interval (in milliseconds) to notify location updates
|
|
202
|
+
* @property {string} indoorProvider - Default indoor provider. Possible values are INPHONE and SUPPORT
|
|
203
|
+
* @property {boolean} useBle - Defines whether or not to use BLE for positioning
|
|
204
|
+
* @property {boolean} useWifi - Defines whether or not to use Wi-Fi for positioning
|
|
205
|
+
* @property {boolean} useGps - Defines whether or not to use GPS for indoor positioning
|
|
206
|
+
* @property {boolean} useBarometer - Defines whether or not to use the barometer for indoor positioning
|
|
207
|
+
* @property {string} motionMode - Default motion mode. Possible values are BY_CAR, BY_FOOT, and RADIOMAX
|
|
208
|
+
* @property {boolean} useForegroundService - Defines whether or not to activate the {@link http://developers.situm.es/pages/android/using_situm_sdk_background.html foreground service}
|
|
209
|
+
* @property {boolean} useDeadReckoning - Defines whether or not to use dead reckoning to get fast position updates using only the inertial sensors, between the server position updates.
|
|
210
|
+
* @property {OutdoorLocationOptions} outdoorLocationOptions - Outdoor location options. Only used in an indoor/outdoor request
|
|
211
|
+
* @property {BeaconFilter[]} beaconFilters - Deprecated - Beacon filters to be handled during scan time, otherwise only Situm beacons will be scanned. Can be invoked multiple times to add as much beacon filters as you want. The SitumSDK now does it automatically
|
|
212
|
+
* @property {number} smallestDisplacement - Default smallest displacement to notify location updates
|
|
213
|
+
* @property {string} realtimeUpdateInterval - Default interval to send locations to the Realtime. Possible values are REALTIME, FAST, NORMAL, SLOW, and BATTERY_SAVER
|
|
214
|
+
*/
|
|
215
|
+
/**
|
|
216
|
+
* @name NavigationRequest
|
|
217
|
+
* @description A data object that contains the request for navigation.
|
|
218
|
+
*
|
|
219
|
+
* @property {number} distanceToGoalThreshold - Distance threshold to consider reaching the goal (meters).
|
|
220
|
+
* @property {number} distanceToIgnoreFirstIndication - Maximum distance to ignore the first indication when navigating (meters).
|
|
221
|
+
* @property {number} distanceToFloorChangeThreshold - Distance threshold from when a floor change is considered reached (meters).
|
|
222
|
+
* @property {number} distanceToChangeIndicationThreshold - Distance threshold to change the indication (meters).
|
|
223
|
+
* @property {boolean} ignoreLowQualityLocations - Ignore low-quality locations.
|
|
224
|
+
* @property {number} indicationsInterval - Interval between indications (milliseconds).
|
|
225
|
+
* @property {number} outsideRouteThreshold - Distance threshold to consider being outside the route (meters).
|
|
226
|
+
* @property {number} roundIndicationsStep - Step to round indications (meters).
|
|
227
|
+
* @property {number} timeToFirstIndication - Time to wait until the first indication is returned (milliseconds).
|
|
228
|
+
* @property {number} timeToIgnoreUnexpectedFloorChanges - Time to ignore the locations received during navigation, when the next indication is a floor change,
|
|
229
|
+
* if the locations are on a wrong floor (not in origin or destination floors) (milliseconds).
|
|
230
|
+
*/
|
|
231
|
+
/**
|
|
232
|
+
* @name DirectionsRequest
|
|
233
|
+
* @description A data object that contains the request for directions.
|
|
234
|
+
*
|
|
235
|
+
* @property {Building} positioningBuilding
|
|
236
|
+
* @property {Point|Location} from - Current user's position as the starting point of the route.
|
|
237
|
+
* @property {Point|Poi} to - Point to, where the route should end.
|
|
238
|
+
* @property {DirectionsOptions} options - Options that can be added to the request.
|
|
239
|
+
*/
|
|
240
|
+
/**
|
|
241
|
+
* @name DirectionsOptions
|
|
242
|
+
* @description A data object that contains the directions options.
|
|
243
|
+
*
|
|
244
|
+
* @property {boolean} minimizeFloorChanges - Defines wheter or not the route should be calculated minimizing the floor changes even if the result is longer.
|
|
245
|
+
* @property {string} accessibilityMode - Defines the accessibility mode of the route. Possible values are: CHOOSE_SHORTEST, ONLY_NOT_ACCESSIBLE_FLOOR_CHANGES, ONLY_ACCESSIBLE
|
|
246
|
+
* @property {number} startingAngle - Current user's orientation in degrees.
|
|
247
|
+
*/
|
|
248
|
+
/**
|
|
249
|
+
* @name OutdoorLocationOptions
|
|
250
|
+
* @description Outdoor location options are only used in indoor-outdoor mode (Only available for Android)
|
|
251
|
+
*
|
|
252
|
+
* @property {boolean} continuousMode - Environment detection continuous mode (true) or burst mode (false).
|
|
253
|
+
* @property {boolean} userDefinedThreshold
|
|
254
|
+
* @property {number} burstInterval - Interval to scan for GPS and detect the environment (in seconds).
|
|
255
|
+
* @property {number} averageSnrThreshold
|
|
256
|
+
*/
|
|
257
|
+
/**
|
|
258
|
+
* @name BeaconFilter
|
|
259
|
+
* @description Represents a BLE filter. Now the only field is the BLE proximity UUID
|
|
260
|
+
*
|
|
261
|
+
* @property {string} uuid - Assigns the proximity UUID
|
|
262
|
+
*/
|
|
263
|
+
/**
|
|
264
|
+
* @name RealTimeRequest
|
|
265
|
+
* @description A data object that contains the parameters to process realtime data of the users.
|
|
266
|
+
*
|
|
267
|
+
* @property {Building} building object
|
|
268
|
+
* @property {int} pollTime - Interval in milliseconds (minimum is 3000ms).
|
|
269
|
+
*/
|
|
270
|
+
/**
|
|
271
|
+
* @name RealTimeData
|
|
272
|
+
* @description A data object that contains information of the location of users in realtime.
|
|
273
|
+
*
|
|
274
|
+
* @property {Array<Location>} locations object
|
|
275
|
+
*/
|
|
276
|
+
/**
|
|
277
|
+
* @name SdkVersion
|
|
278
|
+
* @description Represents the version information of the SDK and its compatibility with different platforms.
|
|
279
|
+
*
|
|
280
|
+
* @type
|
|
281
|
+
* @property {string} react_native - The version of React Native used in the SDK.
|
|
282
|
+
* @property {string} [ios] - Optional. The specific version of the Situm SDK for the iOS platform.
|
|
283
|
+
* @property {string} [android] - Optional. The specific version of the Situm SDK for the Android platform.
|
|
284
|
+
*/
|
|
285
|
+
/**
|
|
286
|
+
* @name ConfigurationOptions
|
|
287
|
+
* @description Configuration options for initializing the SDK or other modules.
|
|
288
|
+
*
|
|
289
|
+
* @type
|
|
290
|
+
* @property {boolean} [useRemoteConfig] - Optional. Determines whether to use Remote Configuration settings.
|
|
291
|
+
* @property {number} [cacheMaxAge] - Optional. The maximum age of the cache in seconds.
|
|
292
|
+
*/
|
|
293
|
+
/**
|
|
294
|
+
* @name Location
|
|
295
|
+
* @description Represents a location with various attributes including position, accuracy, and bearing.
|
|
296
|
+
*
|
|
297
|
+
* @interface
|
|
298
|
+
* @property {Position} [position] - Optional. The position information of the location.
|
|
299
|
+
* @property {number} [accuracy] - Optional. The accuracy of the location information in meters.
|
|
300
|
+
* @property {Object} [bearing] - Optional. Bearing information including degrees and degreesClockwise.
|
|
301
|
+
* @property {boolean} [hasBearing] - Optional. Indicates if bearing information is available.
|
|
302
|
+
* @property {LocationStatusName} status - The status of the location update.
|
|
303
|
+
*/
|
|
304
|
+
/**
|
|
305
|
+
* @name LocationStatus
|
|
306
|
+
* @description Represents the status of a location, including a name and a numeric code.
|
|
307
|
+
*
|
|
308
|
+
* @interface
|
|
309
|
+
* @property {LocationStatusName} statusName - The name of the location status.
|
|
310
|
+
* @property {number} statusCode - The numeric code representing the location status.
|
|
311
|
+
*/
|
|
312
|
+
/**
|
|
313
|
+
* @name ErrorType
|
|
314
|
+
* @description Enumeration of error types to categorize the severity of errors.
|
|
315
|
+
*
|
|
316
|
+
* @enum {string}
|
|
317
|
+
* @property {string} CRITICAL - Represents critical errors that will cause the system not to work (e.g. positioning will be stopped).
|
|
318
|
+
* @property {string} NON_CRITICAL - Represents non-critical errors that are less severe.
|
|
319
|
+
*/
|
|
320
|
+
let ErrorType = /*#__PURE__*/function (ErrorType) {
|
|
321
|
+
ErrorType["CRITICAL"] = "CRITICAL";
|
|
322
|
+
ErrorType["NON_CRITICAL"] = "NON_CRITICAL";
|
|
323
|
+
return ErrorType;
|
|
324
|
+
}({});
|
|
325
|
+
/**
|
|
326
|
+
* @name ErrorCode
|
|
327
|
+
* @description Enumeration of error codes provided by Situm SDK.
|
|
328
|
+
*
|
|
329
|
+
* @enum {string}
|
|
330
|
+
* @property {string} LOCATION_PERMISSION_DENIED - Indicates that location permissions were not granted by the user.
|
|
331
|
+
* @property {string} BLUETOOTH_PERMISSION_DENIED - Indicates that Bluetooth permissions were not granted.
|
|
332
|
+
* @property {string} BLUETOOTH_DISABLED - Indicates that Bluetooth is disabled on the device.
|
|
333
|
+
* @property {string} LOCATION_DISABLED - Indicates that the location services are disabled on the device.
|
|
334
|
+
* @property {string} REDUCED_ACCURACY - Indicates that the precise location has been turned off on the device.
|
|
335
|
+
* @property {string} UNKNOWN - Represents an unknown error or an error that does not fit other categories.
|
|
336
|
+
*/
|
|
337
|
+
exports.ErrorType = ErrorType;
|
|
338
|
+
let ErrorCode = /*#__PURE__*/function (ErrorCode) {
|
|
339
|
+
ErrorCode["LOCATION_PERMISSION_DENIED"] = "LOCATION_PERMISSION_DENIED";
|
|
340
|
+
ErrorCode["BLUETOOTH_PERMISSION_DENIED"] = "BLUETOOTH_PERMISSION_DENIED";
|
|
341
|
+
ErrorCode["BLUETOOTH_DISABLED"] = "BLUETOOTH_DISABLED";
|
|
342
|
+
ErrorCode["LOCATION_DISABLED"] = "LOCATION_DISABLED";
|
|
343
|
+
ErrorCode["REDUCED_ACCURACY"] = "REDUCED_ACCURACY";
|
|
344
|
+
ErrorCode["UNKNOWN"] = "UNKNOWN";
|
|
345
|
+
return ErrorCode;
|
|
346
|
+
}({});
|
|
347
|
+
/**
|
|
348
|
+
* @name Error
|
|
349
|
+
* @description Represents an error with a specific code, message, and type.
|
|
350
|
+
*
|
|
351
|
+
* @interface
|
|
352
|
+
* @property {ErrorCode} code - The specific error code associated with this error.
|
|
353
|
+
* @property {string} message - A descriptive message providing more details about the error.
|
|
354
|
+
* @property {ErrorType} type - The type of the error indicating its severity (critical or non-critical).
|
|
355
|
+
*/
|
|
356
|
+
// TODO: add types
|
|
357
|
+
exports.ErrorCode = ErrorCode;
|
|
6
358
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["sdk/types/index.ts"],"mappings":""}
|
|
1
|
+
{"version":3,"names":["ErrorType","exports","ErrorCode"],"sourceRoot":"../../../../src","sources":["sdk/types/index.ts"],"mappings":";;;;;;AAAA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA2BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAQYA,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAKrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXAC,OAAA,CAAAD,SAAA,GAAAA,SAAA;AAAA,IAYYE,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AASrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AAAAD,OAAA,CAAAC,SAAA,GAAAA,SAAA"}
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.handleSyncCallback = exports.handleAsyncCallback = exports.exceptionWrapper = void 0;
|
|
7
|
+
exports.locationErrorAdapter = locationErrorAdapter;
|
|
8
|
+
exports.promiseWrapper = void 0;
|
|
7
9
|
var _ = require("..");
|
|
10
|
+
var _types = require("./types");
|
|
8
11
|
/**
|
|
9
12
|
* Handles callbacks coming from SDKs asynchronously
|
|
10
13
|
*
|
|
@@ -19,8 +22,9 @@ const handleAsyncCallback = (response, resolve, reject, errorMessage) => {
|
|
|
19
22
|
resolve();
|
|
20
23
|
} else {
|
|
21
24
|
reject({
|
|
22
|
-
code:
|
|
23
|
-
message: errorMessage || "Unknown error."
|
|
25
|
+
code: _types.ErrorCode.UNKNOWN,
|
|
26
|
+
message: errorMessage || "Unknown error.",
|
|
27
|
+
type: _types.ErrorType.NON_CRITICAL
|
|
24
28
|
});
|
|
25
29
|
}
|
|
26
30
|
};
|
|
@@ -93,11 +97,51 @@ const promiseWrapper = fn => {
|
|
|
93
97
|
} catch (error) {
|
|
94
98
|
(0, _.logError)(error);
|
|
95
99
|
reject({
|
|
96
|
-
code:
|
|
97
|
-
message: (error === null || error === void 0 ? void 0 : error.message) || "Unknown error."
|
|
100
|
+
code: _types.ErrorCode.UNKNOWN,
|
|
101
|
+
message: (error === null || error === void 0 ? void 0 : error.message) || "Unknown error.",
|
|
102
|
+
type: _types.ErrorType.NON_CRITICAL
|
|
98
103
|
});
|
|
99
104
|
}
|
|
100
105
|
});
|
|
101
106
|
};
|
|
102
107
|
exports.promiseWrapper = promiseWrapper;
|
|
108
|
+
function locationErrorAdapter(error) {
|
|
109
|
+
let adaptedCode = _types.ErrorCode.UNKNOWN;
|
|
110
|
+
const adaptedMessage = error.message;
|
|
111
|
+
const adaptedType = _types.ErrorType.CRITICAL;
|
|
112
|
+
switch (error.code.toString()) {
|
|
113
|
+
case "8001": // MISSING_LOCATION_PERMISSION
|
|
114
|
+
case "8": // kSITLocationErrorLocationDisabled
|
|
115
|
+
case "9": // kSITLocationErrorLocationRestricted
|
|
116
|
+
case "10":
|
|
117
|
+
// kSITLocationErrorLocationAuthStatusNotDetermined
|
|
118
|
+
adaptedCode = _types.ErrorCode.LOCATION_PERMISSION_DENIED;
|
|
119
|
+
break;
|
|
120
|
+
case "8002":
|
|
121
|
+
// LOCATION_DISABLED
|
|
122
|
+
adaptedCode = _types.ErrorCode.LOCATION_DISABLED;
|
|
123
|
+
break;
|
|
124
|
+
case "8012":
|
|
125
|
+
// MISSING_BLUETOOTH_PERMISSION
|
|
126
|
+
adaptedCode = _types.ErrorCode.BLUETOOTH_PERMISSION_DENIED;
|
|
127
|
+
break;
|
|
128
|
+
case "8100": //BLUETOOTH_DISABLED. 8100 ->This number does not exist in Situm SDK. We made it up in SitumMapper.java (RN adapter)
|
|
129
|
+
case "6":
|
|
130
|
+
// kSITLocationErrorBluetoothisOff
|
|
131
|
+
adaptedCode = _types.ErrorCode.BLUETOOTH_DISABLED;
|
|
132
|
+
break;
|
|
133
|
+
case "11":
|
|
134
|
+
//kSITLocationErrorLocationAccuracyAuthorizationStatusReducedAccuracy
|
|
135
|
+
adaptedCode = _types.ErrorCode.REDUCED_ACCURACY;
|
|
136
|
+
break;
|
|
137
|
+
// Add more cases as needed
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const returnError = {
|
|
141
|
+
code: adaptedCode,
|
|
142
|
+
message: adaptedMessage,
|
|
143
|
+
type: adaptedType
|
|
144
|
+
};
|
|
145
|
+
return returnError;
|
|
146
|
+
}
|
|
103
147
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_","require","handleAsyncCallback","response","resolve","reject","errorMessage","success","code","message","exports","handleSyncCallback","r","exceptionWrapper","fn","returnValue","onCallback","onSuccess","onError","error","logError","promiseWrapper","Promise"],"sourceRoot":"../../../src","sources":["sdk/utils.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_","require","_types","handleAsyncCallback","response","resolve","reject","errorMessage","success","code","ErrorCode","UNKNOWN","message","type","ErrorType","NON_CRITICAL","exports","handleSyncCallback","r","exceptionWrapper","fn","returnValue","onCallback","onSuccess","onError","error","logError","promiseWrapper","Promise","locationErrorAdapter","adaptedCode","adaptedMessage","adaptedType","CRITICAL","toString","LOCATION_PERMISSION_DENIED","LOCATION_DISABLED","BLUETOOTH_PERMISSION_DENIED","BLUETOOTH_DISABLED","REDUCED_ACCURACY","returnError"],"sourceRoot":"../../../src","sources":["sdk/utils.ts"],"mappings":";;;;;;;;AAAA,IAAAA,CAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAME,mBAAmB,GAAGA,CACjCC,QAA8B,EAC9BC,OAA6B,EAC7BC,MAAqB,EACrBC,YAAoB,KACjB;EACH,IAAIH,QAAQ,aAARA,Q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E;MACXN,WAAW,GAAGpB,gBAAS,CAAC2B,2BAA2B;MACnD;IACF,KAAK,MAAM,CAAC,CAAC;IACb,KAAK,GAAG;MAAE;MACRP,WAAW,GAAGpB,gBAAS,CAAC4B,kBAAkB;MAC1C;IACF,KAAK,IAAI;MAAE;MACTR,WAAW,GAAGpB,gBAAS,CAAC6B,gBAAgB;MACxC;IACF;EACF;;EAEA,MAAMC,WAAkB,GAAG;IACzB/B,IAAI,EAAEqB,WAAW;IACjBlB,OAAO,EAAEmB,cAAc;IACvBlB,IAAI,EAAEmB;EACR,CAAC;EAED,OAAOQ,WAAW;AACpB"}
|
|
@@ -8,27 +8,14 @@ var _reactNative = require("react-native");
|
|
|
8
8
|
var _reactNativePermissions = require("react-native-permissions");
|
|
9
9
|
// TODO: can requestMultiple be used ?
|
|
10
10
|
const checkIOSPermissions = async () => {
|
|
11
|
-
|
|
11
|
+
const granted = await (0, _reactNativePermissions.request)(_reactNativePermissions.PERMISSIONS.IOS.LOCATION_WHEN_IN_USE);
|
|
12
12
|
|
|
13
13
|
// Check if already denied
|
|
14
14
|
if (granted !== _reactNativePermissions.RESULTS.GRANTED) {
|
|
15
15
|
throw "Situm > permissions > ACCESS_FINE_LOCATION denied";
|
|
16
16
|
}
|
|
17
17
|
console.debug("Situm > permissions > LOCATION_WHEN_IN_USE permission granted");
|
|
18
|
-
|
|
19
|
-
//@ts-ignore
|
|
20
|
-
if (parseInt(_reactNative.Platform.Version, 10) > 12) {
|
|
21
|
-
granted = await (0, _reactNativePermissions.request)(_reactNativePermissions.PERMISSIONS.IOS.BLUETOOTH_PERIPHERAL);
|
|
22
|
-
if (granted === _reactNativePermissions.RESULTS.GRANTED) {
|
|
23
|
-
console.debug("Situm > permissions > BLUETOOTH_PERIPHERAL permission granted");
|
|
24
|
-
return true;
|
|
25
|
-
} else {
|
|
26
|
-
throw "Situm > permissions > BLUETOOTH_PERIPHERAL permission not granted";
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
console.debug("Situm > permissions > BLUETOOTH_PERIPHERAL permissions not required");
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
18
|
+
return true;
|
|
32
19
|
};
|
|
33
20
|
const checkAndroidPermissions = async () => {
|
|
34
21
|
let granted;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_reactNativePermissions","checkIOSPermissions","granted","request","PERMISSIONS","IOS","LOCATION_WHEN_IN_USE","RESULTS","GRANTED","console","debug","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_reactNativePermissions","checkIOSPermissions","granted","request","PERMISSIONS","IOS","LOCATION_WHEN_IN_USE","RESULTS","GRANTED","console","debug","checkAndroidPermissions","Platform","Version","ANDROID","ACCESS_FINE_LOCATION","requestMultiple","BLUETOOTH_CONNECT","BLUETOOTH_SCAN","requestPermission","OS","includes","then","catch","e","warn","exports","_default","default"],"sourceRoot":"../../../src","sources":["utils/requestPermission.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAOA;AACA,MAAME,mBAAmB,GAAG,MAAAA,CAAA,KAAY;EACtC,MAAMC,OAAO,GAAG,MAAM,IAAAC,+BAAO,EAACC,mCAAW,CAACC,GAAG,CAACC,oBAAoB,CAAC;;EAEnE;EACA,IAAIJ,OAAO,KAAKK,+BAAO,CAACC,OAAO,EAAE;IAC/B,MAAM,mDAAmD;EAC3D;EAEAC,OAAO,CAACC,KAAK,CACX,+DACF,CAAC;EAED,OAAO,IAAI;AACb,CAAC;AAED,MAAMC,uBAAuB,GAAG,MAAAA,CAAA,KAAY;EAC1C,IAAIT,OAAO;;EAEX;EACA,IAAIU,qBAAQ,CAACC,OAAO,IAAI,EAAE,EAAE;IAC1BJ,OAAO,CAACC,KAAK,CAAC,4CAA4C,CAAC;IAE3DR,OAAO,GAAG,MAAM,IAAAC,+BAAO,EAACC,mCAAW,CAACU,OAAO,CAACC,oBAAoB,CAAC;IAEjE,I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AACE,OAAA,CAAAP,iBAAA,GAAAA,iBAAA;AAAA,IAAAQ,QAAA,GAEaR,iBAAiB;AAAAO,OAAA,CAAAE,OAAA,GAAAD,QAAA"}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useSitumInternal = exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _sdk = _interopRequireDefault(require("../../sdk"));
|
|
9
|
+
var _types = require("../../sdk/types");
|
|
9
10
|
var _constants = require("../../sdk/types/constants");
|
|
10
11
|
var _index = require("../store/index");
|
|
11
12
|
var _utils = require("../store/utils");
|
|
@@ -43,11 +44,6 @@ const useSitumInternal = () => {
|
|
|
43
44
|
});
|
|
44
45
|
_sdk.default.onLocationError(err => {
|
|
45
46
|
console.error(`Situm > hook > Error while positioning: ${err}}`);
|
|
46
|
-
//@ts-ignore
|
|
47
|
-
dispatch((0, _index.setError)({
|
|
48
|
-
message: err,
|
|
49
|
-
code: 3001
|
|
50
|
-
}));
|
|
51
47
|
});
|
|
52
48
|
_sdk.default.onLocationStopped(() => {
|
|
53
49
|
console.debug("Situm > hook > Stopped positioning");
|
|
@@ -157,9 +153,11 @@ const useSitumInternal = () => {
|
|
|
157
153
|
});
|
|
158
154
|
} catch (e) {
|
|
159
155
|
console.error(`Situm > hook > Could not update navigation ${e}`);
|
|
156
|
+
//TODO: Remove this and emit these errors in SitumPlugin.onNavigationError
|
|
160
157
|
dispatch((0, _index.setError)({
|
|
161
|
-
message: "
|
|
162
|
-
code:
|
|
158
|
+
message: "Could not update navigation",
|
|
159
|
+
code: _types.ErrorCode.UNKNOWN,
|
|
160
|
+
type: _types.ErrorType.NON_CRITICAL
|
|
163
161
|
}));
|
|
164
162
|
stopNavigation();
|
|
165
163
|
}
|
|
@@ -168,11 +166,11 @@ const useSitumInternal = () => {
|
|
|
168
166
|
});
|
|
169
167
|
};
|
|
170
168
|
const stopNavigation = () => {
|
|
171
|
-
console.debug("Situm > hook > Stopping navigation");
|
|
172
169
|
// TODO: we should delegate this to the sdk plugin
|
|
173
170
|
if (!navigation || (navigation === null || navigation === void 0 ? void 0 : navigation.status) === _constants.NavigationStatus.STOP) {
|
|
174
171
|
return;
|
|
175
172
|
}
|
|
173
|
+
console.debug("Situm > hook > Stopping navigation");
|
|
176
174
|
_sdk.default.removeNavigationUpdates().then(() => {
|
|
177
175
|
console.debug("Situm > hook > Successfully removed navigation updates");
|
|
178
176
|
dispatch((0, _index.setNavigation)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_sdk","_interopRequireDefault","_constants","_index","_utils","_mapper","obj","__esModule","default","defaultNavigationRequest","distanceToGoalThreshold","outsideRouteThreshold","useSitumInternal","dispatch","useDispatch","location","useSelector","selectLocation","locationStatus","selectLocationStatus","directions","selectDirections","navigation","selectNavigation","error","selectError","lockDirections","setLockDirections","useState","init","console","debug","registerCallbacks","SitumPlugin","onLocationUpdate","loc","setLocation","onLocationStatus","status","statusName","LocationStatusName","setLocationStatus","onLocationError","err","
|
|
1
|
+
{"version":3,"names":["_react","require","_sdk","_interopRequireDefault","_types","_constants","_index","_utils","_mapper","obj","__esModule","default","defaultNavigationRequest","distanceToGoalThreshold","outsideRouteThreshold","useSitumInternal","dispatch","useDispatch","location","useSelector","selectLocation","locationStatus","selectLocationStatus","directions","selectDirections","navigation","selectNavigation","error","selectError","lockDirections","setLockDirections","useState","init","console","debug","registerCallbacks","SitumPlugin","onLocationUpdate","loc","setLocation","onLocationStatus","status","statusName","LocationStatusName","setLocationStatus","onLocationError","err","onLocationStopped","resetLocation","onNavigationProgress","progress","setNavigation","currentIndication","routeStep","distanceToGoal","points","type","NavigationUpdateType","PROGRESS","segments","NavigationStatus","UPDATE","onNavigationOutOfRoute","OUT_OF_ROUTE","onNavigationFinished","FINISHED","onNavigationError","calculateRoute","payload","updateRoute","arguments","length","undefined","to","from","minimizeFloorChanges","accessibilityMode","bearingFrom","createDirectionsRequest","directionsRequest","originIdentifier","destinationIdentifier","buildingIdentifier","createDirectionsMessage","_buildings","fetchBuildings","_building","find","b","requestDirections","then","_directions","newRoute","setDirections","catch","e","JSON","stringify","finally","startNavigation","STOP","stopNavigation","r","START","navigationRequest","createNavigationRequest","requestNavigationUpdates","setError","message","code","ErrorCode","UNKNOWN","ErrorType","NON_CRITICAL","removeNavigationUpdates","warn","exports","useSitum","context","useContext","UseSitumContext","Error","_default"],"sourceRoot":"../../../../src","sources":["wayfinding/hooks/index.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AASA,IAAAI,UAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAcA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAIyB,SAAAE,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AArCzB;;AAuCA,MAAMG,wBAAwB,GAAG;EAC/BC,uBAAuB,EAAE,CAAC;EAC1BC,qBAAqB,EAAE;AACzB,CAAC;AAEM,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EACpC,MAAMC,QAAQ,GAAG,IAAAC,kBAAW,EAAC,CAAC;EAE9B,MAAMC,QAAQ,GAAG,IAAAC,kBAAW,EAACC,qBAAc,CAAC;EAC5C,MAAMC,cAAc,GAAG,IAAAF,kBAAW,EAACG,2BAAoB,CAAC;EAExD,MAAMC,UAAU,GAAG,IAAAJ,kBAAW,EAACK,uBAAgB,CAAC;EAChD,MAAMC,UAAU,GAAG,IAAAN,kBAAW,EAACO,uBAAgB,CAAC;EAChD,MAAMC,KAAK,GAAG,IAAAR,kBAAW,EAACS,kBAAW,CAAC;EAEtC,MAAM,CAACC,cAAc,EAAEC,iBAAiB,CAAC,GAAG,IAAAC,eAAQ,EAA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AC5E,UAAU,IAAI,CAAAA,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEgB,MAAM,MAAKmB,2BAAgB,CAACwC,IAAI,EAAE;MAC/D;IACF;IACAnE,OAAO,CAACC,KAAK,CAAC,oCAAoC,CAAC;IAEnDE,YAAW,CAAC8E,uBAAuB,CAAC,CAAC,CAClCxB,IAAI,CAAC,MAAM;MACVzD,OAAO,CAACC,KAAK,CAAC,wDAAwD,CAAC;MACvElB,QAAQ,CAAC,IAAAmC,oBAAa,EAAC;QAAEV,MAAM,EAAEmB,2BAAgB,CAACwC;MAAK,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC,CACDN,KAAK,CAAEC,CAAC,IAAK;MACZ9D,OAAO,CAACkF,IAAI,CAAE,sDAAqDpB,CAAE,EAAC,CAAC;IACzE,CAAC,CAAC;EACN,CAAC;EAED,OAAO;IACL;IACA7E,QAAQ;IACRG,cAAc;IAEdE,UAAU;IACVE,UAAU;IACVE,KAAK;IAEL;IACAK,IAAI;IACJmC,cAAc;IACdgC,eAAe;IACfE;EACF,CAAC;AACH,CAAC;AAACe,OAAA,CAAArG,gBAAA,GAAAA,gBAAA;AAEF,MAAMsG,QAAQ,GAAGA,CAAA,KAAM;EACrB,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACC,sBAAe,CAAC;EAE3C,IAAI,CAACF,OAAO,EAAE;IACZ,MAAM,IAAIG,KAAK,CAAC,wCAAwC,CAAC;EAC3D;EAEA,OAAOH,OAAO,CAACD,QAAQ;AACzB,CAAC;AAAC,IAAAK,QAAA,GAEaL,QAAQ;AAAAD,OAAA,CAAAzG,OAAA,GAAA+G,QAAA"}
|
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SitumPlugin"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,OAAOA,WAAW,MAAM,OAAO;;AAE/B
|
|
1
|
+
{"version":3,"names":["SitumPlugin"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,OAAOA,WAAW,MAAM,OAAO;;AAE/B;AACA,cAAc,aAAa;AAG3B;AACA,cAAc,OAAO;AACrB,cAAc,SAAS;AACvB,cAAc,cAAc;AAE5B,eAAeA,WAAW"}
|