@situm/react-native 3.15.0-beta.1 → 3.15.0-beta.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/android/src/main/java/com/situm/plugin/PluginHelper.java +1 -1
- package/android/src/main/java/com/situm/plugin/SitumPluginImpl.java +1 -1
- package/ios/SitumPlugin.m +14 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/sdk/index.js.map +1 -1
- package/lib/commonjs/sdk/internaDelegatedState.js.map +1 -0
- package/lib/commonjs/sdk/nativeInterface.js.map +1 -1
- package/lib/commonjs/sdk/types/constants.js.map +1 -1
- package/lib/commonjs/sdk/types/index.js.map +1 -1
- package/lib/commonjs/sdk/utils.js.map +1 -1
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/logError.js.map +1 -1
- package/lib/commonjs/wayfinding/index.js.map +1 -1
- package/lib/commonjs/wayfinding/types/index.js.map +1 -1
- package/lib/commonjs/wayfinding/utils/index.js.map +1 -1
- package/lib/commonjs/wayfinding/utils/mapper.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/sdk/index.js.map +0 -1
- package/lib/module/sdk/internaDelegatedState.js.map +1 -0
- package/lib/module/sdk/nativeInterface.js.map +1 -1
- package/lib/module/sdk/types/constants.js.map +1 -1
- package/lib/module/sdk/types/index.js.map +1 -1
- package/lib/module/sdk/utils.js.map +1 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/logError.js.map +0 -1
- package/lib/module/wayfinding/index.js.map +1 -1
- package/lib/module/wayfinding/types/constants.js.map +1 -1
- package/lib/module/wayfinding/types/index.js.map +0 -1
- package/lib/module/wayfinding/utils/index.js.map +1 -1
- package/lib/module/wayfinding/utils/mapper.js.map +1 -1
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/{src/sdk → sdk}/index.d.ts +25 -32
- package/lib/typescript/sdk/index.d.ts.map +1 -0
- package/lib/typescript/sdk/internaDelegatedState.d.ts +17 -0
- package/lib/typescript/sdk/internaDelegatedState.d.ts.map +1 -0
- package/lib/typescript/{src/sdk → sdk}/nativeInterface.d.ts +4 -2
- package/lib/typescript/sdk/nativeInterface.d.ts.map +1 -0
- package/lib/typescript/sdk/types/constants.d.ts.map +1 -0
- package/lib/typescript/{src/sdk → sdk}/types/index.d.ts +2 -1
- package/lib/typescript/sdk/types/index.d.ts.map +1 -0
- package/lib/typescript/{src/sdk → sdk}/utils.d.ts +1 -1
- package/lib/typescript/sdk/utils.d.ts.map +1 -0
- package/lib/typescript/utils/index.d.ts.map +1 -0
- package/lib/typescript/utils/logError.d.ts.map +1 -0
- package/lib/typescript/{src/wayfinding → wayfinding}/components/MapView.d.ts +1 -1
- package/lib/typescript/wayfinding/components/MapView.d.ts.map +1 -0
- package/lib/typescript/wayfinding/hooks/index.d.ts.map +1 -0
- package/lib/typescript/wayfinding/index.d.ts.map +1 -0
- package/lib/typescript/{src/wayfinding → wayfinding}/store/index.d.ts +13 -13
- package/lib/typescript/wayfinding/store/index.d.ts.map +1 -0
- package/lib/typescript/{src/wayfinding → wayfinding}/store/utils.d.ts +0 -1
- package/lib/typescript/wayfinding/store/utils.d.ts.map +1 -0
- package/lib/typescript/wayfinding/types/constants.d.ts.map +1 -0
- package/lib/typescript/{src/wayfinding → wayfinding}/types/index.d.ts +1 -1
- package/lib/typescript/wayfinding/types/index.d.ts.map +1 -0
- package/lib/typescript/wayfinding/utils/index.d.ts +3 -0
- package/lib/typescript/wayfinding/utils/index.d.ts.map +1 -0
- package/lib/typescript/wayfinding/utils/mapper.d.ts.map +1 -0
- package/package.json +24 -35
- package/src/sdk/index.ts +67 -52
- package/src/sdk/internaDelegatedState.ts +54 -0
- package/src/sdk/nativeInterface.ts +31 -27
- package/src/sdk/types/index.ts +7 -6
- package/src/sdk/utils.ts +12 -9
- package/src/utils/logError.ts +1 -1
- package/src/wayfinding/components/MapView.tsx +103 -104
- package/src/wayfinding/hooks/index.ts +94 -91
- package/src/wayfinding/store/index.tsx +4 -4
- package/src/wayfinding/types/index.ts +1 -1
- package/src/wayfinding/utils/index.ts +2 -1
- package/LICENSE +0 -21
- package/README.md +0 -200
- package/SECURITY-POLICY.md +0 -9
- package/lib/commonjs/index.js +0 -73
- package/lib/commonjs/sdk/index.js +0 -932
- package/lib/commonjs/sdk/nativeInterface.js +0 -20
- package/lib/commonjs/sdk/types/constants.js +0 -68
- package/lib/commonjs/sdk/types/index.js +0 -405
- package/lib/commonjs/sdk/utils.js +0 -156
- package/lib/commonjs/utils/index.js +0 -17
- package/lib/commonjs/utils/logError.js +0 -21
- package/lib/commonjs/wayfinding/components/MapView.js +0 -389
- package/lib/commonjs/wayfinding/components/MapView.js.map +0 -1
- package/lib/commonjs/wayfinding/hooks/index.js +0 -229
- package/lib/commonjs/wayfinding/hooks/index.js.map +0 -1
- package/lib/commonjs/wayfinding/index.js +0 -57
- package/lib/commonjs/wayfinding/store/index.js +0 -242
- package/lib/commonjs/wayfinding/store/index.js.map +0 -1
- package/lib/commonjs/wayfinding/store/utils.js +0 -49
- package/lib/commonjs/wayfinding/store/utils.js.map +0 -1
- package/lib/commonjs/wayfinding/types/constants.js +0 -13
- package/lib/commonjs/wayfinding/types/constants.js.map +0 -1
- package/lib/commonjs/wayfinding/types/index.js +0 -6
- package/lib/commonjs/wayfinding/utils/index.js +0 -11
- package/lib/commonjs/wayfinding/utils/mapper.js +0 -206
- package/lib/module/index.js +0 -12
- package/lib/module/sdk/index.js +0 -903
- package/lib/module/sdk/nativeInterface.js +0 -18
- package/lib/module/sdk/types/constants.js +0 -63
- package/lib/module/sdk/types/index.js +0 -434
- package/lib/module/sdk/utils.js +0 -144
- package/lib/module/utils/index.js +0 -2
- package/lib/module/utils/logError.js +0 -15
- package/lib/module/wayfinding/components/MapView.js +0 -379
- package/lib/module/wayfinding/components/MapView.js.map +0 -1
- package/lib/module/wayfinding/hooks/index.js +0 -220
- package/lib/module/wayfinding/hooks/index.js.map +0 -1
- package/lib/module/wayfinding/index.js +0 -13
- package/lib/module/wayfinding/store/index.js +0 -206
- package/lib/module/wayfinding/store/index.js.map +0 -1
- package/lib/module/wayfinding/store/utils.js +0 -38
- package/lib/module/wayfinding/store/utils.js.map +0 -1
- package/lib/module/wayfinding/types/constants.js +0 -7
- package/lib/module/wayfinding/types/index.js +0 -2
- package/lib/module/wayfinding/utils/index.js +0 -4
- package/lib/module/wayfinding/utils/mapper.js +0 -195
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/sdk/index.d.ts.map +0 -1
- package/lib/typescript/src/sdk/nativeInterface.d.ts.map +0 -1
- package/lib/typescript/src/sdk/types/constants.d.ts.map +0 -1
- package/lib/typescript/src/sdk/types/index.d.ts.map +0 -1
- package/lib/typescript/src/sdk/utils.d.ts.map +0 -1
- package/lib/typescript/src/utils/index.d.ts.map +0 -1
- package/lib/typescript/src/utils/logError.d.ts.map +0 -1
- package/lib/typescript/src/wayfinding/components/MapView.d.ts.map +0 -1
- package/lib/typescript/src/wayfinding/hooks/index.d.ts.map +0 -1
- package/lib/typescript/src/wayfinding/index.d.ts.map +0 -1
- package/lib/typescript/src/wayfinding/store/index.d.ts.map +0 -1
- package/lib/typescript/src/wayfinding/store/utils.d.ts.map +0 -1
- package/lib/typescript/src/wayfinding/types/constants.d.ts.map +0 -1
- package/lib/typescript/src/wayfinding/types/index.d.ts.map +0 -1
- package/lib/typescript/src/wayfinding/utils/index.d.ts +0 -3
- package/lib/typescript/src/wayfinding/utils/index.d.ts.map +0 -1
- package/lib/typescript/src/wayfinding/utils/mapper.d.ts.map +0 -1
- package/security.txt +0 -4
- /package/lib/typescript/{src/index.d.ts → index.d.ts} +0 -0
- /package/lib/typescript/{src/sdk → sdk}/types/constants.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/index.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/logError.d.ts +0 -0
- /package/lib/typescript/{src/wayfinding → wayfinding}/hooks/index.d.ts +0 -0
- /package/lib/typescript/{src/wayfinding → wayfinding}/index.d.ts +0 -0
- /package/lib/typescript/{src/wayfinding → wayfinding}/types/constants.d.ts +0 -0
- /package/lib/typescript/{src/wayfinding → wayfinding}/utils/mapper.d.ts +0 -0
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
-
import React, { useCallback, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
4
|
-
import { Linking, Platform, StyleSheet } from "react-native";
|
|
5
|
-
import WebView from "react-native-webview";
|
|
6
|
-
import SitumPlugin from "../../sdk";
|
|
7
|
-
import useSitum from "../hooks";
|
|
8
|
-
import { ErrorName } from "../types/constants";
|
|
9
|
-
import { sendMessageToViewer } from "../utils";
|
|
10
|
-
import ViewerMapper from "../utils/mapper";
|
|
11
|
-
import { setError, setLocationStatus } from "../store";
|
|
12
|
-
const SITUM_BASE_DOMAIN = "https://map-viewer.situm.com";
|
|
13
|
-
const NETWORK_ERROR_CODE = {
|
|
14
|
-
android: -2,
|
|
15
|
-
ios: -1009,
|
|
16
|
-
// These platforms are unhandled
|
|
17
|
-
windows: 0,
|
|
18
|
-
macos: 0,
|
|
19
|
-
web: 0
|
|
20
|
-
};
|
|
21
|
-
const viewerStyles = StyleSheet.create({
|
|
22
|
-
webview: {
|
|
23
|
-
minHeight: "100%",
|
|
24
|
-
minWidth: "100%"
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
const MapView = /*#__PURE__*/React.forwardRef(({
|
|
28
|
-
configuration,
|
|
29
|
-
style,
|
|
30
|
-
onLoad = () => {},
|
|
31
|
-
onLoadError = () => {},
|
|
32
|
-
onPoiSelected = () => {},
|
|
33
|
-
onPoiDeselected = () => {},
|
|
34
|
-
onFloorChanged = () => {},
|
|
35
|
-
onExternalLinkClicked = undefined,
|
|
36
|
-
onFavoritePoisUpdated = () => {}
|
|
37
|
-
}, ref) => {
|
|
38
|
-
const webViewRef = useRef();
|
|
39
|
-
const [_onDirectionsRequestInterceptor, setInterceptor] = useState();
|
|
40
|
-
|
|
41
|
-
// Local states
|
|
42
|
-
const [mapLoaded, setMapLoaded] = useState(false);
|
|
43
|
-
const [buildingIdentifier, setBuildingIdentifier] = useState(configuration.buildingIdentifier);
|
|
44
|
-
const {
|
|
45
|
-
init,
|
|
46
|
-
location,
|
|
47
|
-
locationStatus,
|
|
48
|
-
directions,
|
|
49
|
-
navigation,
|
|
50
|
-
calculateRoute,
|
|
51
|
-
startNavigation,
|
|
52
|
-
stopNavigation,
|
|
53
|
-
error
|
|
54
|
-
} = useSitum();
|
|
55
|
-
const sendFollowUser = () => {
|
|
56
|
-
var _location$position;
|
|
57
|
-
if (webViewRef.current && mapLoaded && (location === null || location === void 0 || (_location$position = location.position) === null || _location$position === void 0 ? void 0 : _location$position.buildingIdentifier) === configuration.buildingIdentifier) {
|
|
58
|
-
_followUser(true);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// Helper functions used on imperative handler
|
|
63
|
-
// Navigation
|
|
64
|
-
const _navigateToPoi = useCallback(payload => {
|
|
65
|
-
if (!webViewRef.current || !payload || !payload.identifier) return;
|
|
66
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.navigateToPoi(payload));
|
|
67
|
-
}, []);
|
|
68
|
-
const _followUser = useCallback(payload => {
|
|
69
|
-
if (!webViewRef.current) return;
|
|
70
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.followUser(payload));
|
|
71
|
-
}, []);
|
|
72
|
-
const _navigateToCar = useCallback(payload => {
|
|
73
|
-
if (!webViewRef.current) return;
|
|
74
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.navigateToCar(payload));
|
|
75
|
-
}, []);
|
|
76
|
-
const _navigateToPoint = useCallback(payload => {
|
|
77
|
-
if (!webViewRef.current || !(payload !== null && payload !== void 0 && payload.lat) && !(payload !== null && payload !== void 0 && payload.lng) && !(payload !== null && payload !== void 0 && payload.floorIdentifier)) return;
|
|
78
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.navigateToPoint(payload));
|
|
79
|
-
}, []);
|
|
80
|
-
|
|
81
|
-
// Cartography
|
|
82
|
-
const _selectPoi = useCallback(poiId => {
|
|
83
|
-
if (!webViewRef.current) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.selectPoi(poiId));
|
|
87
|
-
}, []);
|
|
88
|
-
const _selectCar = useCallback(() => {
|
|
89
|
-
if (!webViewRef.current) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.selectCar());
|
|
93
|
-
}, []);
|
|
94
|
-
const _selectPoiCategory = useCallback(categoryId => {
|
|
95
|
-
if (!webViewRef.current) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (SitumPlugin.navigationIsRunning()) {
|
|
99
|
-
console.error("Situm > hook > Navigation on course, poi category selection is unavailable");
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.selectPoiCategory(categoryId));
|
|
103
|
-
}, []);
|
|
104
|
-
const _selectFloor = useCallback((floorId, options) => {
|
|
105
|
-
if (!webViewRef.current) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
if (SitumPlugin.navigationIsRunning()) {
|
|
109
|
-
console.error("Situm > hook > Navigation on course, floor selection is unavailable");
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.selectFloor(floorId, options));
|
|
113
|
-
}, []);
|
|
114
|
-
const _search = useCallback(payload => {
|
|
115
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.search(payload));
|
|
116
|
-
}, []);
|
|
117
|
-
const _setDirectionsOptions = useCallback(directionsOptions => {
|
|
118
|
-
if (!webViewRef.current) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.setDirectionsOptions(directionsOptions));
|
|
122
|
-
}, []);
|
|
123
|
-
const _setFavoritePois = useCallback(poiIds => {
|
|
124
|
-
if (!webViewRef.current) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.setFavoritePois(poiIds));
|
|
128
|
-
}, []);
|
|
129
|
-
const _onMapIsReady = () => {
|
|
130
|
-
if (locationStatus) {
|
|
131
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.locationStatus(locationStatus));
|
|
132
|
-
}
|
|
133
|
-
if (error) {
|
|
134
|
-
// Right now, status and errors share message on the viewer:
|
|
135
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.locationError(error));
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* API exported to the outside world from the MapViewer
|
|
141
|
-
*
|
|
142
|
-
* These handler allows third party developers to send actions to the MapView.
|
|
143
|
-
* please check the MapViewRef type definitions to know the public API.
|
|
144
|
-
*
|
|
145
|
-
* <MapView
|
|
146
|
-
* ref={(ref: MapViewRef) => ref.selectPoi(122)}
|
|
147
|
-
* configuration={{
|
|
148
|
-
* buildingIdentifier: SITUM_BUILDING_ID,
|
|
149
|
-
* }}
|
|
150
|
-
* onLoad={onLoad} />
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
|
-
useImperativeHandle(ref, () => {
|
|
154
|
-
return {
|
|
155
|
-
followUser() {
|
|
156
|
-
_followUser(true);
|
|
157
|
-
},
|
|
158
|
-
unfollowUser() {
|
|
159
|
-
_followUser(false);
|
|
160
|
-
},
|
|
161
|
-
selectPoi(poiId) {
|
|
162
|
-
_selectPoi(poiId);
|
|
163
|
-
},
|
|
164
|
-
selectCar() {
|
|
165
|
-
_selectCar();
|
|
166
|
-
},
|
|
167
|
-
selectPoiCategory(poiId) {
|
|
168
|
-
_selectPoiCategory(poiId);
|
|
169
|
-
},
|
|
170
|
-
selectFloor(poiId, options) {
|
|
171
|
-
_selectFloor(poiId, options);
|
|
172
|
-
},
|
|
173
|
-
setDirectionsOptions(directionsOptions) {
|
|
174
|
-
_setDirectionsOptions(directionsOptions);
|
|
175
|
-
},
|
|
176
|
-
setFavoritePois(poiIds) {
|
|
177
|
-
_setFavoritePois(poiIds);
|
|
178
|
-
},
|
|
179
|
-
deselectPoi() {
|
|
180
|
-
webViewRef.current && sendMessageToViewer(webViewRef.current, ViewerMapper.selectPoi(null));
|
|
181
|
-
},
|
|
182
|
-
navigateToPoi(payload) {
|
|
183
|
-
_navigateToPoi(payload);
|
|
184
|
-
},
|
|
185
|
-
navigateToCar(payload) {
|
|
186
|
-
_navigateToCar(payload);
|
|
187
|
-
},
|
|
188
|
-
navigateToPoint(payload) {
|
|
189
|
-
_navigateToPoint(payload);
|
|
190
|
-
},
|
|
191
|
-
setOnDirectionsRequestInterceptor(directionRequestInterceptor) {
|
|
192
|
-
setInterceptor(() => directionRequestInterceptor);
|
|
193
|
-
},
|
|
194
|
-
cancelNavigation() {
|
|
195
|
-
if (!webViewRef.current) return;
|
|
196
|
-
stopNavigation();
|
|
197
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.cancelNavigation());
|
|
198
|
-
},
|
|
199
|
-
search(payload) {
|
|
200
|
-
_search(payload);
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
}, [stopNavigation, _navigateToPoi, _followUser, _navigateToCar, _navigateToPoint, _selectPoi, _selectCar, _selectPoiCategory, _selectFloor, _setDirectionsOptions, _setFavoritePois, _search]);
|
|
204
|
-
useEffect(() => {
|
|
205
|
-
SitumPlugin.validateMapViewProjectSettings();
|
|
206
|
-
return () => {};
|
|
207
|
-
}, []);
|
|
208
|
-
useEffect(() => {
|
|
209
|
-
if (!error) return;
|
|
210
|
-
console.error("Error code:", error.code ? error.code : " no code provided");
|
|
211
|
-
console.error("Error detected:", error.message);
|
|
212
|
-
}, [error]);
|
|
213
|
-
|
|
214
|
-
// Updated SDK location
|
|
215
|
-
useEffect(() => {
|
|
216
|
-
if (!webViewRef.current || !location || !mapLoaded) return;
|
|
217
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.location(location));
|
|
218
|
-
}, [location, mapLoaded]);
|
|
219
|
-
|
|
220
|
-
// locationStatus
|
|
221
|
-
useEffect(() => {
|
|
222
|
-
if (!webViewRef.current || !locationStatus || !mapLoaded) return;
|
|
223
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.locationStatus(locationStatus));
|
|
224
|
-
// Callbacks used in `useEffect` won't be invoked if the value of locationStatus
|
|
225
|
-
// is set but hasn't changed. Set locationStatus to null always to avoid missing
|
|
226
|
-
// repeated messages.
|
|
227
|
-
setLocationStatus(null);
|
|
228
|
-
}, [locationStatus, mapLoaded]);
|
|
229
|
-
|
|
230
|
-
// locationError
|
|
231
|
-
useEffect(() => {
|
|
232
|
-
if (!webViewRef.current || !error || !mapLoaded) return;
|
|
233
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.locationError(error));
|
|
234
|
-
// Callbacks used in `useEffect` won't be invoked if the value of locationStatus
|
|
235
|
-
// is set but hasn't changed. Set locationStatus to null always to avoid missing
|
|
236
|
-
// repeated messages.
|
|
237
|
-
setError(null);
|
|
238
|
-
}, [error, mapLoaded]);
|
|
239
|
-
|
|
240
|
-
// Updated SDK navigation
|
|
241
|
-
useEffect(() => {
|
|
242
|
-
if (!webViewRef.current || !navigation || !mapLoaded) return;
|
|
243
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.navigation(navigation));
|
|
244
|
-
}, [navigation, mapLoaded]);
|
|
245
|
-
|
|
246
|
-
// Updated SDK route
|
|
247
|
-
useEffect(() => {
|
|
248
|
-
if (!webViewRef.current || !directions || !mapLoaded) return;
|
|
249
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.route(directions));
|
|
250
|
-
}, [directions, mapLoaded]);
|
|
251
|
-
|
|
252
|
-
// Update language
|
|
253
|
-
useEffect(() => {
|
|
254
|
-
if (!webViewRef.current || !configuration.language || !mapLoaded) return;
|
|
255
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.setLanguage(configuration.language));
|
|
256
|
-
}, [configuration.language, mapLoaded]);
|
|
257
|
-
|
|
258
|
-
// Update SDK configuration
|
|
259
|
-
useEffect(() => {
|
|
260
|
-
if (webViewRef.current && mapLoaded) {
|
|
261
|
-
sendMessageToViewer(webViewRef.current, ViewerMapper.initialConfiguration(style));
|
|
262
|
-
}
|
|
263
|
-
}, [webViewRef, mapLoaded, style]);
|
|
264
|
-
|
|
265
|
-
// Update follow user
|
|
266
|
-
useEffect(() => {
|
|
267
|
-
mapLoaded && sendFollowUser();
|
|
268
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
269
|
-
}, [mapLoaded]);
|
|
270
|
-
const handleRequestFromViewer = event => {
|
|
271
|
-
const eventParsed = JSON.parse(event.nativeEvent.data);
|
|
272
|
-
switch (eventParsed.type) {
|
|
273
|
-
case "app.map_is_ready":
|
|
274
|
-
init();
|
|
275
|
-
setMapLoaded(true);
|
|
276
|
-
_onMapIsReady();
|
|
277
|
-
onLoad && onLoad("");
|
|
278
|
-
break;
|
|
279
|
-
case "directions.requested":
|
|
280
|
-
calculateRoute(eventParsed.payload, _onDirectionsRequestInterceptor);
|
|
281
|
-
break;
|
|
282
|
-
case "navigation.requested":
|
|
283
|
-
startNavigation(eventParsed.payload, _onDirectionsRequestInterceptor);
|
|
284
|
-
break;
|
|
285
|
-
case "navigation.stopped":
|
|
286
|
-
stopNavigation();
|
|
287
|
-
break;
|
|
288
|
-
case "cartography.poi_selected":
|
|
289
|
-
onPoiSelected(eventParsed === null || eventParsed === void 0 ? void 0 : eventParsed.payload);
|
|
290
|
-
break;
|
|
291
|
-
case "cartography.poi_deselected":
|
|
292
|
-
onPoiDeselected(eventParsed === null || eventParsed === void 0 ? void 0 : eventParsed.payload);
|
|
293
|
-
break;
|
|
294
|
-
case "ui.favorite_pois_updated":
|
|
295
|
-
{
|
|
296
|
-
const favoritePoisIds = {
|
|
297
|
-
currentPoisIdentifiers: eventParsed.payload.favoritePois ? [...eventParsed.payload.favoritePois] : []
|
|
298
|
-
};
|
|
299
|
-
onFavoritePoisUpdated(favoritePoisIds);
|
|
300
|
-
break;
|
|
301
|
-
}
|
|
302
|
-
case "cartography.floor_selected":
|
|
303
|
-
onFloorChanged(eventParsed === null || eventParsed === void 0 ? void 0 : eventParsed.payload);
|
|
304
|
-
break;
|
|
305
|
-
case "cartography.building_selected":
|
|
306
|
-
if (!eventParsed.payload.identifier || eventParsed.payload.identifier.toString() === buildingIdentifier) {
|
|
307
|
-
return;
|
|
308
|
-
} else {
|
|
309
|
-
setBuildingIdentifier(eventParsed.payload.identifier.toString());
|
|
310
|
-
}
|
|
311
|
-
break;
|
|
312
|
-
case "viewer.navigation.started":
|
|
313
|
-
case "viewer.navigation.updated":
|
|
314
|
-
case "viewer.navigation.stopped":
|
|
315
|
-
SitumPlugin.updateNavigationState(eventParsed.payload);
|
|
316
|
-
break;
|
|
317
|
-
default:
|
|
318
|
-
break;
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
const _onShouldStartLoadWithRequest = request => {
|
|
322
|
-
if (request && request.url && !request.url.startsWith(configuration.viewerDomain || SITUM_BASE_DOMAIN)) {
|
|
323
|
-
if (onExternalLinkClicked && typeof onExternalLinkClicked === "function") {
|
|
324
|
-
onExternalLinkClicked({
|
|
325
|
-
url: request.url
|
|
326
|
-
});
|
|
327
|
-
} else {
|
|
328
|
-
Linking.openURL(request.url);
|
|
329
|
-
}
|
|
330
|
-
return false;
|
|
331
|
-
}
|
|
332
|
-
return true;
|
|
333
|
-
};
|
|
334
|
-
const _effectiveProfile = () => {
|
|
335
|
-
let effectiveProfile = configuration.profile;
|
|
336
|
-
if (configuration.remoteIdentifier && configuration.remoteIdentifier.length > 0) {
|
|
337
|
-
console.warn('Situm> MapView> [!] "remoteIdentifier" is deprecated. Use "profile" instead.');
|
|
338
|
-
if (!configuration.profile || configuration.profile.length == 0) {
|
|
339
|
-
effectiveProfile = configuration.remoteIdentifier;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
return effectiveProfile;
|
|
343
|
-
};
|
|
344
|
-
return /*#__PURE__*/React.createElement(WebView, {
|
|
345
|
-
ref: webViewRef,
|
|
346
|
-
source: {
|
|
347
|
-
uri: `${configuration.viewerDomain || SITUM_BASE_DOMAIN}/${_effectiveProfile() ? `id/${_effectiveProfile()}` : ""}?&apikey=${configuration.situmApiKey}&wl=true&global=true&mode=embed${configuration.buildingIdentifier ? `&buildingid=${configuration.buildingIdentifier}` : ""}&show=rts`
|
|
348
|
-
},
|
|
349
|
-
style: StyleSheet.flatten([viewerStyles.webview, style]),
|
|
350
|
-
limitsNavigationsToAppBoundDomains: true,
|
|
351
|
-
javaScriptEnabled: true,
|
|
352
|
-
domStorageEnabled: true,
|
|
353
|
-
startInLoadingState: true,
|
|
354
|
-
cacheEnabled: true,
|
|
355
|
-
onMessage: handleRequestFromViewer,
|
|
356
|
-
onShouldStartLoadWithRequest: _onShouldStartLoadWithRequest,
|
|
357
|
-
onError: evt => {
|
|
358
|
-
if (!onLoadError) return;
|
|
359
|
-
const {
|
|
360
|
-
nativeEvent
|
|
361
|
-
} = evt;
|
|
362
|
-
// TODO: on render error should probably still try to render an html
|
|
363
|
-
if (nativeEvent.code === NETWORK_ERROR_CODE[Platform.OS]) {
|
|
364
|
-
onLoadError({
|
|
365
|
-
name: ErrorName.ERR_INTERNET_DISCONNECTED,
|
|
366
|
-
description: nativeEvent.description
|
|
367
|
-
});
|
|
368
|
-
} else {
|
|
369
|
-
// TODO: handle more errors
|
|
370
|
-
onLoadError({
|
|
371
|
-
name: ErrorName.ERR_INTERNAL_SERVER_ERROR,
|
|
372
|
-
description: nativeEvent.description
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
});
|
|
378
|
-
export default MapView;
|
|
379
|
-
//# sourceMappingURL=MapView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useImperativeHandle","useRef","useState","Linking","Platform","StyleSheet","WebView","SitumPlugin","useSitum","ErrorName","sendMessageToViewer","ViewerMapper","setError","setLocationStatus","SITUM_BASE_DOMAIN","NETWORK_ERROR_CODE","android","ios","windows","macos","web","viewerStyles","create","webview","minHeight","minWidth","MapView","forwardRef","configuration","style","onLoad","onLoadError","onPoiSelected","onPoiDeselected","onFloorChanged","onExternalLinkClicked","undefined","onFavoritePoisUpdated","ref","webViewRef","_onDirectionsRequestInterceptor","setInterceptor","mapLoaded","setMapLoaded","buildingIdentifier","setBuildingIdentifier","init","location","locationStatus","directions","navigation","calculateRoute","startNavigation","stopNavigation","error","sendFollowUser","_location$position","current","position","_followUser","_navigateToPoi","payload","identifier","navigateToPoi","followUser","_navigateToCar","navigateToCar","_navigateToPoint","lat","lng","floorIdentifier","navigateToPoint","_selectPoi","poiId","selectPoi","_selectCar","selectCar","_selectPoiCategory","categoryId","navigationIsRunning","console","selectPoiCategory","_selectFloor","floorId","options","selectFloor","_search","search","_setDirectionsOptions","directionsOptions","setDirectionsOptions","_setFavoritePois","poiIds","setFavoritePois","_onMapIsReady","locationError","unfollowUser","deselectPoi","setOnDirectionsRequestInterceptor","directionRequestInterceptor","cancelNavigation","validateMapViewProjectSettings","code","message","route","language","setLanguage","initialConfiguration","handleRequestFromViewer","event","eventParsed","JSON","parse","nativeEvent","data","type","favoritePoisIds","currentPoisIdentifiers","favoritePois","toString","updateNavigationState","_onShouldStartLoadWithRequest","request","url","startsWith","viewerDomain","openURL","_effectiveProfile","effectiveProfile","profile","remoteIdentifier","length","warn","createElement","source","uri","situmApiKey","flatten","limitsNavigationsToAppBoundDomains","javaScriptEnabled","domStorageEnabled","startInLoadingState","cacheEnabled","onMessage","onShouldStartLoadWithRequest","onError","evt","OS","name","ERR_INTERNET_DISCONNECTED","description","ERR_INTERNAL_SERVER_ERROR"],"sourceRoot":"../../../../src","sources":["wayfinding/components/MapView.tsx"],"mappings":"AAAA;AACA;AACA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SACEC,OAAO,EACPC,QAAQ,EAERC,UAAU,QAEL,cAAc;AACrB,OAAOC,OAAO,MAAM,sBAAsB;AAK1C,OAAOC,WAAW,MAAM,WAAW;AACnC,OAAOC,QAAQ,MAAM,UAAU;AAiB/B,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,mBAAmB,QAAQ,UAAU;AAC9C,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,SAASC,QAAQ,EAAEC,iBAAiB,QAAQ,UAAU;AACtD,MAAMC,iBAAiB,GAAG,8BAA8B;AAExD,MAAMC,kBAAkB,GAAG;EACzBC,OAAO,EAAE,CAAC,CAAC;EACXC,GAAG,EAAE,CAAC,IAAI;EACV;EACAC,OAAO,EAAE,CAAC;EACVC,KAAK,EAAE,CAAC;EACRC,GAAG,EAAE;AACP,CAAC;AA2CD,MAAMC,YAAY,GAAGhB,UAAU,CAACiB,MAAM,CAAC;EACrCC,OAAO,EAAE;IACPC,SAAS,EAAE,MAAM;IACjBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AA8CF,MAAMC,OAAO,gBAAG7B,KAAK,CAAC8B,UAAU,CAC9B,CACE;EACEC,aAAa;EACbC,KAAK;EACLC,MAAM,GAAGA,CAAA,KAAM,CAAC,CAAC;EACjBC,WAAW,GAAGA,CAAA,KAAM,CAAC,CAAC;EACtBC,aAAa,GAAGA,CAAA,KAAM,CAAC,CAAC;EACxBC,eAAe,GAAGA,CAAA,KAAM,CAAC,CAAC;EAC1BC,cAAc,GAAGA,CAAA,KAAM,CAAC,CAAC;EACzBC,qBAAqB,GAAGC,SAAS;EACjCC,qBAAqB,GAAGA,CAAA,KAAM,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kBAAkB,EAAE,GACjD,EAAE;IAEV,CAAE;IACFf,KAAK,EAAExB,UAAU,CAACoI,OAAO,CAAC,CAACpH,YAAY,CAACE,OAAO,EAAEM,KAAK,CAAC,CAAE;IACzD6G,kCAAkC,EAAE,IAAK;IACzCC,iBAAiB,EAAE,IAAK;IACxBC,iBAAiB,EAAE,IAAK;IACxBC,mBAAmB,EAAE,IAAK;IAC1BC,YAAY;IACZC,SAAS,EAAEnC,uBAAwB;IACnCoC,4BAA4B,EAAEvB,6BAA8B;IAC5DwB,OAAO,EAAGC,GAAsB,IAAK;MACnC,IAAI,CAACnH,WAAW,EAAE;MAClB,MAAM;QAAEkF;MAAY,CAAC,GAAGiC,GAAG;MAC3B;MACA,IAAIjC,WAAW,CAACX,IAAI,KAAKvF,kBAAkB,CAACX,QAAQ,CAAC+I,EAAE,CAAC,EAAE;QACxDpH,WAAW,CAAC;UACVqH,IAAI,EAAE3I,SAAS,CAAC4I,yBAAyB;UACzCC,WAAW,EAAErC,WAAW,CAACqC;QAC3B,CAAC,CAAC;MACJ,CAAC,MAAM;QACL;QACAvH,WAAW,CAAC;UACVqH,IAAI,EAAE3I,SAAS,CAAC8I,yBAAyB;UACzCD,WAAW,EAAErC,WAAW,CAACqC;QAC3B,CAAC,CAAC;MACJ;IACF;EAAE,CACH,CAAC;AAEN,CACF,CAAC;AAED,eAAe5H,OAAO","ignoreList":[]}
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { useContext, useState } from "react";
|
|
3
|
-
import SitumPlugin from "../../sdk";
|
|
4
|
-
import { ErrorCode, ErrorType } from "../../sdk/types";
|
|
5
|
-
import { InternalCallType, LocationStatusName, NavigationStatus, NavigationUpdateType } from "../../sdk/types/constants";
|
|
6
|
-
import { resetLocation, selectDirections, selectError, selectLocation, selectLocationStatus, selectNavigation, setDirections, setError, setLocation, setLocationStatus, setNavigation, UseSitumContext } from "../store/index";
|
|
7
|
-
import { useDispatch, useSelector } from "../store/utils";
|
|
8
|
-
import { createDirectionsMessage, createDirectionsRequest, createNavigationRequest } from "../utils/mapper";
|
|
9
|
-
const defaultNavigationRequest = {
|
|
10
|
-
distanceToGoalThreshold: 4,
|
|
11
|
-
outsideRouteThreshold: 5
|
|
12
|
-
};
|
|
13
|
-
export const useSitumInternal = () => {
|
|
14
|
-
const dispatch = useDispatch();
|
|
15
|
-
const location = useSelector(selectLocation);
|
|
16
|
-
const locationStatus = useSelector(selectLocationStatus);
|
|
17
|
-
const directions = useSelector(selectDirections);
|
|
18
|
-
const navigation = useSelector(selectNavigation);
|
|
19
|
-
const error = useSelector(selectError);
|
|
20
|
-
const [lockDirections, setLockDirections] = useState(false);
|
|
21
|
-
const init = () => {
|
|
22
|
-
console.debug("Situm > hook > Initializing -> Registering callbacks");
|
|
23
|
-
registerCallbacks();
|
|
24
|
-
};
|
|
25
|
-
function registerCallbacks() {
|
|
26
|
-
SitumPlugin.internalSetMethodCallMapDelegate(internalCall => {
|
|
27
|
-
switch (internalCall.type) {
|
|
28
|
-
case InternalCallType.LOCATION:
|
|
29
|
-
let location = internalCall.get();
|
|
30
|
-
dispatch(setLocation({
|
|
31
|
-
...location
|
|
32
|
-
}));
|
|
33
|
-
break;
|
|
34
|
-
case InternalCallType.LOCATION_STATUS:
|
|
35
|
-
let statusName = internalCall.get();
|
|
36
|
-
if (statusName in LocationStatusName) {
|
|
37
|
-
dispatch(setLocationStatus(statusName));
|
|
38
|
-
}
|
|
39
|
-
break;
|
|
40
|
-
case InternalCallType.LOCATION_STOPPED:
|
|
41
|
-
// TODO: LOCATION_STOPPED exists only in RN, delete!
|
|
42
|
-
dispatch(resetLocation());
|
|
43
|
-
break;
|
|
44
|
-
case InternalCallType.LOCATION_ERROR:
|
|
45
|
-
let error = internalCall.get();
|
|
46
|
-
dispatch(setError(error));
|
|
47
|
-
break;
|
|
48
|
-
case InternalCallType.NAVIGATION_START:
|
|
49
|
-
dispatch(setNavigation({
|
|
50
|
-
type: NavigationUpdateType.PROGRESS,
|
|
51
|
-
status: NavigationStatus.START
|
|
52
|
-
}));
|
|
53
|
-
break;
|
|
54
|
-
case InternalCallType.NAVIGATION_DESTINATION_REACHED:
|
|
55
|
-
dispatch(setNavigation({
|
|
56
|
-
type: NavigationUpdateType.DESTINATION_REACHED,
|
|
57
|
-
status: NavigationStatus.UPDATE
|
|
58
|
-
}));
|
|
59
|
-
break;
|
|
60
|
-
case InternalCallType.NAVIGATION_PROGRESS:
|
|
61
|
-
let progress = internalCall.get();
|
|
62
|
-
dispatch(setNavigation({
|
|
63
|
-
currentIndication: progress === null || progress === void 0 ? void 0 : progress.currentIndication,
|
|
64
|
-
routeStep: progress === null || progress === void 0 ? void 0 : progress.routeStep,
|
|
65
|
-
distanceToGoal: progress === null || progress === void 0 ? void 0 : progress.distanceToGoal,
|
|
66
|
-
points: progress === null || progress === void 0 ? void 0 : progress.points,
|
|
67
|
-
type: NavigationUpdateType.PROGRESS,
|
|
68
|
-
segments: progress === null || progress === void 0 ? void 0 : progress.segments,
|
|
69
|
-
status: NavigationStatus.UPDATE
|
|
70
|
-
}));
|
|
71
|
-
break;
|
|
72
|
-
case InternalCallType.NAVIGATION_OUT_OF_ROUTE:
|
|
73
|
-
dispatch(setNavigation({
|
|
74
|
-
type: NavigationUpdateType.OUT_OF_ROUTE,
|
|
75
|
-
status: NavigationStatus.UPDATE
|
|
76
|
-
}));
|
|
77
|
-
break;
|
|
78
|
-
case InternalCallType.NAVIGATION_CANCELLATION:
|
|
79
|
-
dispatch(setNavigation({
|
|
80
|
-
type: NavigationUpdateType.CANCELLED,
|
|
81
|
-
status: NavigationStatus.STOP
|
|
82
|
-
}));
|
|
83
|
-
break;
|
|
84
|
-
case InternalCallType.NAVIGATION_ERROR:
|
|
85
|
-
case InternalCallType.GEOFENCES_ENTER:
|
|
86
|
-
case InternalCallType.GEOFENCES_EXIT:
|
|
87
|
-
// Do nothing.
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
const calculateRoute = async (payload, interceptor, updateRoute = true) => {
|
|
93
|
-
console.debug("Situm > hook > calculating route");
|
|
94
|
-
const directionsRequest = createDirectionsRequest(payload.directionsRequest);
|
|
95
|
-
interceptor && interceptor(directionsRequest);
|
|
96
|
-
const {
|
|
97
|
-
to,
|
|
98
|
-
from,
|
|
99
|
-
minimizeFloorChanges,
|
|
100
|
-
accessibilityMode,
|
|
101
|
-
bearingFrom,
|
|
102
|
-
includedTags,
|
|
103
|
-
excludedTags
|
|
104
|
-
} = directionsRequest;
|
|
105
|
-
const {
|
|
106
|
-
originIdentifier,
|
|
107
|
-
destinationIdentifier,
|
|
108
|
-
buildingIdentifier
|
|
109
|
-
} = createDirectionsMessage(payload);
|
|
110
|
-
const _buildings = await SitumPlugin.fetchBuildings();
|
|
111
|
-
const _building = _buildings.find(b => b.buildingIdentifier === buildingIdentifier);
|
|
112
|
-
if (!to || !from || lockDirections) {
|
|
113
|
-
console.debug(`Situm > hook > Could not compute route (to: ${to}, from: ${from}, lockDirections: ${lockDirections})`);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// iOS workaround -> does not allow for several direction petitions
|
|
118
|
-
setLockDirections(true);
|
|
119
|
-
return await SitumPlugin.requestDirections(_building, from, to, {
|
|
120
|
-
minimizeFloorChanges,
|
|
121
|
-
accessibilityMode,
|
|
122
|
-
bearingFrom,
|
|
123
|
-
includedTags,
|
|
124
|
-
excludedTags
|
|
125
|
-
}).then(_directions => {
|
|
126
|
-
const newRoute = {
|
|
127
|
-
..._directions,
|
|
128
|
-
originIdentifier,
|
|
129
|
-
destinationIdentifier,
|
|
130
|
-
type: accessibilityMode
|
|
131
|
-
};
|
|
132
|
-
if (updateRoute) {
|
|
133
|
-
dispatch(setDirections(newRoute));
|
|
134
|
-
}
|
|
135
|
-
return newRoute;
|
|
136
|
-
}).catch(e => {
|
|
137
|
-
console.error(`Situm > hook > Could not compute route: ${e}`);
|
|
138
|
-
dispatch(setDirections({
|
|
139
|
-
error: JSON.stringify(e)
|
|
140
|
-
}));
|
|
141
|
-
}).finally(() => {
|
|
142
|
-
setLockDirections(false);
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
// Navigation
|
|
147
|
-
const startNavigation = (payload, interceptor) => {
|
|
148
|
-
console.debug("Situm > hook > request to start navigation");
|
|
149
|
-
// TODO: we should delegate this to the sdk plugin
|
|
150
|
-
if (!navigation || (navigation === null || navigation === void 0 ? void 0 : navigation.status) !== NavigationStatus.STOP) {
|
|
151
|
-
stopNavigation();
|
|
152
|
-
}
|
|
153
|
-
calculateRoute(payload, interceptor, false).then(r => {
|
|
154
|
-
if (!r) {
|
|
155
|
-
console.debug(`Situm > hook > No route was computed`);
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
dispatch(setNavigation({
|
|
159
|
-
status: NavigationStatus.START,
|
|
160
|
-
type: NavigationUpdateType.PROGRESS,
|
|
161
|
-
...r
|
|
162
|
-
}));
|
|
163
|
-
try {
|
|
164
|
-
const navigationRequest = createNavigationRequest(payload.navigationRequest);
|
|
165
|
-
SitumPlugin.requestNavigationUpdates({
|
|
166
|
-
...defaultNavigationRequest,
|
|
167
|
-
...navigationRequest
|
|
168
|
-
});
|
|
169
|
-
} catch (e) {
|
|
170
|
-
console.error(`Situm > hook > Could not update navigation ${e}`);
|
|
171
|
-
//TODO: Remove this and emit these errors in SitumPlugin.onNavigationError
|
|
172
|
-
dispatch(setError({
|
|
173
|
-
message: "Could not update navigation",
|
|
174
|
-
code: ErrorCode.UNKNOWN,
|
|
175
|
-
type: ErrorType.NON_CRITICAL
|
|
176
|
-
}));
|
|
177
|
-
stopNavigation();
|
|
178
|
-
}
|
|
179
|
-
}).catch(e => {
|
|
180
|
-
console.error(`Situm > hook > Could not compute route for navigation ${JSON.stringify(e)}`);
|
|
181
|
-
});
|
|
182
|
-
};
|
|
183
|
-
const stopNavigation = () => {
|
|
184
|
-
// TODO: we should delegate this to the sdk plugin
|
|
185
|
-
if (!navigation || (navigation === null || navigation === void 0 ? void 0 : navigation.status) === NavigationStatus.STOP) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
console.debug("Situm > hook > Stopping navigation");
|
|
189
|
-
SitumPlugin.removeNavigationUpdates().then(() => {
|
|
190
|
-
console.debug("Situm > hook > Successfully removed navigation updates");
|
|
191
|
-
dispatch(setNavigation({
|
|
192
|
-
status: NavigationStatus.STOP
|
|
193
|
-
}));
|
|
194
|
-
}).catch(e => {
|
|
195
|
-
console.warn(`Situm > hook > Could not remove navigation updates ${JSON.stringify(e)}`);
|
|
196
|
-
});
|
|
197
|
-
};
|
|
198
|
-
return {
|
|
199
|
-
// States
|
|
200
|
-
location,
|
|
201
|
-
locationStatus,
|
|
202
|
-
directions,
|
|
203
|
-
navigation,
|
|
204
|
-
error,
|
|
205
|
-
// Functions
|
|
206
|
-
init,
|
|
207
|
-
calculateRoute,
|
|
208
|
-
startNavigation,
|
|
209
|
-
stopNavigation
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
const useSitum = () => {
|
|
213
|
-
const context = useContext(UseSitumContext);
|
|
214
|
-
if (!context) {
|
|
215
|
-
throw new Error("Situm > hook > No SitumProvider found.");
|
|
216
|
-
}
|
|
217
|
-
return context.useSitum;
|
|
218
|
-
};
|
|
219
|
-
export default useSitum;
|
|
220
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useContext","useState","SitumPlugin","ErrorCode","ErrorType","InternalCallType","LocationStatusName","NavigationStatus","NavigationUpdateType","resetLocation","selectDirections","selectError","selectLocation","selectLocationStatus","selectNavigation","setDirections","setError","setLocation","setLocationStatus","setNavigation","UseSitumContext","useDispatch","useSelector","createDirectionsMessage","createDirectionsRequest","createNavigationRequest","defaultNavigationRequest","distanceToGoalThreshold","outsideRouteThreshold","useSitumInternal","dispatch","location","locationStatus","directions","navigation","error","lockDirections","setLockDirections","init","console","debug","registerCallbacks","internalSetMethodCallMapDelegate","internalCall","type","LOCATION","get","LOCATION_STATUS","statusName","LOCATION_STOPPED","LOCATION_ERROR","NAVIGATION_START","PROGRESS","status","START","NAVIGATION_DESTINATION_REACHED","DESTINATION_REACHED","UPDATE","NAVIGATION_PROGRESS","progress","currentIndication","routeStep","distanceToGoal","points","segments","NAVIGATION_OUT_OF_ROUTE","OUT_OF_ROUTE","NAVIGATION_CANCELLATION","CANCELLED","STOP","NAVIGATION_ERROR","GEOFENCES_ENTER","GEOFENCES_EXIT","calculateRoute","payload","interceptor","updateRoute","directionsRequest","to","from","minimizeFloorChanges","accessibilityMode","bearingFrom","includedTags","excludedTags","originIdentifier","destinationIdentifier","buildingIdentifier","_buildings","fetchBuildings","_building","find","b","requestDirections","then","_directions","newRoute","catch","e","JSON","stringify","finally","startNavigation","stopNavigation","r","navigationRequest","requestNavigationUpdates","message","code","UNKNOWN","NON_CRITICAL","removeNavigationUpdates","warn","useSitum","context","Error"],"sourceRoot":"../../../../src","sources":["wayfinding/hooks/index.ts"],"mappings":"AAAA;AACA,SAASA,UAAU,EAAEC,QAAQ,QAAQ,OAAO;AAE5C,OAAOC,WAAW,MAAM,WAAW;AACnC,SAGEC,SAAS,EACTC,SAAS,QAIJ,iBAAiB;AACxB,SACEC,gBAAgB,EAChBC,kBAAkB,EAClBC,gBAAgB,EAChBC,oBAAoB,QACf,2BAA2B;AAClC,SACEC,aAAa,EACbC,gBAAgB,EAChBC,WAAW,EACXC,cAAc,EACdC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,QAAQ,EACRC,WAAW,EACXC,iBAAiB,EACjBC,aAAa,EACbC,eAAe,QACV,gBAAgB;AACvB,SAASC,WAAW,EAAEC,WAAW,QAAQ,gBAAgB;AAEzD,SACEC,uBAAuB,EACvBC,uBAAuB,EACvBC,uBAAuB,QAClB,iBAAiB;AAExB,MAAMC,wBAAwB,GAAG;EAC/BC,u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,CAAEC,CAAC,IAAK;MACZ3D,OAAO,CAACyE,IAAI,CACV,sDAAsDb,IAAI,CAACC,SAAS,CAClEF,CACF,CAAC,EACH,CAAC;IACH,CAAC,CAAC;EACN,CAAC;EAED,OAAO;IACL;IACAnE,QAAQ;IACRC,cAAc;IAEdC,UAAU;IACVC,UAAU;IACVC,KAAK;IAEL;IACAG,IAAI;IACJmC,cAAc;IACd6B,eAAe;IACfC;EACF,CAAC;AACH,CAAC;AAED,MAAMU,QAAQ,GAAGA,CAAA,KAAM;EACrB,MAAMC,OAAO,GAAGlH,UAAU,CAACoB,eAAe,CAAC;EAE3C,IAAI,CAAC8F,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,wCAAwC,CAAC;EAC3D;EAEA,OAAOD,OAAO,CAACD,QAAQ;AACzB,CAAC;AAED,eAAeA,QAAQ","ignoreList":[]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Definitions
|
|
2
|
-
export * from "./types";
|
|
3
|
-
export * from "./types/constants";
|
|
4
|
-
|
|
5
|
-
// Hook
|
|
6
|
-
export { default as useSitum } from "./hooks";
|
|
7
|
-
|
|
8
|
-
// State Provider
|
|
9
|
-
export { default as SitumProvider } from "./store";
|
|
10
|
-
|
|
11
|
-
// Component
|
|
12
|
-
export { default as MapView } from "./components/MapView";
|
|
13
|
-
//# sourceMappingURL=index.js.map
|