@situm/cordova 3.17.4 → 3.17.6

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.
@@ -40,7 +40,7 @@
40
40
  <ul></ul>
41
41
  </div>
42
42
 
43
- <div class="lnb-api hidden"><h3>Namespaces</h3><ul><li><a href="MapView.html">MapView</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="MapView_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="MapView.html#.onLoad">onLoad</a></li></ul></div></li><li><a href="MapViewController.html">MapViewController</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="MapViewController_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="MapViewController.html#.navigateToPoi">navigateToPoi</a></li><li><a href="MapViewController.html#.onPoiDeselected">onPoiDeselected</a></li><li><a href="MapViewController.html#.onPoiSelected">onPoiSelected</a></li><li><a href="MapViewController.html#.selectPoi">selectPoi</a></li><li><a href="MapViewController.html#.setDirectionsOptions">setDirectionsOptions</a></li><li><a href="MapViewController.html#.setLanguage">setLanguage</a></li></ul></div></li><li><a href="Situm.html">Situm</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="Situm_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="Situm.html#.configureUserHelper">configureUserHelper</a></li><li><a href="Situm.html#.disableUserHelper">disableUserHelper</a></li><li><a href="Situm.html#.enableUserHelper">enableUserHelper</a></li><li><a href="Situm.html#.fetchBuildingInfo">fetchBuildingInfo</a></li><li><a href="Situm.html#.fetchBuildings">fetchBuildings</a></li><li><a href="Situm.html#.fetchEventsFromBuilding">fetchEventsFromBuilding</a></li><li><a href="Situm.html#.fetchFloorsFromBuilding">fetchFloorsFromBuilding</a></li><li><a href="Situm.html#.fetchGeofencesFromBuilding">fetchGeofencesFromBuilding</a></li><li><a href="Situm.html#.fetchIndoorPOIsFromBuilding">fetchIndoorPOIsFromBuilding</a></li><li><a href="Situm.html#.fetchMapFromFloor">fetchMapFromFloor</a></li><li><a href="Situm.html#.fetchOutdoorPOIsFromBuilding">fetchOutdoorPOIsFromBuilding</a></li><li><a href="Situm.html#.fetchPoiCategories">fetchPoiCategories</a></li><li><a href="Situm.html#.fetchPoiCategoryIconNormal">fetchPoiCategoryIconNormal</a></li><li><a href="Situm.html#.fetchPoiCategoryIconSelected">fetchPoiCategoryIconSelected</a></li><li><a href="Situm.html#.getDeviceId">getDeviceId</a></li><li><a href="Situm.html#.internalSetEventDelegate">internalSetEventDelegate</a></li><li><a href="Situm.html#.invalidateCache">invalidateCache</a></li><li><a href="Situm.html#.onEnterGeofences">onEnterGeofences</a></li><li><a href="Situm.html#.onExitGeofences">onExitGeofences</a></li><li><a href="Situm.html#.onLocationError">onLocationError</a></li><li><a href="Situm.html#.onLocationStatus">onLocationStatus</a></li><li><a href="Situm.html#.onLocationUpdate">onLocationUpdate</a></li><li><a href="Situm.html#.removeNavigationUpdates">removeNavigationUpdates</a></li><li><a href="Situm.html#.removeRealTimeUpdates">removeRealTimeUpdates</a></li><li><a href="Situm.html#.removeUpdates">removeUpdates</a></li><li><a href="Situm.html#.requestDirections">requestDirections</a></li><li><a href="Situm.html#.requestLocationUpdates">requestLocationUpdates</a></li><li><a href="Situm.html#.requestNavigationUpdates">requestNavigationUpdates</a></li><li><a href="Situm.html#.requestRealTimeUpdates">requestRealTimeUpdates</a></li><li><a href="Situm.html#.setApiKey">setApiKey</a></li><li><a href="Situm.html#.setCacheMaxAge">setCacheMaxAge</a></li><li><a href="Situm.html#.setUserPass">setUserPass</a></li><li><a href="Situm.html#.startPositioning">startPositioning</a></li><li><a href="Situm.html#.stopPositioning">stopPositioning</a></li><li><a href="Situm.html#.updateNavigationState">updateNavigationState</a></li><li><a href="Situm.html#.updateNavigationWithLocation">updateNavigationWithLocation</a></li></ul></div></li></ul></div><div class="lnb-api hidden"><h3>Global</h3><ul><li><a href="global.html#Angle">Angle</a></li><li><a href="global.html#BeaconFilter">BeaconFilter</a></li><li><a href="global.html#Bounds">Bounds</a></li><li><a href="global.html#Building">Building</a></li><li><a href="global.html#BuildingInfo">BuildingInfo</a></li><li><a href="global.html#CartesianCoordinate">CartesianCoordinate</a></li><li><a href="global.html#Circle">Circle</a></li><li><a href="global.html#Coordinate">Coordinate</a></li><li><a href="global.html#Dimensions">Dimensions</a></li><li><a href="global.html#DirectionsOptions">DirectionsOptions</a></li><li><a href="global.html#DirectionsRequest">DirectionsRequest</a></li><li><a href="global.html#ExternalNavigation">ExternalNavigation</a></li><li><a href="global.html#Floor">Floor</a></li><li><a href="global.html#ForegroundServiceNotificationOptions">ForegroundServiceNotificationOptions</a></li><li><a href="global.html#Geofence">Geofence</a></li><li><a href="global.html#Indication">Indication</a></li><li><a href="global.html#Location">Location</a></li><li><a href="global.html#LocationOptions">LocationOptions</a></li><li><a href="global.html#LocationRequest">LocationRequest</a></li><li><a href="global.html#LocationStatus">LocationStatus</a></li><li class="hidden"><a href="global.html#MapViewDirectionsOptions">MapViewDirectionsOptions</a></li><li><a href="global.html#NavigationProgress">NavigationProgress</a></li><li><a href="global.html#NavigationRequest">NavigationRequest</a></li><li class="hidden"><a href="global.html#OnLocationErrorCallback">OnLocationErrorCallback</a></li><li class="hidden"><a href="global.html#OnLocationStatusCallback">OnLocationStatusCallback</a></li><li class="hidden"><a href="global.html#OnLocationUpdateCallback">OnLocationUpdateCallback</a></li><li><a href="global.html#OutdoorLocationOptions">OutdoorLocationOptions</a></li><li><a href="global.html#POI">POI</a></li><li><a href="global.html#PoiCategory">PoiCategory</a></li><li><a href="global.html#PoiDeselectedResult">PoiDeselectedResult</a></li><li><a href="global.html#Point">Point</a></li><li><a href="global.html#PoiSelectedResult">PoiSelectedResult</a></li><li><a href="global.html#RealTimeData">RealTimeData</a></li><li><a href="global.html#RealTimeRequest">RealTimeRequest</a></li><li><a href="global.html#Route">Route</a></li><li><a href="global.html#RouteSegment">RouteSegment</a></li><li><a href="global.html#RouteStep">RouteStep</a></li><li><a href="global.html#SitumConversionArea">SitumConversionArea</a></li><li><a href="global.html#SitumEvent">SitumEvent</a></li><li><a href="global.html#UserHelperColorScheme">UserHelperColorScheme</a></li><li><a href="global.html#UserHelperOptions">UserHelperOptions</a></li></ul></div>
43
+ <div class="lnb-api hidden"><h3>Namespaces</h3><ul><li><a href="MapView.html">MapView</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="MapView_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="MapView.html#.onLoad">onLoad</a></li></ul></div></li><li><a href="MapViewController.html">MapViewController</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="MapViewController_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="MapViewController.html#.navigateToPoi">navigateToPoi</a></li><li><a href="MapViewController.html#.onPoiDeselected">onPoiDeselected</a></li><li><a href="MapViewController.html#.onPoiSelected">onPoiSelected</a></li><li><a href="MapViewController.html#.selectPoi">selectPoi</a></li><li><a href="MapViewController.html#.setDirectionsOptions">setDirectionsOptions</a></li><li><a href="MapViewController.html#.setLanguage">setLanguage</a></li></ul></div></li><li><a href="Situm.html">Situm</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="Situm_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="Situm.html#.configureUserHelper">configureUserHelper</a></li><li><a href="Situm.html#.disableUserHelper">disableUserHelper</a></li><li><a href="Situm.html#.enableUserHelper">enableUserHelper</a></li><li><a href="Situm.html#.fetchBuildingInfo">fetchBuildingInfo</a></li><li><a href="Situm.html#.fetchBuildings">fetchBuildings</a></li><li><a href="Situm.html#.fetchEventsFromBuilding">fetchEventsFromBuilding</a></li><li><a href="Situm.html#.fetchFloorsFromBuilding">fetchFloorsFromBuilding</a></li><li><a href="Situm.html#.fetchGeofencesFromBuilding">fetchGeofencesFromBuilding</a></li><li><a href="Situm.html#.fetchIndoorPOIsFromBuilding">fetchIndoorPOIsFromBuilding</a></li><li><a href="Situm.html#.fetchMapFromFloor">fetchMapFromFloor</a></li><li><a href="Situm.html#.fetchOutdoorPOIsFromBuilding">fetchOutdoorPOIsFromBuilding</a></li><li><a href="Situm.html#.fetchPoiCategories">fetchPoiCategories</a></li><li><a href="Situm.html#.fetchPoiCategoryIconNormal">fetchPoiCategoryIconNormal</a></li><li><a href="Situm.html#.fetchPoiCategoryIconSelected">fetchPoiCategoryIconSelected</a></li><li><a href="Situm.html#.getDeviceId">getDeviceId</a></li><li><a href="Situm.html#.internalHandleMapViewMessage">internalHandleMapViewMessage</a></li><li><a href="Situm.html#.internalSetEventDelegate">internalSetEventDelegate</a></li><li><a href="Situm.html#.invalidateCache">invalidateCache</a></li><li><a href="Situm.html#.onEnterGeofences">onEnterGeofences</a></li><li><a href="Situm.html#.onExitGeofences">onExitGeofences</a></li><li><a href="Situm.html#.onLocationError">onLocationError</a></li><li><a href="Situm.html#.onLocationStatus">onLocationStatus</a></li><li><a href="Situm.html#.onLocationUpdate">onLocationUpdate</a></li><li><a href="Situm.html#.removeNavigationUpdates">removeNavigationUpdates</a></li><li><a href="Situm.html#.removeRealTimeUpdates">removeRealTimeUpdates</a></li><li><a href="Situm.html#.removeUpdates">removeUpdates</a></li><li><a href="Situm.html#.requestDirections">requestDirections</a></li><li><a href="Situm.html#.requestLocationUpdates">requestLocationUpdates</a></li><li><a href="Situm.html#.requestNavigationUpdates">requestNavigationUpdates</a></li><li><a href="Situm.html#.requestRealTimeUpdates">requestRealTimeUpdates</a></li><li><a href="Situm.html#.setApiKey">setApiKey</a></li><li><a href="Situm.html#.setCacheMaxAge">setCacheMaxAge</a></li><li><a href="Situm.html#.setToken">setToken</a></li><li><a href="Situm.html#.setUserPass">setUserPass</a></li><li><a href="Situm.html#.startPositioning">startPositioning</a></li><li><a href="Situm.html#.stopPositioning">stopPositioning</a></li><li><a href="Situm.html#.updateNavigationState">updateNavigationState</a></li><li><a href="Situm.html#.updateNavigationWithLocation">updateNavigationWithLocation</a></li></ul></div></li></ul></div><div class="lnb-api hidden"><h3>Global</h3><ul><li><a href="global.html#Angle">Angle</a></li><li><a href="global.html#BeaconFilter">BeaconFilter</a></li><li><a href="global.html#Bounds">Bounds</a></li><li><a href="global.html#Building">Building</a></li><li><a href="global.html#BuildingInfo">BuildingInfo</a></li><li><a href="global.html#CartesianCoordinate">CartesianCoordinate</a></li><li><a href="global.html#Circle">Circle</a></li><li><a href="global.html#Coordinate">Coordinate</a></li><li><a href="global.html#Dimensions">Dimensions</a></li><li><a href="global.html#DirectionsOptions">DirectionsOptions</a></li><li><a href="global.html#DirectionsRequest">DirectionsRequest</a></li><li><a href="global.html#ExternalNavigation">ExternalNavigation</a></li><li><a href="global.html#Floor">Floor</a></li><li><a href="global.html#ForegroundServiceNotificationOptions">ForegroundServiceNotificationOptions</a></li><li><a href="global.html#Geofence">Geofence</a></li><li><a href="global.html#Indication">Indication</a></li><li><a href="global.html#Location">Location</a></li><li><a href="global.html#LocationOptions">LocationOptions</a></li><li><a href="global.html#LocationRequest">LocationRequest</a></li><li><a href="global.html#LocationStatus">LocationStatus</a></li><li class="hidden"><a href="global.html#MapViewDirectionsOptions">MapViewDirectionsOptions</a></li><li><a href="global.html#NavigationProgress">NavigationProgress</a></li><li><a href="global.html#NavigationRequest">NavigationRequest</a></li><li class="hidden"><a href="global.html#OnLocationErrorCallback">OnLocationErrorCallback</a></li><li class="hidden"><a href="global.html#OnLocationStatusCallback">OnLocationStatusCallback</a></li><li class="hidden"><a href="global.html#OnLocationUpdateCallback">OnLocationUpdateCallback</a></li><li><a href="global.html#OutdoorLocationOptions">OutdoorLocationOptions</a></li><li><a href="global.html#POI">POI</a></li><li><a href="global.html#PoiCategory">PoiCategory</a></li><li><a href="global.html#PoiDeselectedResult">PoiDeselectedResult</a></li><li><a href="global.html#Point">Point</a></li><li><a href="global.html#PoiSelectedResult">PoiSelectedResult</a></li><li><a href="global.html#RealTimeData">RealTimeData</a></li><li><a href="global.html#RealTimeRequest">RealTimeRequest</a></li><li><a href="global.html#Route">Route</a></li><li><a href="global.html#RouteSegment">RouteSegment</a></li><li><a href="global.html#RouteStep">RouteStep</a></li><li><a href="global.html#SitumConversionArea">SitumConversionArea</a></li><li><a href="global.html#SitumEvent">SitumEvent</a></li><li><a href="global.html#UserHelperColorScheme">UserHelperColorScheme</a></li><li><a href="global.html#UserHelperOptions">UserHelperOptions</a></li></ul></div>
44
44
  </nav>
