@mapvx/web-js 4.0.3 → 4.0.4
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/dist/cjs/index.js +4 -2
- package/dist/es/assets/icons.d.ts +0 -1
- package/dist/es/assets/icons.js +0 -50
- package/dist/es/config/draco.d.ts +0 -1
- package/dist/es/config/draco.js +0 -10
- package/dist/es/config/sdkConfig.d.ts +0 -1
- package/dist/es/config/sdkConfig.js +0 -1
- package/dist/es/controllers/markerLayoutController.d.ts +0 -1
- package/dist/es/controllers/markerLayoutController.js +0 -103
- package/dist/es/controllers/routeController.d.ts +0 -1
- package/dist/es/controllers/routeController.js +1 -473
- package/dist/es/domain/models/_internal.d.ts +0 -1
- package/dist/es/domain/models/_internal.js +0 -8
- package/dist/es/domain/models/animation.d.ts +0 -1
- package/dist/es/domain/models/animation.js +0 -6
- package/dist/es/domain/models/banner.d.ts +0 -1
- package/dist/es/domain/models/banner.js +0 -10
- package/dist/es/domain/models/campaign.d.ts +0 -1
- package/dist/es/domain/models/campaign.js +0 -29
- package/dist/es/domain/models/categories.d.ts +0 -1
- package/dist/es/domain/models/categories.js +0 -20
- package/dist/es/domain/models/circle.d.ts +0 -1
- package/dist/es/domain/models/circle.js +0 -118
- package/dist/es/domain/models/cityFilterOption.d.ts +0 -1
- package/dist/es/domain/models/cityFilterOption.js +0 -1
- package/dist/es/domain/models/configuration.d.ts +0 -1
- package/dist/es/domain/models/configuration.js +0 -1
- package/dist/es/domain/models/cssCustomization.d.ts +0 -1
- package/dist/es/domain/models/cssCustomization.js +0 -1
- package/dist/es/domain/models/fitOptions.d.ts +0 -1
- package/dist/es/domain/models/fitOptions.js +0 -1
- package/dist/es/domain/models/innerFloors.d.ts +0 -1
- package/dist/es/domain/models/innerFloors.js +0 -1
- package/dist/es/domain/models/institution.d.ts +0 -1
- package/dist/es/domain/models/institution.js +0 -26
- package/dist/es/domain/models/latLng.d.ts +0 -1
- package/dist/es/domain/models/latLng.js +0 -1
- package/dist/es/domain/models/location.d.ts +0 -1
- package/dist/es/domain/models/location.js +0 -1
- package/dist/es/domain/models/loggeable.d.ts +0 -1
- package/dist/es/domain/models/loggeable.js +0 -24
- package/dist/es/domain/models/mapCamera.d.ts +0 -1
- package/dist/es/domain/models/mapCamera.js +0 -1
- package/dist/es/domain/models/mapConfig.d.ts +0 -1
- package/dist/es/domain/models/mapConfig.js +1 -17
- package/dist/es/domain/models/marker.d.ts +0 -1
- package/dist/es/domain/models/marker.js +0 -292
- package/dist/es/domain/models/multilanguage.d.ts +0 -1
- package/dist/es/domain/models/multilanguage.js +0 -10
- package/dist/es/domain/models/openingHours.d.ts +0 -1
- package/dist/es/domain/models/openingHours.js +0 -1
- package/dist/es/domain/models/place.d.ts +0 -1
- package/dist/es/domain/models/place.js +0 -68
- package/dist/es/domain/models/platform.d.ts +0 -1
- package/dist/es/domain/models/platform.js +0 -1
- package/dist/es/domain/models/popover.d.ts +0 -1
- package/dist/es/domain/models/popover.js +0 -1
- package/dist/es/domain/models/product.d.ts +0 -1
- package/dist/es/domain/models/product.js +0 -1
- package/dist/es/domain/models/property.d.ts +0 -1
- package/dist/es/domain/models/property.js +0 -16
- package/dist/es/domain/models/route.d.ts +0 -1
- package/dist/es/domain/models/route.js +0 -71
- package/dist/es/domain/models/routeConfiguration.d.ts +0 -1
- package/dist/es/domain/models/routeConfiguration.js +0 -36
- package/dist/es/domain/models/routeInstance.d.ts +0 -1
- package/dist/es/domain/models/routeInstance.js +0 -8
- package/dist/es/domain/models/routeStyle.d.ts +0 -1
- package/dist/es/domain/models/routeStyle.js +0 -1
- package/dist/es/domain/models/scene3D.d.ts +0 -1
- package/dist/es/domain/models/scene3D.js +0 -1
- package/dist/es/domain/models/transport.d.ts +0 -1
- package/dist/es/domain/models/transport.js +0 -12
- package/dist/es/domain/ports/ICache.d.ts +0 -1
- package/dist/es/domain/ports/ICache.js +0 -1
- package/dist/es/domain/ports/IHttpClient.d.ts +0 -1
- package/dist/es/domain/ports/IHttpClient.js +0 -1
- package/dist/es/domain/ports/ILogger.d.ts +0 -1
- package/dist/es/domain/ports/ILogger.js +0 -9
- package/dist/es/domain/ports/index.d.ts +0 -1
- package/dist/es/domain/ports/index.js +0 -5
- package/dist/es/index.d.ts +0 -1
- package/dist/es/index.js +1 -28
- package/dist/es/infrastructure/cache/CacheManager.d.ts +0 -1
- package/dist/es/infrastructure/cache/CacheManager.js +0 -94
- package/dist/es/infrastructure/cache/LRUCache.d.ts +0 -1
- package/dist/es/infrastructure/cache/LRUCache.js +0 -57
- package/dist/es/infrastructure/cache/PersistentCache.d.ts +0 -1
- package/dist/es/infrastructure/cache/PersistentCache.js +0 -51
- package/dist/es/infrastructure/cache/cacheConfig.d.ts +0 -1
- package/dist/es/infrastructure/cache/cacheConfig.js +8 -27
- package/dist/es/infrastructure/http/FetchHttpClient.d.ts +0 -1
- package/dist/es/infrastructure/http/FetchHttpClient.js +0 -36
- package/dist/es/infrastructure/logging/MVXLogger.d.ts +0 -1
- package/dist/es/infrastructure/logging/MVXLogger.js +0 -37
- package/dist/es/interfaces/cache.d.ts +0 -1
- package/dist/es/interfaces/cache.js +0 -1
- package/dist/es/interfaces/healthResponse.d.ts +0 -1
- package/dist/es/interfaces/healthResponse.js +0 -1
- package/dist/es/interfaces/institutionResponse.d.ts +0 -1
- package/dist/es/interfaces/institutionResponse.js +0 -1
- package/dist/es/interfaces/metadata.d.ts +0 -1
- package/dist/es/interfaces/metadata.js +0 -1
- package/dist/es/interfaces/placeResponse.d.ts +0 -1
- package/dist/es/interfaces/placeResponse.js +0 -1
- package/dist/es/interfaces/routeCacheResponse.d.ts +0 -1
- package/dist/es/interfaces/routeCacheResponse.js +0 -1
- package/dist/es/interfaces/routeResponse.d.ts +0 -1
- package/dist/es/interfaces/routeResponse.js +0 -1
- package/dist/es/interfaces/styleResponse.d.ts +0 -1
- package/dist/es/interfaces/styleResponse.js +0 -1
- package/dist/es/logger/logger.d.ts +0 -1
- package/dist/es/logger/logger.js +0 -10
- package/dist/es/logger/sentry.d.ts +0 -1
- package/dist/es/logger/sentry.js +1 -39
- package/dist/es/map/fitCamera.d.ts +0 -1
- package/dist/es/map/fitCamera.js +0 -44
- package/dist/es/map/generated/maplibreWorkerSource.d.ts +0 -1
- package/dist/es/map/generated/maplibreWorkerSource.js +0 -12
- package/dist/es/map/installMapLibreWorker.d.ts +0 -1
- package/dist/es/map/installMapLibreWorker.js +0 -100
- package/dist/es/map/liveMapFitTransform.d.ts +0 -1
- package/dist/es/map/liveMapFitTransform.js +0 -82
- package/dist/es/map/map.d.ts +0 -1
- package/dist/es/map/map.js +4 -681
- package/dist/es/map/mapInteractionOptions.d.ts +0 -1
- package/dist/es/map/mapInteractionOptions.js +0 -35
- package/dist/es/map/scene3DController.d.ts +0 -1
- package/dist/es/map/scene3DController.js +0 -221
- package/dist/es/repository/repository.d.ts +0 -1
- package/dist/es/repository/repository.js +0 -56
- package/dist/es/repository/requester.d.ts +0 -1
- package/dist/es/repository/requester.js +0 -233
- package/dist/es/sdk.d.ts +0 -1
- package/dist/es/sdk.js +0 -35
- package/dist/es/utils/3d.d.ts +0 -1
- package/dist/es/utils/3d.js +0 -79
- package/dist/es/utils/deckLayers.d.ts +0 -1
- package/dist/es/utils/deckLayers.js +1 -27
- package/dist/es/utils/error.d.ts +0 -1
- package/dist/es/utils/error.js +0 -7
- package/dist/es/utils/images.d.ts +0 -1
- package/dist/es/utils/images.js +0 -7
- package/dist/es/utils/loadGlb.d.ts +0 -1
- package/dist/es/utils/loadGlb.js +2 -96
- package/dist/es/utils/mapvxHostname.d.ts +0 -1
- package/dist/es/utils/mapvxHostname.js +0 -11
- package/dist/es/utils/nav-functions.d.ts +0 -1
- package/dist/es/utils/nav-functions.js +0 -82
- package/dist/es/utils/opening-hours-helper.d.ts +0 -1
- package/dist/es/utils/opening-hours-helper.js +6 -382
- package/dist/es/utils/preconnect.d.ts +0 -1
- package/dist/es/utils/preconnect.js +0 -61
- package/dist/es/utils/route-utils.d.ts +0 -1
- package/dist/es/utils/route-utils.js +0 -25
- package/dist/es/utils/semaphore.d.ts +0 -1
- package/dist/es/utils/semaphore.js +0 -78
- package/dist/es/utils/three.d.ts +0 -1
- package/dist/es/utils/three.js +0 -43
- package/dist/es/utils/threeScene.d.ts +0 -1
- package/dist/es/utils/threeScene.js +0 -38
- package/dist/es/utils/update-css.d.ts +0 -1
- package/dist/es/utils/update-css.js +0 -26
- package/dist/es/utils/utils.d.ts +0 -1
- package/dist/es/utils/utils.js +0 -53
- package/dist/umd/index.js +4 -29240
- package/dist/umd/index.js.LICENSE.txt +1 -0
- package/dist/umd/styles.css +0 -1
- package/dist/umd/styles.js +3 -32
- package/package.json +11 -5
- package/dist/cjs/index.js.map +0 -1
- package/dist/es/assets/icons.d.ts.map +0 -1
- package/dist/es/assets/icons.js.map +0 -1
- package/dist/es/config/draco.d.ts.map +0 -1
- package/dist/es/config/draco.js.map +0 -1
- package/dist/es/config/sdkConfig.d.ts.map +0 -1
- package/dist/es/config/sdkConfig.js.map +0 -1
- package/dist/es/controllers/markerLayoutController.d.ts.map +0 -1
- package/dist/es/controllers/markerLayoutController.js.map +0 -1
- package/dist/es/controllers/routeController.d.ts.map +0 -1
- package/dist/es/controllers/routeController.js.map +0 -1
- package/dist/es/domain/models/_internal.d.ts.map +0 -1
- package/dist/es/domain/models/_internal.js.map +0 -1
- package/dist/es/domain/models/animation.d.ts.map +0 -1
- package/dist/es/domain/models/animation.js.map +0 -1
- package/dist/es/domain/models/banner.d.ts.map +0 -1
- package/dist/es/domain/models/banner.js.map +0 -1
- package/dist/es/domain/models/campaign.d.ts.map +0 -1
- package/dist/es/domain/models/campaign.js.map +0 -1
- package/dist/es/domain/models/categories.d.ts.map +0 -1
- package/dist/es/domain/models/categories.js.map +0 -1
- package/dist/es/domain/models/circle.d.ts.map +0 -1
- package/dist/es/domain/models/circle.js.map +0 -1
- package/dist/es/domain/models/cityFilterOption.d.ts.map +0 -1
- package/dist/es/domain/models/cityFilterOption.js.map +0 -1
- package/dist/es/domain/models/configuration.d.ts.map +0 -1
- package/dist/es/domain/models/configuration.js.map +0 -1
- package/dist/es/domain/models/cssCustomization.d.ts.map +0 -1
- package/dist/es/domain/models/cssCustomization.js.map +0 -1
- package/dist/es/domain/models/fitOptions.d.ts.map +0 -1
- package/dist/es/domain/models/fitOptions.js.map +0 -1
- package/dist/es/domain/models/innerFloors.d.ts.map +0 -1
- package/dist/es/domain/models/innerFloors.js.map +0 -1
- package/dist/es/domain/models/institution.d.ts.map +0 -1
- package/dist/es/domain/models/institution.js.map +0 -1
- package/dist/es/domain/models/latLng.d.ts.map +0 -1
- package/dist/es/domain/models/latLng.js.map +0 -1
- package/dist/es/domain/models/location.d.ts.map +0 -1
- package/dist/es/domain/models/location.js.map +0 -1
- package/dist/es/domain/models/loggeable.d.ts.map +0 -1
- package/dist/es/domain/models/loggeable.js.map +0 -1
- package/dist/es/domain/models/mapCamera.d.ts.map +0 -1
- package/dist/es/domain/models/mapCamera.js.map +0 -1
- package/dist/es/domain/models/mapConfig.d.ts.map +0 -1
- package/dist/es/domain/models/mapConfig.js.map +0 -1
- package/dist/es/domain/models/marker.d.ts.map +0 -1
- package/dist/es/domain/models/marker.js.map +0 -1
- package/dist/es/domain/models/multilanguage.d.ts.map +0 -1
- package/dist/es/domain/models/multilanguage.js.map +0 -1
- package/dist/es/domain/models/openingHours.d.ts.map +0 -1
- package/dist/es/domain/models/openingHours.js.map +0 -1
- package/dist/es/domain/models/place.d.ts.map +0 -1
- package/dist/es/domain/models/place.js.map +0 -1
- package/dist/es/domain/models/platform.d.ts.map +0 -1
- package/dist/es/domain/models/platform.js.map +0 -1
- package/dist/es/domain/models/popover.d.ts.map +0 -1
- package/dist/es/domain/models/popover.js.map +0 -1
- package/dist/es/domain/models/product.d.ts.map +0 -1
- package/dist/es/domain/models/product.js.map +0 -1
- package/dist/es/domain/models/property.d.ts.map +0 -1
- package/dist/es/domain/models/property.js.map +0 -1
- package/dist/es/domain/models/route.d.ts.map +0 -1
- package/dist/es/domain/models/route.js.map +0 -1
- package/dist/es/domain/models/routeConfiguration.d.ts.map +0 -1
- package/dist/es/domain/models/routeConfiguration.js.map +0 -1
- package/dist/es/domain/models/routeInstance.d.ts.map +0 -1
- package/dist/es/domain/models/routeInstance.js.map +0 -1
- package/dist/es/domain/models/routeStyle.d.ts.map +0 -1
- package/dist/es/domain/models/routeStyle.js.map +0 -1
- package/dist/es/domain/models/scene3D.d.ts.map +0 -1
- package/dist/es/domain/models/scene3D.js.map +0 -1
- package/dist/es/domain/models/transport.d.ts.map +0 -1
- package/dist/es/domain/models/transport.js.map +0 -1
- package/dist/es/domain/ports/ICache.d.ts.map +0 -1
- package/dist/es/domain/ports/ICache.js.map +0 -1
- package/dist/es/domain/ports/IHttpClient.d.ts.map +0 -1
- package/dist/es/domain/ports/IHttpClient.js.map +0 -1
- package/dist/es/domain/ports/ILogger.d.ts.map +0 -1
- package/dist/es/domain/ports/ILogger.js.map +0 -1
- package/dist/es/domain/ports/index.d.ts.map +0 -1
- package/dist/es/domain/ports/index.js.map +0 -1
- package/dist/es/index.d.ts.map +0 -1
- package/dist/es/index.js.map +0 -1
- package/dist/es/infrastructure/cache/CacheManager.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/CacheManager.js.map +0 -1
- package/dist/es/infrastructure/cache/LRUCache.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/LRUCache.js.map +0 -1
- package/dist/es/infrastructure/cache/PersistentCache.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/PersistentCache.js.map +0 -1
- package/dist/es/infrastructure/cache/cacheConfig.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/cacheConfig.js.map +0 -1
- package/dist/es/infrastructure/http/FetchHttpClient.d.ts.map +0 -1
- package/dist/es/infrastructure/http/FetchHttpClient.js.map +0 -1
- package/dist/es/infrastructure/logging/MVXLogger.d.ts.map +0 -1
- package/dist/es/infrastructure/logging/MVXLogger.js.map +0 -1
- package/dist/es/interfaces/cache.d.ts.map +0 -1
- package/dist/es/interfaces/cache.js.map +0 -1
- package/dist/es/interfaces/healthResponse.d.ts.map +0 -1
- package/dist/es/interfaces/healthResponse.js.map +0 -1
- package/dist/es/interfaces/institutionResponse.d.ts.map +0 -1
- package/dist/es/interfaces/institutionResponse.js.map +0 -1
- package/dist/es/interfaces/metadata.d.ts.map +0 -1
- package/dist/es/interfaces/metadata.js.map +0 -1
- package/dist/es/interfaces/placeResponse.d.ts.map +0 -1
- package/dist/es/interfaces/placeResponse.js.map +0 -1
- package/dist/es/interfaces/routeCacheResponse.d.ts.map +0 -1
- package/dist/es/interfaces/routeCacheResponse.js.map +0 -1
- package/dist/es/interfaces/routeResponse.d.ts.map +0 -1
- package/dist/es/interfaces/routeResponse.js.map +0 -1
- package/dist/es/interfaces/styleResponse.d.ts.map +0 -1
- package/dist/es/interfaces/styleResponse.js.map +0 -1
- package/dist/es/logger/logger.d.ts.map +0 -1
- package/dist/es/logger/logger.js.map +0 -1
- package/dist/es/logger/sentry.d.ts.map +0 -1
- package/dist/es/logger/sentry.js.map +0 -1
- package/dist/es/map/fitCamera.d.ts.map +0 -1
- package/dist/es/map/fitCamera.js.map +0 -1
- package/dist/es/map/generated/maplibreWorkerSource.d.ts.map +0 -1
- package/dist/es/map/generated/maplibreWorkerSource.js.map +0 -1
- package/dist/es/map/installMapLibreWorker.d.ts.map +0 -1
- package/dist/es/map/installMapLibreWorker.js.map +0 -1
- package/dist/es/map/liveMapFitTransform.d.ts.map +0 -1
- package/dist/es/map/liveMapFitTransform.js.map +0 -1
- package/dist/es/map/map.d.ts.map +0 -1
- package/dist/es/map/map.js.map +0 -1
- package/dist/es/map/mapInteractionOptions.d.ts.map +0 -1
- package/dist/es/map/mapInteractionOptions.js.map +0 -1
- package/dist/es/map/scene3DController.d.ts.map +0 -1
- package/dist/es/map/scene3DController.js.map +0 -1
- package/dist/es/repository/repository.d.ts.map +0 -1
- package/dist/es/repository/repository.js.map +0 -1
- package/dist/es/repository/requester.d.ts.map +0 -1
- package/dist/es/repository/requester.js.map +0 -1
- package/dist/es/sdk.d.ts.map +0 -1
- package/dist/es/sdk.js.map +0 -1
- package/dist/es/utils/3d.d.ts.map +0 -1
- package/dist/es/utils/3d.js.map +0 -1
- package/dist/es/utils/deckLayers.d.ts.map +0 -1
- package/dist/es/utils/deckLayers.js.map +0 -1
- package/dist/es/utils/error.d.ts.map +0 -1
- package/dist/es/utils/error.js.map +0 -1
- package/dist/es/utils/images.d.ts.map +0 -1
- package/dist/es/utils/images.js.map +0 -1
- package/dist/es/utils/loadGlb.d.ts.map +0 -1
- package/dist/es/utils/loadGlb.js.map +0 -1
- package/dist/es/utils/mapvxHostname.d.ts.map +0 -1
- package/dist/es/utils/mapvxHostname.js.map +0 -1
- package/dist/es/utils/nav-functions.d.ts.map +0 -1
- package/dist/es/utils/nav-functions.js.map +0 -1
- package/dist/es/utils/opening-hours-helper.d.ts.map +0 -1
- package/dist/es/utils/opening-hours-helper.js.map +0 -1
- package/dist/es/utils/preconnect.d.ts.map +0 -1
- package/dist/es/utils/preconnect.js.map +0 -1
- package/dist/es/utils/route-utils.d.ts.map +0 -1
- package/dist/es/utils/route-utils.js.map +0 -1
- package/dist/es/utils/semaphore.d.ts.map +0 -1
- package/dist/es/utils/semaphore.js.map +0 -1
- package/dist/es/utils/three.d.ts.map +0 -1
- package/dist/es/utils/three.js.map +0 -1
- package/dist/es/utils/threeScene.d.ts.map +0 -1
- package/dist/es/utils/threeScene.js.map +0 -1
- package/dist/es/utils/update-css.d.ts.map +0 -1
- package/dist/es/utils/update-css.js.map +0 -1
- package/dist/es/utils/utils.d.ts.map +0 -1
- package/dist/es/utils/utils.js.map +0 -1
- package/dist/umd/index.js.map +0 -1
- package/dist/umd/styles.css.map +0 -1
- package/dist/umd/styles.js.map +0 -1
|
@@ -6,13 +6,6 @@ import { MVXRoute } from "../domain/models/route";
|
|
|
6
6
|
import { MVXTransport } from "../domain/models/transport";
|
|
7
7
|
import { CacheManager } from "../infrastructure/cache/CacheManager";
|
|
8
8
|
import { Requester } from "./requester";
|
|
9
|
-
/**
|
|
10
|
-
* Extracts a human-readable error message from an API error response body.
|
|
11
|
-
* Handles various response formats: string, object with message/error field, or falls back to JSON.
|
|
12
|
-
* @param errorBody - The parsed JSON body from an error response
|
|
13
|
-
* @returns A string representation of the error
|
|
14
|
-
* @hidden
|
|
15
|
-
*/
|
|
16
9
|
function extractErrorMessage(errorBody) {
|
|
17
10
|
if (typeof errorBody === "string")
|
|
18
11
|
return errorBody;
|
|
@@ -25,10 +18,6 @@ function extractErrorMessage(errorBody) {
|
|
|
25
18
|
}
|
|
26
19
|
return JSON.stringify(errorBody);
|
|
27
20
|
}
|
|
28
|
-
/**
|
|
29
|
-
* Represents the repository for the SDK.
|
|
30
|
-
* @hidden
|
|
31
|
-
*/
|
|
32
21
|
export class Repository extends Loggeable {
|
|
33
22
|
constructor(token, lang, apiUrl, cache, mapvxRequestContext, endpoints) {
|
|
34
23
|
super();
|
|
@@ -38,10 +27,6 @@ export class Repository extends Loggeable {
|
|
|
38
27
|
this.requester = new Requester(lang, apiUrl, mapvxRequestContext, endpoints);
|
|
39
28
|
this.cache = cache !== null && cache !== void 0 ? cache : new CacheManager();
|
|
40
29
|
}
|
|
41
|
-
/**
|
|
42
|
-
* function to change the lang of requests
|
|
43
|
-
* @param lang request response language
|
|
44
|
-
*/
|
|
45
30
|
setLang(lang) {
|
|
46
31
|
this.currentLang = lang;
|
|
47
32
|
this.requester.setLang(lang);
|
|
@@ -50,7 +35,6 @@ export class Repository extends Loggeable {
|
|
|
50
35
|
return Object.assign(Object.assign({}, segmentation), { token: this.token });
|
|
51
36
|
}
|
|
52
37
|
async fetchAndParseMapStyle(placeId, styleRef, styleTheme) {
|
|
53
|
-
// `baseStyle` caches only the default (no place, no explicit preview ref/theme).
|
|
54
38
|
const cacheable = placeId === undefined && styleRef === undefined && styleTheme === undefined;
|
|
55
39
|
if (cacheable && this.baseStyle) {
|
|
56
40
|
return this.baseStyle;
|
|
@@ -74,12 +58,6 @@ export class Repository extends Loggeable {
|
|
|
74
58
|
throw new Error("Failed to fetch and parse map style", { cause: error });
|
|
75
59
|
}
|
|
76
60
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Bearer-authenticated style fetch: resolves a style by explicit ref/theme for
|
|
79
|
-
* a place through the bearer map style endpoint, authorized by the user's
|
|
80
|
-
* client access instead of the api key's scopes. Mirrors
|
|
81
|
-
* {@link fetchAndParseMapStyle} but with a user bearer token.
|
|
82
|
-
*/
|
|
83
61
|
async fetchAndParseMapStyleByBearer(placeId, authToken, styleRef, styleTheme) {
|
|
84
62
|
try {
|
|
85
63
|
const response = await this.requester.fetchMapStyleByBearer(authToken, placeId, styleRef, styleTheme);
|
|
@@ -192,19 +170,9 @@ export class Repository extends Loggeable {
|
|
|
192
170
|
throw new Error("Failed to fetch and parse place detail with bearer token", { cause: error });
|
|
193
171
|
}
|
|
194
172
|
}
|
|
195
|
-
/**
|
|
196
|
-
* Build the cache key for a place lookup. The canonical `mapvxId` is globally
|
|
197
|
-
* unique, but integrator aliases (`clientId`) may be reused across buildings, so
|
|
198
|
-
* alias-based keys are namespaced by `buildingId` to prevent aliases from
|
|
199
|
-
* different venues from colliding in the cache.
|
|
200
|
-
*/
|
|
201
173
|
placeCacheKey(id, buildingId) {
|
|
202
174
|
return buildingId != null ? `${id}_${buildingId}` : id;
|
|
203
175
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Cache a place under its globally-unique `mapvxId` and, when present, under its
|
|
206
|
-
* (possibly non-unique) `clientId` alias namespaced by `buildingId`.
|
|
207
|
-
*/
|
|
208
176
|
cachePlace(place, buildingId) {
|
|
209
177
|
this.cache.setPlace(place.mapvxId, place, this.currentLang);
|
|
210
178
|
if (place.clientId != null) {
|
|
@@ -213,7 +181,6 @@ export class Repository extends Loggeable {
|
|
|
213
181
|
}
|
|
214
182
|
async fetchAndParseSubPlaces(parentPlaceId) {
|
|
215
183
|
try {
|
|
216
|
-
// Check cache first
|
|
217
184
|
const cachedSubPlaces = this.cache.getSubPlaces(parentPlaceId, this.currentLang);
|
|
218
185
|
if (cachedSubPlaces != null) {
|
|
219
186
|
this.logEvent("fetchAndParseSubPlaces", { cached: "true" });
|
|
@@ -226,7 +193,6 @@ export class Repository extends Loggeable {
|
|
|
226
193
|
}
|
|
227
194
|
const responseData = (await response.json());
|
|
228
195
|
const subPlaces = responseData.map((place) => new MVXPlace(place));
|
|
229
|
-
// Cache the result
|
|
230
196
|
this.cache.setSubPlaces(parentPlaceId, this.currentLang, {
|
|
231
197
|
timestamp: Date.now(),
|
|
232
198
|
data: subPlaces,
|
|
@@ -336,11 +302,6 @@ export class Repository extends Loggeable {
|
|
|
336
302
|
});
|
|
337
303
|
return places;
|
|
338
304
|
}
|
|
339
|
-
/**
|
|
340
|
-
* Get cached subplaces for a parent place without making additional requests.
|
|
341
|
-
* @param parentPlaceId The parent place identifier
|
|
342
|
-
* @returns Array of cached subplaces or undefined if not cached
|
|
343
|
-
*/
|
|
344
305
|
getCachedSubPlaces(parentPlaceId) {
|
|
345
306
|
const cachedSubPlaces = this.cache.getSubPlaces(parentPlaceId, this.currentLang);
|
|
346
307
|
return cachedSubPlaces === null || cachedSubPlaces === void 0 ? void 0 : cachedSubPlaces.data;
|
|
@@ -401,8 +362,6 @@ export class Repository extends Loggeable {
|
|
|
401
362
|
}
|
|
402
363
|
async fetchAndParseLiveRoute(config) {
|
|
403
364
|
try {
|
|
404
|
-
// Live routes are always fetched fresh (no cache read) so a moving user
|
|
405
|
-
// gets an up-to-date path rather than a previously cached one.
|
|
406
365
|
const response = await this.requester.fetchLiveRoute(config, this.token);
|
|
407
366
|
if (!response.ok) {
|
|
408
367
|
const errorBody = await response.json();
|
|
@@ -579,7 +538,6 @@ export class Repository extends Loggeable {
|
|
|
579
538
|
}
|
|
580
539
|
async fetchAndParseConfiguration(placeId, product) {
|
|
581
540
|
try {
|
|
582
|
-
// Check cache first
|
|
583
541
|
const cachedConfig = this.cache.getConfiguration(placeId || "default", product || "default", this.currentLang);
|
|
584
542
|
if (cachedConfig != null) {
|
|
585
543
|
this.logEvent("fetchAndParseConfiguration", { cached: "true" });
|
|
@@ -591,7 +549,6 @@ export class Repository extends Loggeable {
|
|
|
591
549
|
throw new Error(`Fetch failed with status ${response.status}: ${extractErrorMessage(errorBody)}`);
|
|
592
550
|
}
|
|
593
551
|
const config = (await response.json());
|
|
594
|
-
// Cache the result
|
|
595
552
|
this.cache.setConfiguration(placeId || "default", product || "default", this.currentLang, {
|
|
596
553
|
timestamp: Date.now(),
|
|
597
554
|
data: config,
|
|
@@ -604,12 +561,6 @@ export class Repository extends Loggeable {
|
|
|
604
561
|
throw new Error("Failed to fetch and parse configuration", { cause: error });
|
|
605
562
|
}
|
|
606
563
|
}
|
|
607
|
-
/**
|
|
608
|
-
* Fetches the campaigns for a maps-group (totem screensaver playlist). Returns them
|
|
609
|
-
* verbatim — no status/date/schedule filtering, that is the consumer's decision.
|
|
610
|
-
* `placeId` is the maps-group firebase id; `kioskId` optionally narrows to a totem.
|
|
611
|
-
* Not cached (campaigns change; the totem keeps its own short-lived cache).
|
|
612
|
-
*/
|
|
613
564
|
async fetchAndParseCampaigns(placeId, kioskId) {
|
|
614
565
|
try {
|
|
615
566
|
const response = await this.requester.fetchCampaigns(this.token, placeId, kioskId);
|
|
@@ -618,10 +569,6 @@ export class Repository extends Loggeable {
|
|
|
618
569
|
throw new Error(`Fetch failed with status ${response.status}: ${extractErrorMessage(errorBody)}`);
|
|
619
570
|
}
|
|
620
571
|
const raw = (await response.json());
|
|
621
|
-
// A non-array body is a contract break (a `{ campaigns: [...] }` wrapper, an HTML
|
|
622
|
-
// error page served with a 200). Degrading to an empty playlist keeps the totem
|
|
623
|
-
// running, but it must not look like a successful empty fetch — without this
|
|
624
|
-
// warning the screensaver just goes blank with nothing to diagnose.
|
|
625
572
|
if (!Array.isArray(raw)) {
|
|
626
573
|
this.logWarning(new Error("Campaigns response body was not an array"), {
|
|
627
574
|
functionName: "fetchAndParseCampaigns",
|
|
@@ -639,7 +586,6 @@ export class Repository extends Loggeable {
|
|
|
639
586
|
}
|
|
640
587
|
async fetchAndParseCategories(placeId) {
|
|
641
588
|
try {
|
|
642
|
-
// Check cache first
|
|
643
589
|
const cachedCategories = this.cache.getCategories(placeId || "default", this.currentLang);
|
|
644
590
|
if (cachedCategories != null) {
|
|
645
591
|
this.logEvent("fetchAndParseCategories", { cached: "true" });
|
|
@@ -651,7 +597,6 @@ export class Repository extends Loggeable {
|
|
|
651
597
|
throw new Error(`Fetch failed with status ${response.status}: ${extractErrorMessage(errorBody)}`);
|
|
652
598
|
}
|
|
653
599
|
const categories = (await response.json());
|
|
654
|
-
// Cache the result
|
|
655
600
|
this.cache.setCategories(placeId || "default", this.currentLang, {
|
|
656
601
|
timestamp: Date.now(),
|
|
657
602
|
data: categories,
|
|
@@ -687,4 +632,3 @@ export class Repository extends Loggeable {
|
|
|
687
632
|
return data;
|
|
688
633
|
}
|
|
689
634
|
}
|
|
690
|
-
//# sourceMappingURL=repository.js.map
|
|
@@ -246,4 +246,3 @@ export declare class Requester {
|
|
|
246
246
|
fetchCssCustomization(token: string, type: string): Promise<Response>;
|
|
247
247
|
postHealth(token: string, healthPingId: string, placeId: string, totemId: string, status: boolean): Promise<Response>;
|
|
248
248
|
}
|
|
249
|
-
//# sourceMappingURL=requester.d.ts.map
|
|
@@ -1,47 +1,20 @@
|
|
|
1
1
|
import { TransportationMode, } from "../domain/models/routeConfiguration";
|
|
2
2
|
import { isMapVxRequestHostname } from "../utils/mapvxHostname";
|
|
3
|
-
/**
|
|
4
|
-
* Default host for routing, health and legacy transport endpoints. In
|
|
5
|
-
* production this differs from the data-API host (`public-api.mapvx.com`).
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
3
|
const DEFAULT_MAPVX_API_URL = "https://api.mapvx.com";
|
|
9
|
-
/**
|
|
10
|
-
* Ensures a base URL is absolute (prepends `https://` when the protocol is
|
|
11
|
-
* missing) and strips any trailing slash, so path segments concatenate cleanly.
|
|
12
|
-
* @hidden
|
|
13
|
-
*/
|
|
14
4
|
function normalizeBaseUrl(url) {
|
|
15
5
|
const withProtocol = url.startsWith("http://") || url.startsWith("https://") ? url : `https://${url}`;
|
|
16
6
|
return withProtocol.endsWith("/") ? withProtocol.slice(0, -1) : withProtocol;
|
|
17
7
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Represents the requester for the repository.
|
|
20
|
-
* @hidden
|
|
21
|
-
*/
|
|
22
8
|
export class Requester {
|
|
23
9
|
constructor(lang, apiUrl = "https://public-api.mapvx.com", mapvxRequestContext, endpoints) {
|
|
24
10
|
var _a, _b, _c, _d;
|
|
25
11
|
this.lang = lang;
|
|
26
12
|
this.mapvxRequestContext = mapvxRequestContext;
|
|
27
13
|
const cleanApiUrl = normalizeBaseUrl(apiUrl);
|
|
28
|
-
// The `/api/sdk/v2` (api-key) and `/api/portal` (bearer) surfaces can live on
|
|
29
|
-
// different hosts (e.g. split local backends); `endpoints.portalApiUrl` overrides
|
|
30
|
-
// the portal host, defaulting to the sdk host when omitted.
|
|
31
|
-
// `?.trim() ||` for the same reason as the three hosts below: a blank/whitespace
|
|
32
|
-
// override must fall back to `apiUrl`, not build `https:// /api/portal/`.
|
|
33
14
|
const portalOverride = (_a = endpoints === null || endpoints === void 0 ? void 0 : endpoints.portalApiUrl) === null || _a === void 0 ? void 0 : _a.trim();
|
|
34
15
|
const cleanPortalUrl = portalOverride ? normalizeBaseUrl(portalOverride) : cleanApiUrl;
|
|
35
16
|
this.baseUrl = `${cleanApiUrl}/api/sdk/v2/`;
|
|
36
17
|
this.baseUrlPortal = `${cleanPortalUrl}/api/portal/`;
|
|
37
|
-
// Routing, health and legacy-transport endpoints live on a different host
|
|
38
|
-
// than `apiUrl` in production (api.mapvx.com vs public-api.mapvx.com), so
|
|
39
|
-
// they default to that host and can each be overridden independently — an
|
|
40
|
-
// offline totem points them at its local edge server so routes resolve
|
|
41
|
-
// without reaching the public internet.
|
|
42
|
-
// `?.trim() ||`, not `??`: an explicit blank/whitespace override (e.g. from a config object
|
|
43
|
-
// spread over incomplete defaults) must fall back to the default host too, not resolve to a
|
|
44
|
-
// bare-hostname URL like `https://sdk/`.
|
|
45
18
|
const routeBase = normalizeBaseUrl(((_b = endpoints === null || endpoints === void 0 ? void 0 : endpoints.routeApiUrl) === null || _b === void 0 ? void 0 : _b.trim()) || DEFAULT_MAPVX_API_URL);
|
|
46
19
|
const healthBase = normalizeBaseUrl(((_c = endpoints === null || endpoints === void 0 ? void 0 : endpoints.healthApiUrl) === null || _c === void 0 ? void 0 : _c.trim()) || DEFAULT_MAPVX_API_URL);
|
|
47
20
|
const legacyBase = normalizeBaseUrl(((_d = endpoints === null || endpoints === void 0 ? void 0 : endpoints.legacyApiUrl) === null || _d === void 0 ? void 0 : _d.trim()) || DEFAULT_MAPVX_API_URL);
|
|
@@ -49,17 +22,9 @@ export class Requester {
|
|
|
49
22
|
this.oldBaseUrl = `${legacyBase}/api/sdk/`;
|
|
50
23
|
this.routeBaseUrl = `${routeBase}/sdk/`;
|
|
51
24
|
}
|
|
52
|
-
/**
|
|
53
|
-
* function to change the lang of requests
|
|
54
|
-
* @param lang request response language
|
|
55
|
-
*/
|
|
56
25
|
setLang(lang) {
|
|
57
26
|
this.lang = lang;
|
|
58
27
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Build headers for MapVx request context when target is under `*.mapvx.com`.
|
|
61
|
-
* Only non-empty context values are added (X-MapVx-* and mvx-product).
|
|
62
|
-
*/
|
|
63
28
|
getMapVxContextHeaders(requestHost) {
|
|
64
29
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
65
30
|
if (!isMapVxRequestHostname(requestHost) || !this.mapvxRequestContext) {
|
|
@@ -85,17 +50,6 @@ export class Requester {
|
|
|
85
50
|
headers["mvx-product"] = ctx.mvxProduct.trim();
|
|
86
51
|
return headers;
|
|
87
52
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Make a request using {@link fetch}.
|
|
90
|
-
* When the request target hostname matches `*.mapvx.com` and mapvxRequestContext is set,
|
|
91
|
-
* adds X-MapVx-* headers and `mvx-product` when set (baseUrl, totemId, originId, institutionId,
|
|
92
|
-
* parentPlace, institutionName, fullUrl, mvxProduct).
|
|
93
|
-
*
|
|
94
|
-
* @param resourceUrl Path to endpoint
|
|
95
|
-
* @param params should have the token included plus any extra parameter that the url needs
|
|
96
|
-
* @param options option for fetch method
|
|
97
|
-
* @returns Response promise
|
|
98
|
-
*/
|
|
99
53
|
async fetchFromUrl(resourceUrl, params, options) {
|
|
100
54
|
const finalUrl = new URL(resourceUrl);
|
|
101
55
|
finalUrl.search = new URLSearchParams(params).toString();
|
|
@@ -111,12 +65,6 @@ export class Requester {
|
|
|
111
65
|
}
|
|
112
66
|
return fetch(finalUrl.toString(), mergedOptions);
|
|
113
67
|
}
|
|
114
|
-
/**
|
|
115
|
-
*
|
|
116
|
-
* @param token
|
|
117
|
-
* @param stopId
|
|
118
|
-
* @returns
|
|
119
|
-
*/
|
|
120
68
|
async fetchTransport(token, stopId) {
|
|
121
69
|
const options = {
|
|
122
70
|
method: "GET",
|
|
@@ -131,13 +79,6 @@ export class Requester {
|
|
|
131
79
|
};
|
|
132
80
|
return this.fetchFromUrl(this.oldBaseUrl + "vehiclesWithSchedules", params, options);
|
|
133
81
|
}
|
|
134
|
-
/**
|
|
135
|
-
*
|
|
136
|
-
* @param token
|
|
137
|
-
* @param stopId
|
|
138
|
-
* @param vehicleId
|
|
139
|
-
* @returns
|
|
140
|
-
*/
|
|
141
82
|
async fetchStops(token, stopId, vehicleId) {
|
|
142
83
|
const options = {
|
|
143
84
|
method: "GET",
|
|
@@ -153,26 +94,10 @@ export class Requester {
|
|
|
153
94
|
};
|
|
154
95
|
return this.fetchFromUrl(this.oldBaseUrl + "stops", params, options);
|
|
155
96
|
}
|
|
156
|
-
/**
|
|
157
|
-
* Adds the map-style selection params shared by {@link fetchMapStyle} and
|
|
158
|
-
* {@link fetchMapStyleByBearer}.
|
|
159
|
-
*
|
|
160
|
-
* The theme goes under `styleTheme` (camelCase) while the place and style ref go
|
|
161
|
-
* under `place_id` / `style_ref`. The mixed casing is the server's actual contract,
|
|
162
|
-
* not an oversight: `FormInput.styleTheme` predates the snake_case params added
|
|
163
|
-
* alongside `style_ref` (backend-mono `seedwork/infrastructure/validation.ts`).
|
|
164
|
-
* Do not "fix" the casing here — `style_theme` is read by nothing.
|
|
165
|
-
*
|
|
166
|
-
* @param params Query params object to extend in place.
|
|
167
|
-
* @param placeId Optional place whose assigned style should be resolved.
|
|
168
|
-
* @param styleRef Optional explicit style reference, bypassing the place's style.
|
|
169
|
-
* @param styleTheme Optional theme (`"light"` | `"dark"`).
|
|
170
|
-
*/
|
|
171
97
|
applyMapStyleParams(params, placeId, styleRef, styleTheme) {
|
|
172
98
|
if (placeId != null) {
|
|
173
99
|
params.place_id = placeId;
|
|
174
100
|
}
|
|
175
|
-
// Preview an explicit style ref / theme, bypassing the place's assigned style.
|
|
176
101
|
if (styleRef != null) {
|
|
177
102
|
params.style_ref = styleRef;
|
|
178
103
|
}
|
|
@@ -180,12 +105,6 @@ export class Requester {
|
|
|
180
105
|
params.styleTheme = styleTheme;
|
|
181
106
|
}
|
|
182
107
|
}
|
|
183
|
-
/**
|
|
184
|
-
*
|
|
185
|
-
* @param token Client identification
|
|
186
|
-
* @param placeId
|
|
187
|
-
* @returns Response promise
|
|
188
|
-
*/
|
|
189
108
|
async fetchMapStyle(token, placeId, styleRef, styleTheme) {
|
|
190
109
|
const options = {
|
|
191
110
|
method: "GET",
|
|
@@ -200,12 +119,6 @@ export class Requester {
|
|
|
200
119
|
this.applyMapStyleParams(params, placeId, styleRef, styleTheme);
|
|
201
120
|
return this.fetchFromUrl(this.baseUrl + "mapStyleJson", params, options);
|
|
202
121
|
}
|
|
203
|
-
/**
|
|
204
|
-
* Bearer-authenticated variant of {@link fetchMapStyle}: resolves the style JSON
|
|
205
|
-
* using the logged-in user's token, so access is authorized by the user's client
|
|
206
|
-
* permissions rather than the api key's scopes. Same query contract
|
|
207
|
-
* (`place_id`, `style_ref`, `styleTheme`).
|
|
208
|
-
*/
|
|
209
122
|
async fetchMapStyleByBearer(authToken, placeId, styleRef, styleTheme) {
|
|
210
123
|
const options = {
|
|
211
124
|
method: "GET",
|
|
@@ -220,18 +133,6 @@ export class Requester {
|
|
|
220
133
|
this.applyMapStyleParams(params, placeId, styleRef, styleTheme);
|
|
221
134
|
return this.fetchFromUrl(this.baseUrlPortal + "mapStyleJson", params, options);
|
|
222
135
|
}
|
|
223
|
-
/**
|
|
224
|
-
* Fetches the map style configuration for a specified institution.
|
|
225
|
-
* Can be used to obtain any map style from an Institution, without the limitation of the ApiKey.
|
|
226
|
-
* Therefore, does not make use of an ApiKey but rather an authentication token.
|
|
227
|
-
*
|
|
228
|
-
* Sends a GET request to the "mapStyle" endpoint using the provided authentication token
|
|
229
|
-
* and institution ID. The request includes language and institution ID as query parameters.
|
|
230
|
-
*
|
|
231
|
-
* @param token - The Bearer authentication token to authorize the request.
|
|
232
|
-
* @param institutionId - The unique identifier of the institution whose map style is being requested.
|
|
233
|
-
* @returns A promise that resolves to the HTTP response containing the map style data.
|
|
234
|
-
*/
|
|
235
136
|
async fetchAnyMapStyle(authToken, institutionId) {
|
|
236
137
|
const options = {
|
|
237
138
|
method: "GET",
|
|
@@ -246,11 +147,6 @@ export class Requester {
|
|
|
246
147
|
};
|
|
247
148
|
return this.fetchFromUrl(this.baseUrlPortal + "mapStyle", params, options);
|
|
248
149
|
}
|
|
249
|
-
/**
|
|
250
|
-
* Obtain allowed Places associated with the key
|
|
251
|
-
* @param token
|
|
252
|
-
* @returns Response promise
|
|
253
|
-
*/
|
|
254
150
|
async fetchAllowedPlaces(token) {
|
|
255
151
|
const options = {
|
|
256
152
|
method: "GET",
|
|
@@ -264,16 +160,6 @@ export class Requester {
|
|
|
264
160
|
};
|
|
265
161
|
return this.fetchFromUrl(this.baseUrl + "availablePlaces", params, options);
|
|
266
162
|
}
|
|
267
|
-
/**
|
|
268
|
-
* Fetches the available places for a given institution using the provided authentication token.
|
|
269
|
-
* Does not make use of an ApiKey but rather an authentication token, therefore it is not limited by the allowed ApiKey places.
|
|
270
|
-
*
|
|
271
|
-
* Sends a GET request to the `availablePlaces` endpoint with the institution ID and language as parameters.
|
|
272
|
-
*
|
|
273
|
-
* @param authToken - The authentication token used for authorization in the request header.
|
|
274
|
-
* @param institutionId - The unique identifier of the institution whose places are to be fetched.
|
|
275
|
-
* @returns A promise that resolves to the response from the API.
|
|
276
|
-
*/
|
|
277
163
|
async fetchPlacesFromAnyInstitution(institutionId, authToken) {
|
|
278
164
|
const options = {
|
|
279
165
|
method: "GET",
|
|
@@ -288,19 +174,6 @@ export class Requester {
|
|
|
288
174
|
};
|
|
289
175
|
return this.fetchFromUrl(this.baseUrlPortal + "availablePlaces", params, options);
|
|
290
176
|
}
|
|
291
|
-
/**
|
|
292
|
-
* Obtain info about specific place. Use mainly to obtain innerFloors.
|
|
293
|
-
*
|
|
294
|
-
* When `placeId` is an internal alias that may be reused across buildings, pass
|
|
295
|
-
* `buildingId` (and optionally `floorId`/`level`) to disambiguate which venue the
|
|
296
|
-
* alias refers to. `floorId` takes precedence over the numeric `level`.
|
|
297
|
-
* @param token
|
|
298
|
-
* @param placeId
|
|
299
|
-
* @param buildingId (Optional) Parent building/venue that contains the place.
|
|
300
|
-
* @param floorId (Optional) Floor ID within the building.
|
|
301
|
-
* @param level (Optional) Numeric floor level; used only when `floorId` is absent.
|
|
302
|
-
* @returns
|
|
303
|
-
*/
|
|
304
177
|
async fetchPlaceDetail(token, placeId, buildingId, floorId, level) {
|
|
305
178
|
const options = {
|
|
306
179
|
method: "GET",
|
|
@@ -324,23 +197,6 @@ export class Requester {
|
|
|
324
197
|
}
|
|
325
198
|
return this.fetchFromUrl(this.baseUrl + "place", params, options);
|
|
326
199
|
}
|
|
327
|
-
/**
|
|
328
|
-
* Fetches detailed information for a specific place using its unique identifier.
|
|
329
|
-
* Can be used to obtain any place detail, without the limitation of the ApiKey.
|
|
330
|
-
* Therefore, does not make use of an ApiKey but rather an authentication token.
|
|
331
|
-
*
|
|
332
|
-
* When `placeId` is an internal alias that may be reused across buildings, pass
|
|
333
|
-
* `buildingId` (and optionally `floorId`/`level`) to disambiguate which venue the
|
|
334
|
-
* alias refers to. `floorId` takes precedence over the numeric `level`.
|
|
335
|
-
*
|
|
336
|
-
* @param authToken - The authentication token used for authorization in the request header.
|
|
337
|
-
* @param placeId - The unique identifier of the place to retrieve details for.
|
|
338
|
-
* @param buildingId - (Optional) Parent building/venue that contains the place.
|
|
339
|
-
* @param floorId - (Optional) Floor ID within the building.
|
|
340
|
-
* @param level - (Optional) Numeric floor level; used only when `floorId` is absent.
|
|
341
|
-
* @returns A promise that resolves to the HTTP response containing the place details.
|
|
342
|
-
*
|
|
343
|
-
*/
|
|
344
200
|
async fetchAnyPlaceDetail(authToken, placeId, buildingId, floorId, level) {
|
|
345
201
|
const options = {
|
|
346
202
|
method: "GET",
|
|
@@ -364,12 +220,6 @@ export class Requester {
|
|
|
364
220
|
}
|
|
365
221
|
return this.fetchFromUrl(this.baseUrlPortal + "place", params, options);
|
|
366
222
|
}
|
|
367
|
-
/**
|
|
368
|
-
* To obtain all places associated with targetPlace
|
|
369
|
-
* @param targetPlaceId
|
|
370
|
-
* @param token
|
|
371
|
-
* @returns
|
|
372
|
-
*/
|
|
373
223
|
async fetchSubPlaces(targetPlaceId, token) {
|
|
374
224
|
const options = {
|
|
375
225
|
method: "GET",
|
|
@@ -384,18 +234,6 @@ export class Requester {
|
|
|
384
234
|
};
|
|
385
235
|
return this.fetchFromUrl(this.baseUrl + "subPlaces", params, options);
|
|
386
236
|
}
|
|
387
|
-
/**
|
|
388
|
-
* Fetches sub-places for any specified target place using the Portal API.
|
|
389
|
-
* Can be used to obtain the sub-places for any target place, without the limitation of the ApiKey.
|
|
390
|
-
* Therefore, does not make use of an ApiKey but rather an authentication token.
|
|
391
|
-
*
|
|
392
|
-
* Sends a GET request to the "subPlaces" endpoint with the provided Bearer authentication token
|
|
393
|
-
* and target place ID. The request includes language and target place ID as query parameters.
|
|
394
|
-
*
|
|
395
|
-
* @param targetPlaceId - The unique identifier of the target place whose sub-places are being requested.
|
|
396
|
-
* @param authToken - The Bearer authentication token to authorize the request.
|
|
397
|
-
* @returns A promise that resolves to the HTTP response containing the sub-places data.
|
|
398
|
-
*/
|
|
399
237
|
async fetchAnySubPlaces(targetPlaceId, authToken) {
|
|
400
238
|
const options = {
|
|
401
239
|
method: "GET",
|
|
@@ -410,17 +248,6 @@ export class Requester {
|
|
|
410
248
|
};
|
|
411
249
|
return this.fetchFromUrl(this.baseUrlPortal + "subPlaces", params, options);
|
|
412
250
|
}
|
|
413
|
-
/**
|
|
414
|
-
* Build the cleaned query parameters for a route request.
|
|
415
|
-
*
|
|
416
|
-
* Resolves both the origin (`from*`) and destination (`to*`) sides of the route
|
|
417
|
-
* from the provided configuration. For {@link IdLocation} endpoints this also
|
|
418
|
-
* forwards the building (`fromBuilding`/`toBuilding`) and floor
|
|
419
|
-
* (`fromFloor`/`toFloor`) so internal aliases that are reused across buildings
|
|
420
|
-
* can be disambiguated. Parameters that resolve to `null`/`undefined` are dropped.
|
|
421
|
-
* @param routeConfig The route configuration to translate into query params.
|
|
422
|
-
* @returns The cleaned query parameters ready to be appended to the request URL.
|
|
423
|
-
*/
|
|
424
251
|
buildRouteParams(routeConfig) {
|
|
425
252
|
const params = {
|
|
426
253
|
fromLatLng: undefined,
|
|
@@ -485,11 +312,6 @@ export class Requester {
|
|
|
485
312
|
}
|
|
486
313
|
return cleanParams;
|
|
487
314
|
}
|
|
488
|
-
/**
|
|
489
|
-
* To obtain the route
|
|
490
|
-
* @param routeConfig
|
|
491
|
-
* @returns
|
|
492
|
-
*/
|
|
493
315
|
async fetchRoute(routeConfig, token) {
|
|
494
316
|
const options = {
|
|
495
317
|
method: "GET",
|
|
@@ -501,11 +323,6 @@ export class Requester {
|
|
|
501
323
|
const cleanParams = this.buildRouteParams(routeConfig);
|
|
502
324
|
return this.fetchFromUrl(this.routeBaseUrl + "route", cleanParams, options);
|
|
503
325
|
}
|
|
504
|
-
/**
|
|
505
|
-
* To obtain the route
|
|
506
|
-
* @param routeConfig
|
|
507
|
-
* @returns
|
|
508
|
-
*/
|
|
509
326
|
async fetchRouteV2(routeConfig, token) {
|
|
510
327
|
const options = {
|
|
511
328
|
method: "GET",
|
|
@@ -517,11 +334,6 @@ export class Requester {
|
|
|
517
334
|
const cleanParams = this.buildRouteParams(routeConfig);
|
|
518
335
|
return this.fetchFromUrl(this.routeBaseUrl + "v2/route", cleanParams, options);
|
|
519
336
|
}
|
|
520
|
-
/**
|
|
521
|
-
* To obtain the route from the live routing endpoint (`/sdk/liveroute`).
|
|
522
|
-
* @param routeConfig
|
|
523
|
-
* @returns
|
|
524
|
-
*/
|
|
525
337
|
async fetchLiveRoute(routeConfig, token) {
|
|
526
338
|
const options = {
|
|
527
339
|
method: "GET",
|
|
@@ -533,13 +345,6 @@ export class Requester {
|
|
|
533
345
|
const cleanParams = this.buildRouteParams(routeConfig);
|
|
534
346
|
return this.fetchFromUrl(this.routeBaseUrl + "liveroute", cleanParams, options);
|
|
535
347
|
}
|
|
536
|
-
/**
|
|
537
|
-
* To obtain info associated to an Institution based on id provided
|
|
538
|
-
* It return 403 if the institution id
|
|
539
|
-
* @param targetPlaceId
|
|
540
|
-
* @param token
|
|
541
|
-
* @returns
|
|
542
|
-
*/
|
|
543
348
|
async fetchInstitutions(token) {
|
|
544
349
|
const options = {
|
|
545
350
|
method: "GET",
|
|
@@ -553,18 +358,6 @@ export class Requester {
|
|
|
553
358
|
};
|
|
554
359
|
return this.fetchFromUrl(this.baseUrl + "institution", params, options);
|
|
555
360
|
}
|
|
556
|
-
/**
|
|
557
|
-
* To obtain places from an institution whose name is similar to provided input
|
|
558
|
-
* @param institutionId
|
|
559
|
-
* @param input Provided value to look for
|
|
560
|
-
* @param token Client identification
|
|
561
|
-
* @param parentIds Identifier of the parent place
|
|
562
|
-
* @param origin The ID of a totem or a place origin from directories. Used to return search results based on distance from the origin.
|
|
563
|
-
* @param lat Latitude as a string for location-based search.
|
|
564
|
-
* @param lng Longitude as a string for location-based search.
|
|
565
|
-
* @param floor Floor ID as a string for location-based search.
|
|
566
|
-
* @returns Response promise
|
|
567
|
-
*/
|
|
568
361
|
async fetchSearchResults(institutionId, input, token, parentIds, origin, lat, lng, floor) {
|
|
569
362
|
const options = {
|
|
570
363
|
method: "GET",
|
|
@@ -595,27 +388,7 @@ export class Requester {
|
|
|
595
388
|
}
|
|
596
389
|
return this.fetchFromUrl(this.baseUrl + "searchPlacesWithFilters", params, options);
|
|
597
390
|
}
|
|
598
|
-
/**
|
|
599
|
-
* Search places by one or more tags via the v2 endpoint `/api/sdk/v2/searchPlacesByTags`.
|
|
600
|
-
*
|
|
601
|
-
* Multiple tags are sent as a repeated/joined `tags` query parameter; the API
|
|
602
|
-
* accepts both `?tags=a&tags=b` and `?tags=a,b` forms.
|
|
603
|
-
*
|
|
604
|
-
* @param institutionId Institution to search within.
|
|
605
|
-
* @param tags Tags to match against. Must contain at least one entry.
|
|
606
|
-
* @param token Client API token.
|
|
607
|
-
* @param parentPlaces Optional list of parent place ids used to scope the search.
|
|
608
|
-
* @param sort Result ordering: `match` (Elastic scoring, default), `alphabetical`,
|
|
609
|
-
* or `distance` (requires `origin` or `lat`+`lng`+`floor`+`parentPlaces`).
|
|
610
|
-
* @param origin Place id of an origin (e.g. a totem) used as the distance reference.
|
|
611
|
-
* @param lat Latitude as string for distance-based ordering.
|
|
612
|
-
* @param lng Longitude as string for distance-based ordering.
|
|
613
|
-
* @param floor Floor id as string for distance-based ordering.
|
|
614
|
-
* @returns Response promise.
|
|
615
|
-
*/
|
|
616
391
|
async fetchSearchPlacesByTags(institutionId, tags, token, parentPlaces, sort, origin, lat, lng, floor) {
|
|
617
|
-
// The v2 endpoints authenticate via the Authorization header (Bearer),
|
|
618
|
-
// not via a `token` query parameter like the legacy /api/sdk/* routes.
|
|
619
392
|
const options = {
|
|
620
393
|
method: "GET",
|
|
621
394
|
headers: {
|
|
@@ -665,11 +438,6 @@ export class Requester {
|
|
|
665
438
|
params.product = product;
|
|
666
439
|
return this.fetchFromUrl(this.baseUrl + "configuration", params, options);
|
|
667
440
|
}
|
|
668
|
-
/**
|
|
669
|
-
* Fetches the campaigns configured for a maps-group (totem screensaver playlist).
|
|
670
|
-
* `place_id` is the maps-group firebase id; `kiosk_id` optionally narrows to a
|
|
671
|
-
* single totem. Uses the api-key (`/api/sdk/v2/`) surface.
|
|
672
|
-
*/
|
|
673
441
|
async fetchCampaigns(token, place_id, kiosk_id) {
|
|
674
442
|
const options = {
|
|
675
443
|
method: "GET",
|
|
@@ -764,4 +532,3 @@ export class Requester {
|
|
|
764
532
|
return this.fetchFromUrl(this.baseUrlHealth, params, options);
|
|
765
533
|
}
|
|
766
534
|
}
|
|
767
|
-
//# sourceMappingURL=requester.js.map
|
package/dist/es/sdk.d.ts
CHANGED