45
45
  <div id="resizer"></div>
46
46
 
@@ -103,34 +103,23 @@ class MapViewControllerImpl {
103
103
  _onLoadCallback = undefined;
104
104
  _onPoiSelectedCallback = undefined;
105
105
  _onPoiDeselectedCallback = undefined;
106
- _buildings = undefined;
107
106
  _mapView = undefined;
108
- _isNavigating = false;
109
- _navigationType = "";
107
+ _isWaitingForAuth = false;
110
108
 
111
109
  constructor() {
112
110
  Situm.internalSetEventDelegate(this._handleSdkNativeEvents.bind(this));
111
+ Situm.internalSetTokenCallback(this._handleTokenSet.bind(this));
113
112
  }
114
113
 
115
114
  _prepare(mapView) {
116
115
  this._mapView = mapView;
117
- let useViewerNavigation = mapView.getAttribute('use-viewer-navigation')
118
- ? mapView.getAttribute('use-viewer-navigation')
119
- : null;
120
- if (useViewerNavigation != null) {
121
- this._setNavigationType(useViewerNavigation);
122
- }
123
- }
124
116
 
125
- _setNavigationType(useViewerNavigation) {
126
- if (useViewerNavigation) {
127
- if (useViewerNavigation === "true") {
128
- this._navigationType = 'webAssembly';
129
- } else {
130
- this._navigationType = 'sdk';
131
- }
117
+ if (mapView.hasAttribute('use-viewer-navigation')) {
118
+ console.warn(
119
+ 'Situm> MapView> [!] The "use-viewer-navigation" attribute is deprecated and ignored. ' +
120
+ 'The MapView always uses its own routing and navigation library.'
121
+ );
132
122
  }
133
-
134
123
  }
135
124
 
136
125
  _setOnLoadCallback(callback) {
@@ -180,17 +169,6 @@ class MapViewControllerImpl {
180
169
 
181
170
  _handleOnLocationUpdate(payload) {
182
171
  this._sendMessageToViewer('location.update', payload);
183
- if (this._isNavigating) {
184
- Situm.updateNavigationWithLocation(
185
- [payload],
186
- () => {
187
- // Do nothing.
188
- },
189
- () => {
190
- console.error('Error at updateNavigationWithLocation');
191
- }
192
- );
193
- }
194
172
  }
195
173
 
196
174
  _handleOnLocationStatus(payload) {
@@ -206,16 +184,10 @@ class MapViewControllerImpl {
206
184
  _handleMapViewMessages(m) {
207
185
  switch (m.type) {
208
186
  case 'app.map_is_ready':
209
- if (
210
- this._onLoadCallback &amp;&amp;
211
- typeof this._onLoadCallback === 'function'
212
- ) {
213
- this._onLoadCallback(this);
214
- console.debug('Map is ready!');
215
- }
216
- if (this._navigationType) {
217
- this._sendNavigationConfig(this._navigationType);
218
- }
187
+ this._handleMapIsReady();
188
+ break;
189
+ case 'app.ready_for_auth':
190
+ this._handleReadyForAuth();
219
191
  break;
220
192
  case 'cartography.poi_selected':
221
193
  console.debug(`poi (${m.payload.identifier}) was selected`);
@@ -236,15 +208,6 @@ class MapViewControllerImpl {
236
208
  };
237
209
  this._onPoiDeselectedCallback(poiDeselectedResult);
238
210
  break;
239
- case 'directions.requested':
240
- this._onDirectionsRequested(m.payload);
241
- break;
242
- case 'navigation.requested':
243
- this._onNavigationRequested(m.payload);
244
- break;
245
- case 'navigation.stopped':
246
- this._onNavigationCancel();
247
- break;
248
211
  case 'viewer.navigation.started':
249
212
  this._onViewerNavigationStarted(m.payload);
250
213
  break;
@@ -254,191 +217,83 @@ class MapViewControllerImpl {
254
217
  case 'viewer.navigation.stopped':
255
218
  this._onViewerNavigationStopped(m.payload);
256
219
  break;
220
+ case 'ui.speak_aloud_text':
221
+ // case ...: Add here any other message that must be delegated to the native side.
222
+ this._internalHandleMapViewMessage(m.type, m.payload);
223
+ break;
257
224
  default:
258
225
  console.debug('Got unmanaged message: ', m);
259
226
  break;
260
227
  }
261
228
  }
262
229
 
263
- // Fetch the given building and return it or undefined if not found.
264
- _ensureBuilding(buildingId, callback) {
265
- if (this._buildings) {
266
- let building = this._buildings.find(
267
- (b) => b.buildingIdentifier == buildingId
268
- );
269
- callback(building);
270
- } else {
271
- // Fetch buildings and calculate route.
272
- cordova.plugins.Situm.fetchBuildings(
273
- (res) => {
274
- this._buildings = res;
275
- let building = this._buildings.find(
276
- (b) => b.buildingIdentifier == buildingId
277
- );
278
- callback(building);
279
- },
280
- (err) => {
281
- callback(undefined);
282
- }
283
- );
230
+ _handleMapIsReady() {
231
+ if (this._onLoadCallback &amp;&amp;
232
+ typeof this._onLoadCallback === 'function') {
233
+ this._onLoadCallback(this);
234
+ console.debug('Map is ready!');
284
235
  }
236
+ this._sendMessageToViewer('app.set_config_item', [
237
+ {key: "internal.tts.engine", value: "mobile"},
238
+ // Any other config item here...
239
+ ]);
285
240
  }
286
241
 
287
- // DIRECTIONS:
288
-
289
- _onDirectionsRequested(payload) {
290
- let directionsRequest = payload.directionsRequest;
291
- let mapViewerData = {
292
- identifier: payload.identifier,
293
- originIdentifier: payload.originIdentifier,
294
- destinationIdentifier: payload.destinationIdentifier,
295
- type: directionsRequest.accessibilityMode
296
- };
297
- this._ensureBuilding(payload.buildingIdentifier, (building) => {
298
- if (building) {
299
- Situm.requestDirections(
300
- [
301
- building,
302
- directionsRequest.from,
303
- directionsRequest.to,
304
- directionsRequest
305
- ],
306
- (route) => {
307
- this._sendMessageToViewer('directions.update', {
308
- ...route,
309
- ...mapViewerData
310
- });
311
- },
312
- (error) => {
313
- this._sendMessageToViewer('directions.update', {
314
- error: -1,
315
- identifier: mapViewerData.identifier
316
- });
317
- }
318
- );
319
- } else {
320
- this._sendMessageToViewer('directions.update', {
321
- error: -1,
322
- identifier: payload.identifier
323
- });
324
- }
325
- });
242
+ _handleReadyForAuth() {
243
+ this._isWaitingForAuth = true;
244
+ this._sendTokenToViewer(Situm.internalGetToken());
326
245
  }
327
246
 
328
- // NAVIGATION
329
-
330
- _onNavigationRequested(payload) {
331
- let directionsRequest = payload.directionsRequest;
332
- let mapViewerData = {
333
- identifier: payload.identifier,
334
- originIdentifier: payload.originIdentifier,
335
- destinationIdentifier: payload.destinationIdentifier,
336
- type: directionsRequest.accessibilityMode
337
- };
338
- let navigationRequest = payload.navigationRequest;
339
- this._ensureBuilding(payload.buildingIdentifier, (building) => {
340
- // Request directions again to update the calculated route on the native side.
341
- Situm.requestDirections(
342
- [
343
- building,
344
- directionsRequest.from,
345
- directionsRequest.to,
346
- directionsRequest
347
- ],
348
- (route) => {
349
- this._isNavigating = true;
350
- this._sendMessageToViewer('navigation.start', {
351
- ...route,
352
- ...mapViewerData
353
- });
354
- Situm.requestNavigationUpdates(
355
- [navigationRequest],
356
- (progress) => {
357
- // Navigation is working, handle different progress types:
358
- if (progress.type == 'progress') {
359
- progress.type = 'PROGRESS'; // The map-viewer waits for an upper case "type".
360
- this._sendMessageToViewer('navigation.update', progress);
361
- } else if (progress.type == 'destinationReached') {
362
- this._sendMessageToViewer('navigation.update', {
363
- type: 'DESTINATION_REACHED'
364
- });
365
- this._isNavigating = false;
366
- } else if (progress.type == 'userOutsideRoute') {
367
- this._sendMessageToViewer('navigation.update', {
368
- type: 'OUT_OF_ROUTE'
369
- });
370
- }
371
- },
372
- (error) => {
373
- this._sendMessageToViewer('directions.update', {
374
- error: -1,
375
- identifier: mapViewerData.identifier
376
- });
377
- this._isNavigating = false;
378
- }
379
- );
380
- },
381
- (error) => {
382
- this._sendMessageToViewer('directions.update', {
383
- error: -1,
384
- identifier: mapViewerData.identifier
385
- });
386
- this._isNavigating = false;
387
- }
388
- );
389
- });
247
+ _handleTokenSet(token) {
248
+ if (this._isWaitingForAuth) {
249
+ this._sendTokenToViewer(token);
250
+ }
390
251
  }
391
252
 
392
- _onNavigationCancel() {
393
- this._isNavigating = false;
394
- Situm.removeNavigationUpdates(
395
- () => {
396
- // Do nothing.
397
- },
398
- () => {
399
- console.error('Error removing navigation updates.');
400
- }
253
+ _sendTokenToViewer(token) {
254
+ if (!token) {
255
+ return;
256
+ }
257
+ this._sendMessageToViewer('app.set_auth',
258
+ {jwt: token}
401
259
  );
402
260
  }
403
261
 
262
+ // NAVIGATION
263
+
404
264
  _onViewerNavigationStarted(webPayload) {
405
- if (this._isNavigating) {
406
- return;
407
- }
408
- this._isNavigating = true;
409
265
  let externalNavigation = { messageType: "NavigationStarted", payload: webPayload};
410
266
  Situm.updateNavigationState(externalNavigation, () => {}, () => {});
411
267
  }
412
268
 
413
269
  _onViewerNavigationUpdated(webPayload) {
414
- if (!this._isNavigating) {
415
- return;
416
- }
417
- if (webPayload.type == "PROGRESS") {
418
- let externalNavigation = { messageType: "NavigationUpdated", payload: webPayload};
419
- Situm.updateNavigationState(externalNavigation, () => {}, () => {});
420
- } else if (webPayload.type == "DESTINATION_REACHED") {
421
- let externalNavigation = { messageType: "DestinationReached", payload: webPayload};
422
- Situm.updateNavigationState(externalNavigation, () => {}, () => {});
423
- this._isNavigating = false;
424
- } else if (webPayload.type == "OUT_OF_ROUTE") {
425
- let externalNavigation = { messageType: "OutsideRoute", payload: webPayload};
426
- Situm.updateNavigationState(externalNavigation, () => {}, () => {});
427
- this._isNavigating = false;
270
+ let messageType;
271
+ switch (webPayload.type) {
272
+ case 'PROGRESS':
273
+ messageType = 'NavigationUpdated';
274
+ break;
275
+ case 'DESTINATION_REACHED':
276
+ messageType = 'DestinationReached';
277
+ break;
278
+ case 'OUT_OF_ROUTE':
279
+ messageType = 'OutsideRoute';
280
+ break;
281
+ default:
282
+ return;
428
283
  }
429
-
284
+
285
+ const externalNavigation = { messageType, payload: webPayload };
286
+ Situm.updateNavigationState(externalNavigation, () => { }, () => { });
430
287
  }
431
288
 
432
289
  _onViewerNavigationStopped(webPayload) {
433
- if (!this._isNavigating) {
434
- return;
435
- }
436
- this._isNavigating = false;
437
290
  let externalNavigation = { messageType: "NavigationCancelled", payload: webPayload};
438
291
  Situm.updateNavigationState(externalNavigation, () => {}, () => {});
439
292
  }
440
293
 
441
-
294
+ _internalHandleMapViewMessage(message, webPayload) {
295
+ Situm.internalHandleMapViewMessage(message, webPayload);
296
+ }
442
297
 
443
298
  // ==================================================
444
299
  // ACTIONS
@@ -458,10 +313,6 @@ class MapViewControllerImpl {
458
313
  });
459
314
  }
460
315
 
461
- _sendNavigationConfig(navigationType) {
462
- this._sendMessageToViewer('app.set_config_item', [{key:'internal.navigationLibrary',value:navigationType}]);
463
- }
464
-
465
316
  /**
466
317
  * Allows you to navigate to a {@link POI} programmatically in your venue. This will cause the {@link MapView} to start navigation mode displaying the route between the user's location and the POI specified by parameters.
467
318
  *
@@ -40,7 +40,7 @@
40
40
  <ul></ul>
41
41
  </div>
42
42
 
43
- <div class="lnb-api hidden"><h3>Namespaces</h3><ul><li><a href="MapView.html">MapView</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="MapView_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="MapView.html#.onLoad">onLoad</a></li></ul></div></li><li><a href="MapViewController.html">MapViewController</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="MapViewController_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="MapViewController.html#.navigateToPoi">navigateToPoi</a></li><li><a href="MapViewController.html#.onPoiDeselected">onPoiDeselected</a></li><li><a href="MapViewController.html#.onPoiSelected">onPoiSelected</a></li><li><a href="MapViewController.html#.selectPoi">selectPoi</a></li><li><a href="MapViewController.html#.setDirectionsOptions">setDirectionsOptions</a></li><li><a href="MapViewController.html#.setLanguage">setLanguage</a></li></ul></div></li><li><a href="Situm.html">Situm</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="Situm_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="Situm.html#.configureUserHelper">configureUserHelper</a></li><li><a href="Situm.html#.disableUserHelper">disableUserHelper</a></li><li><a href="Situm.html#.enableUserHelper">enableUserHelper</a></li><li><a href="Situm.html#.fetchBuildingInfo">fetchBuildingInfo</a></li><li><a href="Situm.html#.fetchBuildings">fetchBuildings</a></li><li><a href="Situm.html#.fetchEventsFromBuilding">fetchEventsFromBuilding</a></li><li><a href="Situm.html#.fetchFloorsFromBuilding">fetchFloorsFromBuilding</a></li><li><a href="Situm.html#.fetchGeofencesFromBuilding">fetchGeofencesFromBuilding</a></li><li><a href="Situm.html#.fetchIndoorPOIsFromBuilding">fetchIndoorPOIsFromBuilding</a></li><li><a href="Situm.html#.fetchMapFromFloor">fetchMapFromFloor</a></li><li><a href="Situm.html#.fetchOutdoorPOIsFromBuilding">fetchOutdoorPOIsFromBuilding</a></li><li><a href="Situm.html#.fetchPoiCategories">fetchPoiCategories</a></li><li><a href="Situm.html#.fetchPoiCategoryIconNormal">fetchPoiCategoryIconNormal</a></li><li><a href="Situm.html#.fetchPoiCategoryIconSelected">fetchPoiCategoryIconSelected</a></li><li><a href="Situm.html#.getDeviceId">getDeviceId</a></li><li><a href="Situm.html#.internalSetEventDelegate">internalSetEventDelegate</a></li><li><a href="Situm.html#.invalidateCache">invalidateCache</a></li><li><a href="Situm.html#.onEnterGeofences">onEnterGeofences</a></li><li><a href="Situm.html#.onExitGeofences">onExitGeofences</a></li><li><a href="Situm.html#.onLocationError">onLocationError</a></li><li><a href="Situm.html#.onLocationStatus">onLocationStatus</a></li><li><a href="Situm.html#.onLocationUpdate">onLocationUpdate</a></li><li><a href="Situm.html#.removeNavigationUpdates">removeNavigationUpdates</a></li><li><a href="Situm.html#.removeRealTimeUpdates">removeRealTimeUpdates</a></li><li><a href="Situm.html#.removeUpdates">removeUpdates</a></li><li><a href="Situm.html#.requestDirections">requestDirections</a></li><li><a href="Situm.html#.requestLocationUpdates">requestLocationUpdates</a></li><li><a href="Situm.html#.requestNavigationUpdates">requestNavigationUpdates</a></li><li><a href="Situm.html#.requestRealTimeUpdates">requestRealTimeUpdates</a></li><li><a href="Situm.html#.setApiKey">setApiKey</a></li><li><a href="Situm.html#.setCacheMaxAge">setCacheMaxAge</a></li><li><a href="Situm.html#.setUserPass">setUserPass</a></li><li><a href="Situm.html#.startPositioning">startPositioning</a></li><li><a href="Situm.html#.stopPositioning">stopPositioning</a></li><li><a href="Situm.html#.updateNavigationState">updateNavigationState</a></li><li><a href="Situm.html#.updateNavigationWithLocation">updateNavigationWithLocation</a></li></ul></div></li></ul></div><div class="lnb-api hidden"><h3>Global</h3><ul><li><a href="global.html#Angle">Angle</a></li><li><a href="global.html#BeaconFilter">BeaconFilter</a></li><li><a href="global.html#Bounds">Bounds</a></li><li><a href="global.html#Building">Building</a></li><li><a href="global.html#BuildingInfo">BuildingInfo</a></li><li><a href="global.html#CartesianCoordinate">CartesianCoordinate</a></li><li><a href="global.html#Circle">Circle</a></li><li><a href="global.html#Coordinate">Coordinate</a></li><li><a href="global.html#Dimensions">Dimensions</a></li><li><a href="global.html#DirectionsOptions">DirectionsOptions</a></li><li><a href="global.html#DirectionsRequest">DirectionsRequest</a></li><li><a href="global.html#ExternalNavigation">ExternalNavigation</a></li><li><a href="global.html#Floor">Floor</a></li><li><a href="global.html#ForegroundServiceNotificationOptions">ForegroundServiceNotificationOptions</a></li><li><a href="global.html#Geofence">Geofence</a></li><li><a href="global.html#Indication">Indication</a></li><li><a href="global.html#Location">Location</a></li><li><a href="global.html#LocationOptions">LocationOptions</a></li><li><a href="global.html#LocationRequest">LocationRequest</a></li><li><a href="global.html#LocationStatus">LocationStatus</a></li><li class="hidden"><a href="global.html#MapViewDirectionsOptions">MapViewDirectionsOptions</a></li><li><a href="global.html#NavigationProgress">NavigationProgress</a></li><li><a href="global.html#NavigationRequest">NavigationRequest</a></li><li class="hidden"><a href="global.html#OnLocationErrorCallback">OnLocationErrorCallback</a></li><li class="hidden"><a href="global.html#OnLocationStatusCallback">OnLocationStatusCallback</a></li><li class="hidden"><a href="global.html#OnLocationUpdateCallback">OnLocationUpdateCallback</a></li><li><a href="global.html#OutdoorLocationOptions">OutdoorLocationOptions</a></li><li><a href="global.html#POI">POI</a></li><li><a href="global.html#PoiCategory">PoiCategory</a></li><li><a href="global.html#PoiDeselectedResult">PoiDeselectedResult</a></li><li><a href="global.html#Point">Point</a></li><li><a href="global.html#PoiSelectedResult">PoiSelectedResult</a></li><li><a href="global.html#RealTimeData">RealTimeData</a></li><li><a href="global.html#RealTimeRequest">RealTimeRequest</a></li><li><a href="global.html#Route">Route</a></li><li><a href="global.html#RouteSegment">RouteSegment</a></li><li><a href="global.html#RouteStep">RouteStep</a></li><li><a href="global.html#SitumConversionArea">SitumConversionArea</a></li><li><a href="global.html#SitumEvent">SitumEvent</a></li><li><a href="global.html#UserHelperColorScheme">UserHelperColorScheme</a></li><li><a href="global.html#UserHelperOptions">UserHelperOptions</a></li></ul></div>
43
+ <div class="lnb-api hidden"><h3>Namespaces</h3><ul><li><a href="MapView.html">MapView</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="MapView_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="MapView.html#.onLoad">onLoad</a></li></ul></div></li><li><a href="MapViewController.html">MapViewController</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="MapViewController_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="MapViewController.html#.navigateToPoi">navigateToPoi</a></li><li><a href="MapViewController.html#.onPoiDeselected">onPoiDeselected</a></li><li><a href="MapViewController.html#.onPoiSelected">onPoiSelected</a></li><li><a href="MapViewController.html#.selectPoi">selectPoi</a></li><li><a href="MapViewController.html#.setDirectionsOptions">setDirectionsOptions</a></li><li><a href="MapViewController.html#.setLanguage">setLanguage</a></li></ul></div></li><li><a href="Situm.html">Situm</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="Situm_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="Situm.html#.configureUserHelper">configureUserHelper</a></li><li><a href="Situm.html#.disableUserHelper">disableUserHelper</a></li><li><a href="Situm.html#.enableUserHelper">enableUserHelper</a></li><li><a href="Situm.html#.fetchBuildingInfo">fetchBuildingInfo</a></li><li><a href="Situm.html#.fetchBuildings">fetchBuildings</a></li><li><a href="Situm.html#.fetchEventsFromBuilding">fetchEventsFromBuilding</a></li><li><a href="Situm.html#.fetchFloorsFromBuilding">fetchFloorsFromBuilding</a></li><li><a href="Situm.html#.fetchGeofencesFromBuilding">fetchGeofencesFromBuilding</a></li><li><a href="Situm.html#.fetchIndoorPOIsFromBuilding">fetchIndoorPOIsFromBuilding</a></li><li><a href="Situm.html#.fetchMapFromFloor">fetchMapFromFloor</a></li><li><a href="Situm.html#.fetchOutdoorPOIsFromBuilding">fetchOutdoorPOIsFromBuilding</a></li><li><a href="Situm.html#.fetchPoiCategories">fetchPoiCategories</a></li><li><a href="Situm.html#.fetchPoiCategoryIconNormal">fetchPoiCategoryIconNormal</a></li><li><a href="Situm.html#.fetchPoiCategoryIconSelected">fetchPoiCategoryIconSelected</a></li><li><a href="Situm.html#.getDeviceId">getDeviceId</a></li><li><a href="Situm.html#.internalHandleMapViewMessage">internalHandleMapViewMessage</a></li><li><a href="Situm.html#.internalSetEventDelegate">internalSetEventDelegate</a></li><li><a href="Situm.html#.invalidateCache">invalidateCache</a></li><li><a href="Situm.html#.onEnterGeofences">onEnterGeofences</a></li><li><a href="Situm.html#.onExitGeofences">onExitGeofences</a></li><li><a href="Situm.html#.onLocationError">onLocationError</a></li><li><a href="Situm.html#.onLocationStatus">onLocationStatus</a></li><li><a href="Situm.html#.onLocationUpdate">onLocationUpdate</a></li><li><a href="Situm.html#.removeNavigationUpdates">removeNavigationUpdates</a></li><li><a href="Situm.html#.removeRealTimeUpdates">removeRealTimeUpdates</a></li><li><a href="Situm.html#.removeUpdates">removeUpdates</a></li><li><a href="Situm.html#.requestDirections">requestDirections</a></li><li><a href="Situm.html#.requestLocationUpdates">requestLocationUpdates</a></li><li><a href="Situm.html#.requestNavigationUpdates">requestNavigationUpdates</a></li><li><a href="Situm.html#.requestRealTimeUpdates">requestRealTimeUpdates</a></li><li><a href="Situm.html#.setApiKey">setApiKey</a></li><li><a href="Situm.html#.setCacheMaxAge">setCacheMaxAge</a></li><li><a href="Situm.html#.setToken">setToken</a></li><li><a href="Situm.html#.setUserPass">setUserPass</a></li><li><a href="Situm.html#.startPositioning">startPositioning</a></li><li><a href="Situm.html#.stopPositioning">stopPositioning</a></li><li><a href="Situm.html#.updateNavigationState">updateNavigationState</a></li><li><a href="Situm.html#.updateNavigationWithLocation">updateNavigationWithLocation</a></li></ul></div></li></ul></div><div class="lnb-api hidden"><h3>Global</h3><ul><li><a href="global.html#Angle">Angle</a></li><li><a href="global.html#BeaconFilter">BeaconFilter</a></li><li><a href="global.html#Bounds">Bounds</a></li><li><a href="global.html#Building">Building</a></li><li><a href="global.html#BuildingInfo">BuildingInfo</a></li><li><a href="global.html#CartesianCoordinate">CartesianCoordinate</a></li><li><a href="global.html#Circle">Circle</a></li><li><a href="global.html#Coordinate">Coordinate</a></li><li><a href="global.html#Dimensions">Dimensions</a></li><li><a href="global.html#DirectionsOptions">DirectionsOptions</a></li><li><a href="global.html#DirectionsRequest">DirectionsRequest</a></li><li><a href="global.html#ExternalNavigation">ExternalNavigation</a></li><li><a href="global.html#Floor">Floor</a></li><li><a href="global.html#ForegroundServiceNotificationOptions">ForegroundServiceNotificationOptions</a></li><li><a href="global.html#Geofence">Geofence</a></li><li><a href="global.html#Indication">Indication</a></li><li><a href="global.html#Location">Location</a></li><li><a href="global.html#LocationOptions">LocationOptions</a></li><li><a href="global.html#LocationRequest">LocationRequest</a></li><li><a href="global.html#LocationStatus">LocationStatus</a></li><li class="hidden"><a href="global.html#MapViewDirectionsOptions">MapViewDirectionsOptions</a></li><li><a href="global.html#NavigationProgress">NavigationProgress</a></li><li><a href="global.html#NavigationRequest">NavigationRequest</a></li><li class="hidden"><a href="global.html#OnLocationErrorCallback">OnLocationErrorCallback</a></li><li class="hidden"><a href="global.html#OnLocationStatusCallback">OnLocationStatusCallback</a></li><li class="hidden"><a href="global.html#OnLocationUpdateCallback">OnLocationUpdateCallback</a></li><li><a href="global.html#OutdoorLocationOptions">OutdoorLocationOptions</a></li><li><a href="global.html#POI">POI</a></li><li><a href="global.html#PoiCategory">PoiCategory</a></li><li><a href="global.html#PoiDeselectedResult">PoiDeselectedResult</a></li><li><a href="global.html#Point">Point</a></li><li><a href="global.html#PoiSelectedResult">PoiSelectedResult</a></li><li><a href="global.html#RealTimeData">RealTimeData</a></li><li><a href="global.html#RealTimeRequest">RealTimeRequest</a></li><li><a href="global.html#Route">Route</a></li><li><a href="global.html#RouteSegment">RouteSegment</a></li><li><a href="global.html#RouteStep">RouteStep</a></li><li><a href="global.html#SitumConversionArea">SitumConversionArea</a></li><li><a href="global.html#SitumEvent">SitumEvent</a></li><li><a href="global.html#UserHelperColorScheme">UserHelperColorScheme</a></li><li><a href="global.html#UserHelperOptions">UserHelperOptions</a></li></ul></div>
44
44
  </nav>
45
45
  <div id="resizer"></div>
46
46
 
@@ -120,16 +120,18 @@ class MapView extends HTMLElement {
120
120
  connectedCallback() {
121
121
  MapViewController._prepare(this);
122
122
  MapViewController._getDeviceId((deviceId) => {
123
- this.innerHTML = `
124
- &lt;iframe
125
- id="map-view-iframe"
126
- src="${this._getViewerURL(deviceId)}"
127
- width="100%"
128
- height="100%"
129
- style="border: none; box-shadow: none;"
130
- />
131
- `;
123
+ const iframe = document.createElement('iframe');
124
+ iframe.setAttribute('id', 'map-view-iframe');
125
+ iframe.setAttribute('src', this._getViewerURL(deviceId));
126
+ iframe.setAttribute('width', '100%');
127
+ iframe.setAttribute('height', '100%');
128
+ iframe.style.border = 'none';
129
+ iframe.style.boxShadow = 'none';
130
+
131
+ this.innerHTML = '';
132
+ this.appendChild(iframe);
132
133
  });
134
+
133
135
  window.addEventListener('message', this._messageReceivedCallback);
134
136
  }
135
137
 
@@ -151,13 +153,13 @@ class MapView extends HTMLElement {
151
153
  ? this.getAttribute('language')
152
154
  : '';
153
155
 
154
- let situmApiKeyQP = situmApiKey.length > 0 ? `apikey=${situmApiKey}` : '';
156
+ let authQP = situmApiKey.length > 0 ? `apikey=${situmApiKey}` : 'wait_for_auth=true';
155
157
  let buildingIdentifierQP =
156
158
  buildingIdentifier.length > 0 ? `&amp;buildingid=${buildingIdentifier}` : '';
157
159
  let languageQP = language.length > 0 ? `&amp;lng=${language}` : '';
158
160
  let deviceIdQP = deviceId ? `&amp;deviceId=${deviceId}` : '';
159
161
 
160
- let query = `${situmApiKeyQP}${buildingIdentifierQP}${languageQP}${deviceIdQP}&amp;mode=embed`;
162
+ let query = `${authQP}${buildingIdentifierQP}${languageQP}${deviceIdQP}&amp;mode=embed`;
161
163
 
162
164
  let remoteIdentifier = this.getAttribute('remote-identifier');
163
165
  if (remoteIdentifier &amp;&amp; remoteIdentifier.length > 0) {
@@ -40,7 +40,7 @@
40
40
  <ul></ul>
41
41
  </div>
42
42
 
43
- <div class="lnb-api hidden"><h3>Namespaces</h3><ul><li><a href="MapView.html">MapView</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="MapView_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="MapView.html#.onLoad">onLoad</a></li></ul></div></li><li><a href="MapViewController.html">MapViewController</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="MapViewController_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="MapViewController.html#.navigateToPoi">navigateToPoi</a></li><li><a href="MapViewController.html#.onPoiDeselected">onPoiDeselected</a></li><li><a href="MapViewController.html#.onPoiSelected">onPoiSelected</a></li><li><a href="MapViewController.html#.selectPoi">selectPoi</a></li><li><a href="MapViewController.html#.setDirectionsOptions">setDirectionsOptions</a></li><li><a href="MapViewController.html#.setLanguage">setLanguage</a></li></ul></div></li><li><a href="Situm.html">Situm</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="Situm_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="Situm.html#.configureUserHelper">configureUserHelper</a></li><li><a href="Situm.html#.disableUserHelper">disableUserHelper</a></li><li><a href="Situm.html#.enableUserHelper">enableUserHelper</a></li><li><a href="Situm.html#.fetchBuildingInfo">fetchBuildingInfo</a></li><li><a href="Situm.html#.fetchBuildings">fetchBuildings</a></li><li><a href="Situm.html#.fetchEventsFromBuilding">fetchEventsFromBuilding</a></li><li><a href="Situm.html#.fetchFloorsFromBuilding">fetchFloorsFromBuilding</a></li><li><a href="Situm.html#.fetchGeofencesFromBuilding">fetchGeofencesFromBuilding</a></li><li><a href="Situm.html#.fetchIndoorPOIsFromBuilding">fetchIndoorPOIsFromBuilding</a></li><li><a href="Situm.html#.fetchMapFromFloor">fetchMapFromFloor</a></li><li><a href="Situm.html#.fetchOutdoorPOIsFromBuilding">fetchOutdoorPOIsFromBuilding</a></li><li><a href="Situm.html#.fetchPoiCategories">fetchPoiCategories</a></li><li><a href="Situm.html#.fetchPoiCategoryIconNormal">fetchPoiCategoryIconNormal</a></li><li><a href="Situm.html#.fetchPoiCategoryIconSelected">fetchPoiCategoryIconSelected</a></li><li><a href="Situm.html#.getDeviceId">getDeviceId</a></li><li><a href="Situm.html#.internalSetEventDelegate">internalSetEventDelegate</a></li><li><a href="Situm.html#.invalidateCache">invalidateCache</a></li><li><a href="Situm.html#.onEnterGeofences">onEnterGeofences</a></li><li><a href="Situm.html#.onExitGeofences">onExitGeofences</a></li><li><a href="Situm.html#.onLocationError">onLocationError</a></li><li><a href="Situm.html#.onLocationStatus">onLocationStatus</a></li><li><a href="Situm.html#.onLocationUpdate">onLocationUpdate</a></li><li><a href="Situm.html#.removeNavigationUpdates">removeNavigationUpdates</a></li><li><a href="Situm.html#.removeRealTimeUpdates">removeRealTimeUpdates</a></li><li><a href="Situm.html#.removeUpdates">removeUpdates</a></li><li><a href="Situm.html#.requestDirections">requestDirections</a></li><li><a href="Situm.html#.requestLocationUpdates">requestLocationUpdates</a></li><li><a href="Situm.html#.requestNavigationUpdates">requestNavigationUpdates</a></li><li><a href="Situm.html#.requestRealTimeUpdates">requestRealTimeUpdates</a></li><li><a href="Situm.html#.setApiKey">setApiKey</a></li><li><a href="Situm.html#.setCacheMaxAge">setCacheMaxAge</a></li><li><a href="Situm.html#.setUserPass">setUserPass</a></li><li><a href="Situm.html#.startPositioning">startPositioning</a></li><li><a href="Situm.html#.stopPositioning">stopPositioning</a></li><li><a href="Situm.html#.updateNavigationState">updateNavigationState</a></li><li><a href="Situm.html#.updateNavigationWithLocation">updateNavigationWithLocation</a></li></ul></div></li></ul></div><div class="lnb-api hidden"><h3>Global</h3><ul><li><a href="global.html#Angle">Angle</a></li><li><a href="global.html#BeaconFilter">BeaconFilter</a></li><li><a href="global.html#Bounds">Bounds</a></li><li><a href="global.html#Building">Building</a></li><li><a href="global.html#BuildingInfo">BuildingInfo</a></li><li><a href="global.html#CartesianCoordinate">CartesianCoordinate</a></li><li><a href="global.html#Circle">Circle</a></li><li><a href="global.html#Coordinate">Coordinate</a></li><li><a href="global.html#Dimensions">Dimensions</a></li><li><a href="global.html#DirectionsOptions">DirectionsOptions</a></li><li><a href="global.html#DirectionsRequest">DirectionsRequest</a></li><li><a href="global.html#ExternalNavigation">ExternalNavigation</a></li><li><a href="global.html#Floor">Floor</a></li><li><a href="global.html#ForegroundServiceNotificationOptions">ForegroundServiceNotificationOptions</a></li><li><a href="global.html#Geofence">Geofence</a></li><li><a href="global.html#Indication">Indication</a></li><li><a href="global.html#Location">Location</a></li><li><a href="global.html#LocationOptions">LocationOptions</a></li><li><a href="global.html#LocationRequest">LocationRequest</a></li><li><a href="global.html#LocationStatus">LocationStatus</a></li><li class="hidden"><a href="global.html#MapViewDirectionsOptions">MapViewDirectionsOptions</a></li><li><a href="global.html#NavigationProgress">NavigationProgress</a></li><li><a href="global.html#NavigationRequest">NavigationRequest</a></li><li class="hidden"><a href="global.html#OnLocationErrorCallback">OnLocationErrorCallback</a></li><li class="hidden"><a href="global.html#OnLocationStatusCallback">OnLocationStatusCallback</a></li><li class="hidden"><a href="global.html#OnLocationUpdateCallback">OnLocationUpdateCallback</a></li><li><a href="global.html#OutdoorLocationOptions">OutdoorLocationOptions</a></li><li><a href="global.html#POI">POI</a></li><li><a href="global.html#PoiCategory">PoiCategory</a></li><li><a href="global.html#PoiDeselectedResult">PoiDeselectedResult</a></li><li><a href="global.html#Point">Point</a></li><li><a href="global.html#PoiSelectedResult">PoiSelectedResult</a></li><li><a href="global.html#RealTimeData">RealTimeData</a></li><li><a href="global.html#RealTimeRequest">RealTimeRequest</a></li><li><a href="global.html#Route">Route</a></li><li><a href="global.html#RouteSegment">RouteSegment</a></li><li><a href="global.html#RouteStep">RouteStep</a></li><li><a href="global.html#SitumConversionArea">SitumConversionArea</a></li><li><a href="global.html#SitumEvent">SitumEvent</a></li><li><a href="global.html#UserHelperColorScheme">UserHelperColorScheme</a></li><li><a href="global.html#UserHelperOptions">UserHelperOptions</a></li></ul></div>
43
+ <div class="lnb-api hidden"><h3>Namespaces</h3><ul><li><a href="MapView.html">MapView</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="MapView_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="MapView.html#.onLoad">onLoad</a></li></ul></div></li><li><a href="MapViewController.html">MapViewController</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="MapViewController_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="MapViewController.html#.navigateToPoi">navigateToPoi</a></li><li><a href="MapViewController.html#.onPoiDeselected">onPoiDeselected</a></li><li><a href="MapViewController.html#.onPoiSelected">onPoiSelected</a></li><li><a href="MapViewController.html#.selectPoi">selectPoi</a></li><li><a href="MapViewController.html#.setDirectionsOptions">setDirectionsOptions</a></li><li><a href="MapViewController.html#.setLanguage">setLanguage</a></li></ul></div></li><li><a href="Situm.html">Situm</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="Situm_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="Situm.html#.configureUserHelper">configureUserHelper</a></li><li><a href="Situm.html#.disableUserHelper">disableUserHelper</a></li><li><a href="Situm.html#.enableUserHelper">enableUserHelper</a></li><li><a href="Situm.html#.fetchBuildingInfo">fetchBuildingInfo</a></li><li><a href="Situm.html#.fetchBuildings">fetchBuildings</a></li><li><a href="Situm.html#.fetchEventsFromBuilding">fetchEventsFromBuilding</a></li><li><a href="Situm.html#.fetchFloorsFromBuilding">fetchFloorsFromBuilding</a></li><li><a href="Situm.html#.fetchGeofencesFromBuilding">fetchGeofencesFromBuilding</a></li><li><a href="Situm.html#.fetchIndoorPOIsFromBuilding">fetchIndoorPOIsFromBuilding</a></li><li><a href="Situm.html#.fetchMapFromFloor">fetchMapFromFloor</a></li><li><a href="Situm.html#.fetchOutdoorPOIsFromBuilding">fetchOutdoorPOIsFromBuilding</a></li><li><a href="Situm.html#.fetchPoiCategories">fetchPoiCategories</a></li><li><a href="Situm.html#.fetchPoiCategoryIconNormal">fetchPoiCategoryIconNormal</a></li><li><a href="Situm.html#.fetchPoiCategoryIconSelected">fetchPoiCategoryIconSelected</a></li><li><a href="Situm.html#.getDeviceId">getDeviceId</a></li><li><a href="Situm.html#.internalHandleMapViewMessage">internalHandleMapViewMessage</a></li><li><a href="Situm.html#.internalSetEventDelegate">internalSetEventDelegate</a></li><li><a href="Situm.html#.invalidateCache">invalidateCache</a></li><li><a href="Situm.html#.onEnterGeofences">onEnterGeofences</a></li><li><a href="Situm.html#.onExitGeofences">onExitGeofences</a></li><li><a href="Situm.html#.onLocationError">onLocationError</a></li><li><a href="Situm.html#.onLocationStatus">onLocationStatus</a></li><li><a href="Situm.html#.onLocationUpdate">onLocationUpdate</a></li><li><a href="Situm.html#.removeNavigationUpdates">removeNavigationUpdates</a></li><li><a href="Situm.html#.removeRealTimeUpdates">removeRealTimeUpdates</a></li><li><a href="Situm.html#.removeUpdates">removeUpdates</a></li><li><a href="Situm.html#.requestDirections">requestDirections</a></li><li><a href="Situm.html#.requestLocationUpdates">requestLocationUpdates</a></li><li><a href="Situm.html#.requestNavigationUpdates">requestNavigationUpdates</a></li><li><a href="Situm.html#.requestRealTimeUpdates">requestRealTimeUpdates</a></li><li><a href="Situm.html#.setApiKey">setApiKey</a></li><li><a href="Situm.html#.setCacheMaxAge">setCacheMaxAge</a></li><li><a href="Situm.html#.setToken">setToken</a></li><li><a href="Situm.html#.setUserPass">setUserPass</a></li><li><a href="Situm.html#.startPositioning">startPositioning</a></li><li><a href="Situm.html#.stopPositioning">stopPositioning</a></li><li><a href="Situm.html#.updateNavigationState">updateNavigationState</a></li><li><a href="Situm.html#.updateNavigationWithLocation">updateNavigationWithLocation</a></li></ul></div></li></ul></div><div class="lnb-api hidden"><h3>Global</h3><ul><li><a href="global.html#Angle">Angle</a></li><li><a href="global.html#BeaconFilter">BeaconFilter</a></li><li><a href="global.html#Bounds">Bounds</a></li><li><a href="global.html#Building">Building</a></li><li><a href="global.html#BuildingInfo">BuildingInfo</a></li><li><a href="global.html#CartesianCoordinate">CartesianCoordinate</a></li><li><a href="global.html#Circle">Circle</a></li><li><a href="global.html#Coordinate">Coordinate</a></li><li><a href="global.html#Dimensions">Dimensions</a></li><li><a href="global.html#DirectionsOptions">DirectionsOptions</a></li><li><a href="global.html#DirectionsRequest">DirectionsRequest</a></li><li><a href="global.html#ExternalNavigation">ExternalNavigation</a></li><li><a href="global.html#Floor">Floor</a></li><li><a href="global.html#ForegroundServiceNotificationOptions">ForegroundServiceNotificationOptions</a></li><li><a href="global.html#Geofence">Geofence</a></li><li><a href="global.html#Indication">Indication</a></li><li><a href="global.html#Location">Location</a></li><li><a href="global.html#LocationOptions">LocationOptions</a></li><li><a href="global.html#LocationRequest">LocationRequest</a></li><li><a href="global.html#LocationStatus">LocationStatus</a></li><li class="hidden"><a href="global.html#MapViewDirectionsOptions">MapViewDirectionsOptions</a></li><li><a href="global.html#NavigationProgress">NavigationProgress</a></li><li><a href="global.html#NavigationRequest">NavigationRequest</a></li><li class="hidden"><a href="global.html#OnLocationErrorCallback">OnLocationErrorCallback</a></li><li class="hidden"><a href="global.html#OnLocationStatusCallback">OnLocationStatusCallback</a></li><li class="hidden"><a href="global.html#OnLocationUpdateCallback">OnLocationUpdateCallback</a></li><li><a href="global.html#OutdoorLocationOptions">OutdoorLocationOptions</a></li><li><a href="global.html#POI">POI</a></li><li><a href="global.html#PoiCategory">PoiCategory</a></li><li><a href="global.html#PoiDeselectedResult">PoiDeselectedResult</a></li><li><a href="global.html#Point">Point</a></li><li><a href="global.html#PoiSelectedResult">PoiSelectedResult</a></li><li><a href="global.html#RealTimeData">RealTimeData</a></li><li><a href="global.html#RealTimeRequest">RealTimeRequest</a></li><li><a href="global.html#Route">Route</a></li><li><a href="global.html#RouteSegment">RouteSegment</a></li><li><a href="global.html#RouteStep">RouteStep</a></li><li><a href="global.html#SitumConversionArea">SitumConversionArea</a></li><li><a href="global.html#SitumEvent">SitumEvent</a></li><li><a href="global.html#UserHelperColorScheme">UserHelperColorScheme</a></li><li><a href="global.html#UserHelperOptions">UserHelperOptions</a></li></ul></div>
44
44
  </nav>
45
45
  <div id="resizer"></div>
46
46
 
@@ -57,6 +57,8 @@ const common = require('@situm/cordova.common-utils');
57
57
 
58
58
  var PLUGIN_NAME = 'SitumPlugin';
59
59
  let _internalEventDelegate = undefined;
60
+ let _internalTokenCallback = undefined;
61
+ let _token = String;
60
62
 
61
63
  let _clientLocationUpdateCallback;
62
64
  let _clientLocationStatusCallback;
@@ -94,6 +96,20 @@ var Situm = {
94
96
  internalSetEventDelegate: function (callback) {
95
97
  _internalEventDelegate = callback;
96
98
  },
99
+ /**
100
+ * An internal method.
101
+ * @param {string} message MapView message key.
102
+ * @param {object} payload MapView message payload.
103
+ */
104
+ internalHandleMapViewMessage: function(message, payload) {
105
+ exec(() => {}, () => {}, PLUGIN_NAME, 'internalHandleMapViewMessage', [message, payload]);
106
+ },
107
+ internalGetToken: function() {
108
+ return _token;
109
+ },
110
+ internalSetTokenCallback: function(callback) {
111
+ _internalTokenCallback = callback;
112
+ },
97
113
  /**
98
114
  * Provides your API key to the Situm SDK.
99
115
  * @description Provides your API key to the Situm SDK. This key is generated for your application in the Dashboard. Old credentials will be removed.
@@ -109,6 +125,36 @@ var Situm = {
109
125
  setUseRemoteConfig: function (useRemoteConfig, cb, error) {
110
126
  exec(cb, error, PLUGIN_NAME, 'setUseRemoteConfig', [useRemoteConfig]);
111
127
  },
128
+ /**
129
+ * Provides your token to the Situm SDK. Any previously configured credentials will be replaced.
130
+ * &lt;p>The SDK does not cryptographically validate the token signature, nor does it verify the
131
+ * token against Situm servers when this method is called. The token is parsed locally only to
132
+ * obtain the account information needed by the SDK, and it will be sent as a Bearer token in
133
+ * subsequent authenticated network requests.&lt;/p>
134
+ *
135
+ * &lt;p>If the provided token is expired, has an invalid signature, or is otherwise rejected by
136
+ * Situm servers, network operations that require server authentication will fail. However,
137
+ * features that can operate with already cached local data may continue to work, such as
138
+ * visualizing cached resources or positioning with previously downloaded positioning data.&lt;/p>
139
+ *
140
+ * &lt;p>User-provided tokens cannot be renewed automatically by the SDK. To recover from an
141
+ * expired or rejected token, provide a new token by calling this method again.&lt;/p>
142
+ *
143
+ * @description Provides your token to the Situm SDK. Any previously configured credentials will be replaced.
144
+ * @param {string} base64Token String representing the token used for authentication; must not be {@code null} or empty.
145
+ * The expected format is a base64-encoded JWT with header, payload and signature sections.
146
+ * This token can be retrieved from &lt;a href="https://developers.situm.com/pages/rest/openapi/#tag/jwt/POST/api/v1/auth/access_tokens">a REST endpoint&lt;/a>.
147
+ * @param {function} cb Cordova native callback to recive data.
148
+ * @param {function} error Cordova native callback to recive errors.
149
+ * @return {boolean} success True if operation finished successfully, otherwise false
150
+ */
151
+ setToken: function (base64Token, cb, error) {
152
+ _token = base64Token;
153
+ if (_internalTokenCallback) {
154
+ _internalTokenCallback(base64Token);
155
+ }
156
+ exec(cb, error, PLUGIN_NAME, 'setToken', [base64Token]);
157
+ },
112
158
  /**
113
159
  * Provides user's email and password.
114
160
  * @description Provides user's email and password. This credentials will be used to obtain a valid user token to authenticate the server request, when necessary. Token obtaining is not necessary done when this method is executed. Old credentials will be removed.
@@ -8,9 +8,9 @@
8
8
  # You can see what browsers were selected by your queries by running:
9
9
  # npx browserslist
10
10
 
11
- Chrome >=79
12
- ChromeAndroid >=79
13
- Firefox >=70
14
- Edge >=79
15
- Safari >=14
16
- iOS >=14
11
+ last 2 Chrome versions
12
+ last 1 Firefox version
13
+ last 2 Edge major versions
14
+ last 2 Safari major versions
15
+ last 2 iOS major versions
16
+ Firefox ESR