@mapvx/web-js 3.5.1 → 4.0.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/cjs/index.js +2 -95
- package/dist/cjs/index.js.LICENSE.txt +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/controllers/routeController.d.ts.map +1 -1
- package/dist/es/controllers/routeController.js +25 -8
- package/dist/es/controllers/routeController.js.map +1 -1
- package/dist/es/logger/sentry.js +1 -1
- package/dist/es/map/fitCamera.d.ts +7 -5
- package/dist/es/map/fitCamera.d.ts.map +1 -1
- package/dist/es/map/fitCamera.js +1 -1
- package/dist/es/map/fitCamera.js.map +1 -1
- package/dist/es/map/liveMapFitTransform.d.ts +104 -0
- package/dist/es/map/liveMapFitTransform.d.ts.map +1 -0
- package/dist/es/map/liveMapFitTransform.js +185 -0
- package/dist/es/map/liveMapFitTransform.js.map +1 -0
- package/dist/es/map/map.d.ts.map +1 -1
- package/dist/es/map/map.js +15 -7
- package/dist/es/map/map.js.map +1 -1
- package/dist/umd/index.js +1133 -117
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/styles.css +1 -1
- package/dist/umd/styles.css.map +1 -1
- package/package.json +7 -7
- package/dist/cjs/assets/icons.js +0 -85
- package/dist/cjs/assets/icons.js.map +0 -1
- package/dist/cjs/config/draco.js +0 -15
- package/dist/cjs/config/draco.js.map +0 -1
- package/dist/cjs/config/sdkConfig.js +0 -3
- package/dist/cjs/config/sdkConfig.js.map +0 -1
- package/dist/cjs/controllers/markerLayoutController.js +0 -359
- package/dist/cjs/controllers/markerLayoutController.js.map +0 -1
- package/dist/cjs/controllers/routeController.js +0 -1549
- package/dist/cjs/controllers/routeController.js.map +0 -1
- package/dist/cjs/domain/models/_internal.js +0 -14
- package/dist/cjs/domain/models/_internal.js.map +0 -1
- package/dist/cjs/domain/models/_rtl.js +0 -10
- package/dist/cjs/domain/models/_rtl.js.map +0 -1
- package/dist/cjs/domain/models/animation.js +0 -64
- package/dist/cjs/domain/models/animation.js.map +0 -1
- package/dist/cjs/domain/models/banner.js +0 -24
- package/dist/cjs/domain/models/banner.js.map +0 -1
- package/dist/cjs/domain/models/campaign.js +0 -73
- package/dist/cjs/domain/models/campaign.js.map +0 -1
- package/dist/cjs/domain/models/categories.js +0 -37
- package/dist/cjs/domain/models/categories.js.map +0 -1
- package/dist/cjs/domain/models/circle.js +0 -253
- package/dist/cjs/domain/models/circle.js.map +0 -1
- package/dist/cjs/domain/models/cityFilterOption.js +0 -3
- package/dist/cjs/domain/models/cityFilterOption.js.map +0 -1
- package/dist/cjs/domain/models/configuration.js +0 -3
- package/dist/cjs/domain/models/configuration.js.map +0 -1
- package/dist/cjs/domain/models/cssCustomization.js +0 -3
- package/dist/cjs/domain/models/cssCustomization.js.map +0 -1
- package/dist/cjs/domain/models/fitOptions.js +0 -3
- package/dist/cjs/domain/models/fitOptions.js.map +0 -1
- package/dist/cjs/domain/models/innerFloors.js +0 -3
- package/dist/cjs/domain/models/innerFloors.js.map +0 -1
- package/dist/cjs/domain/models/institution.js +0 -45
- package/dist/cjs/domain/models/institution.js.map +0 -1
- package/dist/cjs/domain/models/latLng.js +0 -3
- package/dist/cjs/domain/models/latLng.js.map +0 -1
- package/dist/cjs/domain/models/location.js +0 -3
- package/dist/cjs/domain/models/location.js.map +0 -1
- package/dist/cjs/domain/models/loggeable.js +0 -52
- package/dist/cjs/domain/models/loggeable.js.map +0 -1
- package/dist/cjs/domain/models/mapCamera.js +0 -3
- package/dist/cjs/domain/models/mapCamera.js.map +0 -1
- package/dist/cjs/domain/models/mapConfig.js +0 -37
- package/dist/cjs/domain/models/mapConfig.js.map +0 -1
- package/dist/cjs/domain/models/marker.js +0 -502
- package/dist/cjs/domain/models/marker.js.map +0 -1
- package/dist/cjs/domain/models/multilanguage.js +0 -17
- package/dist/cjs/domain/models/multilanguage.js.map +0 -1
- package/dist/cjs/domain/models/openingHours.js +0 -3
- package/dist/cjs/domain/models/openingHours.js.map +0 -1
- package/dist/cjs/domain/models/place.js +0 -127
- package/dist/cjs/domain/models/place.js.map +0 -1
- package/dist/cjs/domain/models/platform.js +0 -3
- package/dist/cjs/domain/models/platform.js.map +0 -1
- package/dist/cjs/domain/models/popover.js +0 -3
- package/dist/cjs/domain/models/popover.js.map +0 -1
- package/dist/cjs/domain/models/product.js +0 -3
- package/dist/cjs/domain/models/product.js.map +0 -1
- package/dist/cjs/domain/models/property.js +0 -104
- package/dist/cjs/domain/models/property.js.map +0 -1
- package/dist/cjs/domain/models/route.js +0 -166
- package/dist/cjs/domain/models/route.js.map +0 -1
- package/dist/cjs/domain/models/routeConfiguration.js +0 -82
- package/dist/cjs/domain/models/routeConfiguration.js.map +0 -1
- package/dist/cjs/domain/models/routeInstance.js +0 -30
- package/dist/cjs/domain/models/routeInstance.js.map +0 -1
- package/dist/cjs/domain/models/routeStyle.js +0 -3
- package/dist/cjs/domain/models/routeStyle.js.map +0 -1
- package/dist/cjs/domain/models/scene3D.js +0 -3
- package/dist/cjs/domain/models/scene3D.js.map +0 -1
- package/dist/cjs/domain/models/transport.js +0 -22
- package/dist/cjs/domain/models/transport.js.map +0 -1
- package/dist/cjs/domain/ports/ICache.js +0 -3
- package/dist/cjs/domain/ports/ICache.js.map +0 -1
- package/dist/cjs/domain/ports/IHttpClient.js +0 -3
- package/dist/cjs/domain/ports/IHttpClient.js.map +0 -1
- package/dist/cjs/domain/ports/ILogger.js +0 -23
- package/dist/cjs/domain/ports/ILogger.js.map +0 -1
- package/dist/cjs/domain/ports/index.js +0 -10
- package/dist/cjs/domain/ports/index.js.map +0 -1
- package/dist/cjs/infrastructure/cache/CacheManager.js +0 -258
- package/dist/cjs/infrastructure/cache/CacheManager.js.map +0 -1
- package/dist/cjs/infrastructure/cache/LRUCache.js +0 -153
- package/dist/cjs/infrastructure/cache/LRUCache.js.map +0 -1
- package/dist/cjs/infrastructure/cache/PersistentCache.js +0 -168
- package/dist/cjs/infrastructure/cache/PersistentCache.js.map +0 -1
- package/dist/cjs/infrastructure/cache/cacheConfig.js +0 -70
- package/dist/cjs/infrastructure/cache/cacheConfig.js.map +0 -1
- package/dist/cjs/infrastructure/http/FetchHttpClient.js +0 -75
- package/dist/cjs/infrastructure/http/FetchHttpClient.js.map +0 -1
- package/dist/cjs/infrastructure/logging/MVXLogger.js +0 -80
- package/dist/cjs/infrastructure/logging/MVXLogger.js.map +0 -1
- package/dist/cjs/interfaces/cache.js +0 -3
- package/dist/cjs/interfaces/cache.js.map +0 -1
- package/dist/cjs/interfaces/healthResponse.js +0 -3
- package/dist/cjs/interfaces/healthResponse.js.map +0 -1
- package/dist/cjs/interfaces/institutionResponse.js +0 -3
- package/dist/cjs/interfaces/institutionResponse.js.map +0 -1
- package/dist/cjs/interfaces/metadata.js +0 -3
- package/dist/cjs/interfaces/metadata.js.map +0 -1
- package/dist/cjs/interfaces/placeResponse.js +0 -3
- package/dist/cjs/interfaces/placeResponse.js.map +0 -1
- package/dist/cjs/interfaces/routeCacheResponse.js +0 -3
- package/dist/cjs/interfaces/routeCacheResponse.js.map +0 -1
- package/dist/cjs/interfaces/routeResponse.js +0 -3
- package/dist/cjs/interfaces/routeResponse.js.map +0 -1
- package/dist/cjs/interfaces/styleResponse.js +0 -3
- package/dist/cjs/interfaces/styleResponse.js.map +0 -1
- package/dist/cjs/logger/logger.js +0 -78
- package/dist/cjs/logger/logger.js.map +0 -1
- package/dist/cjs/logger/sentry.js +0 -81
- package/dist/cjs/logger/sentry.js.map +0 -1
- package/dist/cjs/map/fitCamera.js +0 -124
- package/dist/cjs/map/fitCamera.js.map +0 -1
- package/dist/cjs/map/map.js +0 -2755
- package/dist/cjs/map/map.js.map +0 -1
- package/dist/cjs/map/mapInteractionOptions.js +0 -73
- package/dist/cjs/map/mapInteractionOptions.js.map +0 -1
- package/dist/cjs/map/scene3DController.js +0 -849
- package/dist/cjs/map/scene3DController.js.map +0 -1
- package/dist/cjs/repository/repository.js +0 -694
- package/dist/cjs/repository/repository.js.map +0 -1
- package/dist/cjs/repository/requester.js +0 -771
- package/dist/cjs/repository/requester.js.map +0 -1
- package/dist/cjs/sdk.js +0 -438
- package/dist/cjs/sdk.js.map +0 -1
- package/dist/cjs/utils/3d.js +0 -245
- package/dist/cjs/utils/3d.js.map +0 -1
- package/dist/cjs/utils/deckLayers.js +0 -153
- package/dist/cjs/utils/deckLayers.js.map +0 -1
- package/dist/cjs/utils/error.js +0 -19
- package/dist/cjs/utils/error.js.map +0 -1
- package/dist/cjs/utils/images.js +0 -25
- package/dist/cjs/utils/images.js.map +0 -1
- package/dist/cjs/utils/loadGlb.js +0 -190
- package/dist/cjs/utils/loadGlb.js.map +0 -1
- package/dist/cjs/utils/mapvxHostname.js +0 -21
- package/dist/cjs/utils/mapvxHostname.js.map +0 -1
- package/dist/cjs/utils/nav-functions.js +0 -150
- package/dist/cjs/utils/nav-functions.js.map +0 -1
- package/dist/cjs/utils/opening-hours-helper.js +0 -914
- package/dist/cjs/utils/opening-hours-helper.js.map +0 -1
- package/dist/cjs/utils/preconnect.js +0 -131
- package/dist/cjs/utils/preconnect.js.map +0 -1
- package/dist/cjs/utils/route-utils.js +0 -57
- package/dist/cjs/utils/route-utils.js.map +0 -1
- package/dist/cjs/utils/semaphore.js +0 -143
- package/dist/cjs/utils/semaphore.js.map +0 -1
- package/dist/cjs/utils/three.js +0 -113
- package/dist/cjs/utils/three.js.map +0 -1
- package/dist/cjs/utils/threeScene.js +0 -126
- package/dist/cjs/utils/threeScene.js.map +0 -1
- package/dist/cjs/utils/update-css.js +0 -76
- package/dist/cjs/utils/update-css.js.map +0 -1
- package/dist/cjs/utils/utils.js +0 -104
- package/dist/cjs/utils/utils.js.map +0 -1
|
@@ -1,771 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Requester = void 0;
|
|
4
|
-
const routeConfiguration_1 = require("../domain/models/routeConfiguration");
|
|
5
|
-
const mapvxHostname_1 = require("../utils/mapvxHostname");
|
|
6
|
-
/**
|
|
7
|
-
* Default host for routing, health and legacy transport endpoints. In
|
|
8
|
-
* production this differs from the data-API host (`public-api.mapvx.com`).
|
|
9
|
-
* @hidden
|
|
10
|
-
*/
|
|
11
|
-
const DEFAULT_MAPVX_API_URL = "https://api.mapvx.com";
|
|
12
|
-
/**
|
|
13
|
-
* Ensures a base URL is absolute (prepends `https://` when the protocol is
|
|
14
|
-
* missing) and strips any trailing slash, so path segments concatenate cleanly.
|
|
15
|
-
* @hidden
|
|
16
|
-
*/
|
|
17
|
-
function normalizeBaseUrl(url) {
|
|
18
|
-
const withProtocol = url.startsWith("http://") || url.startsWith("https://") ? url : `https://${url}`;
|
|
19
|
-
return withProtocol.endsWith("/") ? withProtocol.slice(0, -1) : withProtocol;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Represents the requester for the repository.
|
|
23
|
-
* @hidden
|
|
24
|
-
*/
|
|
25
|
-
class Requester {
|
|
26
|
-
constructor(lang, apiUrl = "https://public-api.mapvx.com", mapvxRequestContext, endpoints) {
|
|
27
|
-
var _a, _b, _c, _d;
|
|
28
|
-
this.lang = lang;
|
|
29
|
-
this.mapvxRequestContext = mapvxRequestContext;
|
|
30
|
-
const cleanApiUrl = normalizeBaseUrl(apiUrl);
|
|
31
|
-
// The `/api/sdk/v2` (api-key) and `/api/portal` (bearer) surfaces can live on
|
|
32
|
-
// different hosts (e.g. split local backends); `endpoints.portalApiUrl` overrides
|
|
33
|
-
// the portal host, defaulting to the sdk host when omitted.
|
|
34
|
-
// `?.trim() ||` for the same reason as the three hosts below: a blank/whitespace
|
|
35
|
-
// override must fall back to `apiUrl`, not build `https:// /api/portal/`.
|
|
36
|
-
const portalOverride = (_a = endpoints === null || endpoints === void 0 ? void 0 : endpoints.portalApiUrl) === null || _a === void 0 ? void 0 : _a.trim();
|
|
37
|
-
const cleanPortalUrl = portalOverride ? normalizeBaseUrl(portalOverride) : cleanApiUrl;
|
|
38
|
-
this.baseUrl = `${cleanApiUrl}/api/sdk/v2/`;
|
|
39
|
-
this.baseUrlPortal = `${cleanPortalUrl}/api/portal/`;
|
|
40
|
-
// Routing, health and legacy-transport endpoints live on a different host
|
|
41
|
-
// than `apiUrl` in production (api.mapvx.com vs public-api.mapvx.com), so
|
|
42
|
-
// they default to that host and can each be overridden independently — an
|
|
43
|
-
// offline totem points them at its local edge server so routes resolve
|
|
44
|
-
// without reaching the public internet.
|
|
45
|
-
// `?.trim() ||`, not `??`: an explicit blank/whitespace override (e.g. from a config object
|
|
46
|
-
// spread over incomplete defaults) must fall back to the default host too, not resolve to a
|
|
47
|
-
// bare-hostname URL like `https://sdk/`.
|
|
48
|
-
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);
|
|
49
|
-
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);
|
|
50
|
-
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);
|
|
51
|
-
this.baseUrlHealth = `${healthBase}/api/sdk/v2/health`;
|
|
52
|
-
this.oldBaseUrl = `${legacyBase}/api/sdk/`;
|
|
53
|
-
this.routeBaseUrl = `${routeBase}/sdk/`;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* function to change the lang of requests
|
|
57
|
-
* @param lang request response language
|
|
58
|
-
*/
|
|
59
|
-
setLang(lang) {
|
|
60
|
-
this.lang = lang;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Build headers for MapVx request context when target is under `*.mapvx.com`.
|
|
64
|
-
* Only non-empty context values are added (X-MapVx-* and mvx-product).
|
|
65
|
-
*/
|
|
66
|
-
getMapVxContextHeaders(requestHost) {
|
|
67
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
68
|
-
if (!(0, mapvxHostname_1.isMapVxRequestHostname)(requestHost) || !this.mapvxRequestContext) {
|
|
69
|
-
return {};
|
|
70
|
-
}
|
|
71
|
-
const ctx = this.mapvxRequestContext;
|
|
72
|
-
const headers = {};
|
|
73
|
-
if ((_a = ctx.baseUrl) === null || _a === void 0 ? void 0 : _a.trim())
|
|
74
|
-
headers["X-MapVx-Base-Url"] = ctx.baseUrl.trim();
|
|
75
|
-
if ((_b = ctx.totemId) === null || _b === void 0 ? void 0 : _b.trim())
|
|
76
|
-
headers["X-MapVx-Totem-Id"] = ctx.totemId.trim();
|
|
77
|
-
if ((_c = ctx.originId) === null || _c === void 0 ? void 0 : _c.trim())
|
|
78
|
-
headers["X-MapVx-Origin-Id"] = ctx.originId.trim();
|
|
79
|
-
if ((_d = ctx.institutionId) === null || _d === void 0 ? void 0 : _d.trim())
|
|
80
|
-
headers["X-MapVx-Institution-Id"] = ctx.institutionId.trim();
|
|
81
|
-
if ((_e = ctx.parentPlace) === null || _e === void 0 ? void 0 : _e.trim())
|
|
82
|
-
headers["X-MapVx-Parent-Place"] = ctx.parentPlace.trim();
|
|
83
|
-
if ((_f = ctx.institutionName) === null || _f === void 0 ? void 0 : _f.trim())
|
|
84
|
-
headers["X-MapVx-Institution-Name"] = ctx.institutionName.trim();
|
|
85
|
-
if ((_g = ctx.fullUrl) === null || _g === void 0 ? void 0 : _g.trim())
|
|
86
|
-
headers["X-MapVx-Full-Url"] = ctx.fullUrl.trim();
|
|
87
|
-
if ((_h = ctx.mvxProduct) === null || _h === void 0 ? void 0 : _h.trim())
|
|
88
|
-
headers["mvx-product"] = ctx.mvxProduct.trim();
|
|
89
|
-
return headers;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Make a request using {@link fetch}.
|
|
93
|
-
* When the request target hostname matches `*.mapvx.com` and mapvxRequestContext is set,
|
|
94
|
-
* adds X-MapVx-* headers and `mvx-product` when set (baseUrl, totemId, originId, institutionId,
|
|
95
|
-
* parentPlace, institutionName, fullUrl, mvxProduct).
|
|
96
|
-
*
|
|
97
|
-
* @param resourceUrl Path to endpoint
|
|
98
|
-
* @param params should have the token included plus any extra parameter that the url needs
|
|
99
|
-
* @param options option for fetch method
|
|
100
|
-
* @returns Response promise
|
|
101
|
-
*/
|
|
102
|
-
async fetchFromUrl(resourceUrl, params, options) {
|
|
103
|
-
const finalUrl = new URL(resourceUrl);
|
|
104
|
-
finalUrl.search = new URLSearchParams(params).toString();
|
|
105
|
-
const requestHost = finalUrl.hostname;
|
|
106
|
-
const contextHeaders = this.getMapVxContextHeaders(requestHost);
|
|
107
|
-
const mergedOptions = Object.assign({}, options);
|
|
108
|
-
if (Object.keys(contextHeaders).length > 0) {
|
|
109
|
-
mergedOptions.headers = Object.assign(Object.assign({}, (options.headers &&
|
|
110
|
-
typeof options.headers === "object" &&
|
|
111
|
-
!Array.isArray(options.headers)
|
|
112
|
-
? options.headers
|
|
113
|
-
: {})), contextHeaders);
|
|
114
|
-
}
|
|
115
|
-
return fetch(finalUrl.toString(), mergedOptions);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
*
|
|
119
|
-
* @param token
|
|
120
|
-
* @param stopId
|
|
121
|
-
* @returns
|
|
122
|
-
*/
|
|
123
|
-
async fetchTransport(token, stopId) {
|
|
124
|
-
const options = {
|
|
125
|
-
method: "GET",
|
|
126
|
-
headers: {
|
|
127
|
-
"content-type": "application/json",
|
|
128
|
-
Authorization: `Bearer ${token}`,
|
|
129
|
-
},
|
|
130
|
-
};
|
|
131
|
-
const params = {
|
|
132
|
-
stopId,
|
|
133
|
-
lang: this.lang,
|
|
134
|
-
};
|
|
135
|
-
return this.fetchFromUrl(this.oldBaseUrl + "vehiclesWithSchedules", params, options);
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
*
|
|
139
|
-
* @param token
|
|
140
|
-
* @param stopId
|
|
141
|
-
* @param vehicleId
|
|
142
|
-
* @returns
|
|
143
|
-
*/
|
|
144
|
-
async fetchStops(token, stopId, vehicleId) {
|
|
145
|
-
const options = {
|
|
146
|
-
method: "GET",
|
|
147
|
-
headers: {
|
|
148
|
-
"content-type": "application/json",
|
|
149
|
-
Authorization: `Bearer ${token}`,
|
|
150
|
-
},
|
|
151
|
-
};
|
|
152
|
-
const params = {
|
|
153
|
-
stopId,
|
|
154
|
-
vehicleId,
|
|
155
|
-
lang: this.lang,
|
|
156
|
-
};
|
|
157
|
-
return this.fetchFromUrl(this.oldBaseUrl + "stops", params, options);
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Adds the map-style selection params shared by {@link fetchMapStyle} and
|
|
161
|
-
* {@link fetchMapStyleByBearer}.
|
|
162
|
-
*
|
|
163
|
-
* The theme goes under `styleTheme` (camelCase) while the place and style ref go
|
|
164
|
-
* under `place_id` / `style_ref`. The mixed casing is the server's actual contract,
|
|
165
|
-
* not an oversight: `FormInput.styleTheme` predates the snake_case params added
|
|
166
|
-
* alongside `style_ref` (backend-mono `seedwork/infrastructure/validation.ts`).
|
|
167
|
-
* Do not "fix" the casing here — `style_theme` is read by nothing.
|
|
168
|
-
*
|
|
169
|
-
* @param params Query params object to extend in place.
|
|
170
|
-
* @param placeId Optional place whose assigned style should be resolved.
|
|
171
|
-
* @param styleRef Optional explicit style reference, bypassing the place's style.
|
|
172
|
-
* @param styleTheme Optional theme (`"light"` | `"dark"`).
|
|
173
|
-
*/
|
|
174
|
-
applyMapStyleParams(params, placeId, styleRef, styleTheme) {
|
|
175
|
-
if (placeId != null) {
|
|
176
|
-
params.place_id = placeId;
|
|
177
|
-
}
|
|
178
|
-
// Preview an explicit style ref / theme, bypassing the place's assigned style.
|
|
179
|
-
if (styleRef != null) {
|
|
180
|
-
params.style_ref = styleRef;
|
|
181
|
-
}
|
|
182
|
-
if (styleTheme != null) {
|
|
183
|
-
params.styleTheme = styleTheme;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
*
|
|
188
|
-
* @param token Client identification
|
|
189
|
-
* @param placeId
|
|
190
|
-
* @returns Response promise
|
|
191
|
-
*/
|
|
192
|
-
async fetchMapStyle(token, placeId, styleRef, styleTheme) {
|
|
193
|
-
const options = {
|
|
194
|
-
method: "GET",
|
|
195
|
-
headers: {
|
|
196
|
-
"content-type": "application/json",
|
|
197
|
-
Authorization: `Bearer ${token}`,
|
|
198
|
-
},
|
|
199
|
-
};
|
|
200
|
-
const params = {
|
|
201
|
-
lang: this.lang,
|
|
202
|
-
};
|
|
203
|
-
this.applyMapStyleParams(params, placeId, styleRef, styleTheme);
|
|
204
|
-
return this.fetchFromUrl(this.baseUrl + "mapStyleJson", params, options);
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Bearer-authenticated variant of {@link fetchMapStyle}: resolves the style JSON
|
|
208
|
-
* using the logged-in user's token, so access is authorized by the user's client
|
|
209
|
-
* permissions rather than the api key's scopes. Same query contract
|
|
210
|
-
* (`place_id`, `style_ref`, `styleTheme`).
|
|
211
|
-
*/
|
|
212
|
-
async fetchMapStyleByBearer(authToken, placeId, styleRef, styleTheme) {
|
|
213
|
-
const options = {
|
|
214
|
-
method: "GET",
|
|
215
|
-
headers: {
|
|
216
|
-
"content-type": "application/json",
|
|
217
|
-
Authorization: `Bearer ${authToken}`,
|
|
218
|
-
},
|
|
219
|
-
};
|
|
220
|
-
const params = {
|
|
221
|
-
lang: this.lang,
|
|
222
|
-
};
|
|
223
|
-
this.applyMapStyleParams(params, placeId, styleRef, styleTheme);
|
|
224
|
-
return this.fetchFromUrl(this.baseUrlPortal + "mapStyleJson", params, options);
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Fetches the map style configuration for a specified institution.
|
|
228
|
-
* Can be used to obtain any map style from an Institution, without the limitation of the ApiKey.
|
|
229
|
-
* Therefore, does not make use of an ApiKey but rather an authentication token.
|
|
230
|
-
*
|
|
231
|
-
* Sends a GET request to the "mapStyle" endpoint using the provided authentication token
|
|
232
|
-
* and institution ID. The request includes language and institution ID as query parameters.
|
|
233
|
-
*
|
|
234
|
-
* @param token - The Bearer authentication token to authorize the request.
|
|
235
|
-
* @param institutionId - The unique identifier of the institution whose map style is being requested.
|
|
236
|
-
* @returns A promise that resolves to the HTTP response containing the map style data.
|
|
237
|
-
*/
|
|
238
|
-
async fetchAnyMapStyle(authToken, institutionId) {
|
|
239
|
-
const options = {
|
|
240
|
-
method: "GET",
|
|
241
|
-
headers: {
|
|
242
|
-
"content-type": "application/json",
|
|
243
|
-
Authorization: `Bearer ${authToken}`,
|
|
244
|
-
},
|
|
245
|
-
};
|
|
246
|
-
const params = {
|
|
247
|
-
lang: this.lang,
|
|
248
|
-
institution_id: institutionId,
|
|
249
|
-
};
|
|
250
|
-
return this.fetchFromUrl(this.baseUrlPortal + "mapStyle", params, options);
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Obtain allowed Places associated with the key
|
|
254
|
-
* @param token
|
|
255
|
-
* @returns Response promise
|
|
256
|
-
*/
|
|
257
|
-
async fetchAllowedPlaces(token) {
|
|
258
|
-
const options = {
|
|
259
|
-
method: "GET",
|
|
260
|
-
headers: {
|
|
261
|
-
"content-type": "application/json",
|
|
262
|
-
Authorization: `Bearer ${token}`,
|
|
263
|
-
},
|
|
264
|
-
};
|
|
265
|
-
const params = {
|
|
266
|
-
lang: this.lang,
|
|
267
|
-
};
|
|
268
|
-
return this.fetchFromUrl(this.baseUrl + "availablePlaces", params, options);
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Fetches the available places for a given institution using the provided authentication token.
|
|
272
|
-
* Does not make use of an ApiKey but rather an authentication token, therefore it is not limited by the allowed ApiKey places.
|
|
273
|
-
*
|
|
274
|
-
* Sends a GET request to the `availablePlaces` endpoint with the institution ID and language as parameters.
|
|
275
|
-
*
|
|
276
|
-
* @param authToken - The authentication token used for authorization in the request header.
|
|
277
|
-
* @param institutionId - The unique identifier of the institution whose places are to be fetched.
|
|
278
|
-
* @returns A promise that resolves to the response from the API.
|
|
279
|
-
*/
|
|
280
|
-
async fetchPlacesFromAnyInstitution(institutionId, authToken) {
|
|
281
|
-
const options = {
|
|
282
|
-
method: "GET",
|
|
283
|
-
headers: {
|
|
284
|
-
"content-type": "application/json",
|
|
285
|
-
Authorization: `Bearer ${authToken}`,
|
|
286
|
-
},
|
|
287
|
-
};
|
|
288
|
-
const params = {
|
|
289
|
-
institution_id: institutionId,
|
|
290
|
-
lang: this.lang,
|
|
291
|
-
};
|
|
292
|
-
return this.fetchFromUrl(this.baseUrlPortal + "availablePlaces", params, options);
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Obtain info about specific place. Use mainly to obtain innerFloors.
|
|
296
|
-
*
|
|
297
|
-
* When `placeId` is an internal alias that may be reused across buildings, pass
|
|
298
|
-
* `buildingId` (and optionally `floorId`/`level`) to disambiguate which venue the
|
|
299
|
-
* alias refers to. `floorId` takes precedence over the numeric `level`.
|
|
300
|
-
* @param token
|
|
301
|
-
* @param placeId
|
|
302
|
-
* @param buildingId (Optional) Parent building/venue that contains the place.
|
|
303
|
-
* @param floorId (Optional) Floor ID within the building.
|
|
304
|
-
* @param level (Optional) Numeric floor level; used only when `floorId` is absent.
|
|
305
|
-
* @returns
|
|
306
|
-
*/
|
|
307
|
-
async fetchPlaceDetail(token, placeId, buildingId, floorId, level) {
|
|
308
|
-
const options = {
|
|
309
|
-
method: "GET",
|
|
310
|
-
headers: {
|
|
311
|
-
"content-type": "application/json",
|
|
312
|
-
Authorization: `Bearer ${token}`,
|
|
313
|
-
},
|
|
314
|
-
};
|
|
315
|
-
const params = {
|
|
316
|
-
place_id: placeId,
|
|
317
|
-
lang: this.lang,
|
|
318
|
-
};
|
|
319
|
-
if (buildingId !== undefined) {
|
|
320
|
-
params.building = buildingId;
|
|
321
|
-
}
|
|
322
|
-
if (floorId !== undefined) {
|
|
323
|
-
params.floor = floorId;
|
|
324
|
-
}
|
|
325
|
-
else if (level !== undefined) {
|
|
326
|
-
params.floor = level;
|
|
327
|
-
}
|
|
328
|
-
return this.fetchFromUrl(this.baseUrl + "place", params, options);
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Fetches detailed information for a specific place using its unique identifier.
|
|
332
|
-
* Can be used to obtain any place detail, without the limitation of the ApiKey.
|
|
333
|
-
* Therefore, does not make use of an ApiKey but rather an authentication token.
|
|
334
|
-
*
|
|
335
|
-
* When `placeId` is an internal alias that may be reused across buildings, pass
|
|
336
|
-
* `buildingId` (and optionally `floorId`/`level`) to disambiguate which venue the
|
|
337
|
-
* alias refers to. `floorId` takes precedence over the numeric `level`.
|
|
338
|
-
*
|
|
339
|
-
* @param authToken - The authentication token used for authorization in the request header.
|
|
340
|
-
* @param placeId - The unique identifier of the place to retrieve details for.
|
|
341
|
-
* @param buildingId - (Optional) Parent building/venue that contains the place.
|
|
342
|
-
* @param floorId - (Optional) Floor ID within the building.
|
|
343
|
-
* @param level - (Optional) Numeric floor level; used only when `floorId` is absent.
|
|
344
|
-
* @returns A promise that resolves to the HTTP response containing the place details.
|
|
345
|
-
*
|
|
346
|
-
*/
|
|
347
|
-
async fetchAnyPlaceDetail(authToken, placeId, buildingId, floorId, level) {
|
|
348
|
-
const options = {
|
|
349
|
-
method: "GET",
|
|
350
|
-
headers: {
|
|
351
|
-
"content-type": "application/json",
|
|
352
|
-
Authorization: `Bearer ${authToken}`,
|
|
353
|
-
},
|
|
354
|
-
};
|
|
355
|
-
const params = {
|
|
356
|
-
place_id: placeId,
|
|
357
|
-
lang: this.lang,
|
|
358
|
-
};
|
|
359
|
-
if (buildingId !== undefined) {
|
|
360
|
-
params.building = buildingId;
|
|
361
|
-
}
|
|
362
|
-
if (floorId !== undefined) {
|
|
363
|
-
params.floor = floorId;
|
|
364
|
-
}
|
|
365
|
-
else if (level !== undefined) {
|
|
366
|
-
params.floor = level;
|
|
367
|
-
}
|
|
368
|
-
return this.fetchFromUrl(this.baseUrlPortal + "place", params, options);
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* To obtain all places associated with targetPlace
|
|
372
|
-
* @param targetPlaceId
|
|
373
|
-
* @param token
|
|
374
|
-
* @returns
|
|
375
|
-
*/
|
|
376
|
-
async fetchSubPlaces(targetPlaceId, token) {
|
|
377
|
-
const options = {
|
|
378
|
-
method: "GET",
|
|
379
|
-
headers: {
|
|
380
|
-
"content-type": "application/json",
|
|
381
|
-
Authorization: `Bearer ${token}`,
|
|
382
|
-
},
|
|
383
|
-
};
|
|
384
|
-
const params = {
|
|
385
|
-
targetPlace: targetPlaceId,
|
|
386
|
-
lang: this.lang,
|
|
387
|
-
};
|
|
388
|
-
return this.fetchFromUrl(this.baseUrl + "subPlaces", params, options);
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Fetches sub-places for any specified target place using the Portal API.
|
|
392
|
-
* Can be used to obtain the sub-places for any target place, without the limitation of the ApiKey.
|
|
393
|
-
* Therefore, does not make use of an ApiKey but rather an authentication token.
|
|
394
|
-
*
|
|
395
|
-
* Sends a GET request to the "subPlaces" endpoint with the provided Bearer authentication token
|
|
396
|
-
* and target place ID. The request includes language and target place ID as query parameters.
|
|
397
|
-
*
|
|
398
|
-
* @param targetPlaceId - The unique identifier of the target place whose sub-places are being requested.
|
|
399
|
-
* @param authToken - The Bearer authentication token to authorize the request.
|
|
400
|
-
* @returns A promise that resolves to the HTTP response containing the sub-places data.
|
|
401
|
-
*/
|
|
402
|
-
async fetchAnySubPlaces(targetPlaceId, authToken) {
|
|
403
|
-
const options = {
|
|
404
|
-
method: "GET",
|
|
405
|
-
headers: {
|
|
406
|
-
"content-type": "application/json",
|
|
407
|
-
Authorization: `Bearer ${authToken}`,
|
|
408
|
-
},
|
|
409
|
-
};
|
|
410
|
-
const params = {
|
|
411
|
-
place_id: targetPlaceId,
|
|
412
|
-
lang: this.lang,
|
|
413
|
-
};
|
|
414
|
-
return this.fetchFromUrl(this.baseUrlPortal + "subPlaces", params, options);
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* Build the cleaned query parameters for a route request.
|
|
418
|
-
*
|
|
419
|
-
* Resolves both the origin (`from*`) and destination (`to*`) sides of the route
|
|
420
|
-
* from the provided configuration. For {@link IdLocation} endpoints this also
|
|
421
|
-
* forwards the building (`fromBuilding`/`toBuilding`) and floor
|
|
422
|
-
* (`fromFloor`/`toFloor`) so internal aliases that are reused across buildings
|
|
423
|
-
* can be disambiguated. Parameters that resolve to `null`/`undefined` are dropped.
|
|
424
|
-
* @param routeConfig The route configuration to translate into query params.
|
|
425
|
-
* @returns The cleaned query parameters ready to be appended to the request URL.
|
|
426
|
-
*/
|
|
427
|
-
buildRouteParams(routeConfig) {
|
|
428
|
-
const params = {
|
|
429
|
-
fromLatLng: undefined,
|
|
430
|
-
fromBuilding: undefined,
|
|
431
|
-
fromFloor: undefined,
|
|
432
|
-
toLatLng: undefined,
|
|
433
|
-
toBuilding: undefined,
|
|
434
|
-
toFloor: undefined,
|
|
435
|
-
fromPlaceId: undefined,
|
|
436
|
-
toPlaceId: undefined,
|
|
437
|
-
travelMode: routeConfiguration_1.TransportationMode.walking,
|
|
438
|
-
reducedMobility: routeConfig.preferAccessibleRoute ? 1 : 0,
|
|
439
|
-
announceFormat: routeConfig.announceFormat,
|
|
440
|
-
userBearing: routeConfig.userBearing,
|
|
441
|
-
lang: this.lang,
|
|
442
|
-
unitSystem: routeConfig.unitSystem,
|
|
443
|
-
};
|
|
444
|
-
if ("id" in routeConfig.initialLocation) {
|
|
445
|
-
const { id, buildingId, floorId, level } = routeConfig.initialLocation;
|
|
446
|
-
params.fromPlaceId = id;
|
|
447
|
-
if (buildingId !== undefined) {
|
|
448
|
-
params.fromBuilding = buildingId;
|
|
449
|
-
}
|
|
450
|
-
if (floorId !== undefined) {
|
|
451
|
-
params.fromFloor = floorId;
|
|
452
|
-
}
|
|
453
|
-
else if (level !== undefined) {
|
|
454
|
-
params.fromFloor = level;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
else {
|
|
458
|
-
const { lat, lng, floorId, placeId } = routeConfig.initialLocation;
|
|
459
|
-
params.fromLatLng = `${lat},${lng}`;
|
|
460
|
-
params.fromFloor = floorId;
|
|
461
|
-
params.fromBuilding = placeId;
|
|
462
|
-
}
|
|
463
|
-
if ("id" in routeConfig.finalLocation) {
|
|
464
|
-
const { id, buildingId, floorId, level } = routeConfig.finalLocation;
|
|
465
|
-
params.toPlaceId = id;
|
|
466
|
-
if (buildingId !== undefined) {
|
|
467
|
-
params.toBuilding = buildingId;
|
|
468
|
-
}
|
|
469
|
-
if (floorId !== undefined) {
|
|
470
|
-
params.toFloor = floorId;
|
|
471
|
-
}
|
|
472
|
-
else if (level !== undefined) {
|
|
473
|
-
params.toFloor = level;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
else {
|
|
477
|
-
const { lat, lng, floorId, placeId } = routeConfig.finalLocation;
|
|
478
|
-
params.toLatLng = `${lat},${lng}`;
|
|
479
|
-
params.toFloor = floorId;
|
|
480
|
-
params.toBuilding = placeId;
|
|
481
|
-
}
|
|
482
|
-
const cleanParams = {};
|
|
483
|
-
for (const key in params) {
|
|
484
|
-
const value = params[key];
|
|
485
|
-
if (value != null) {
|
|
486
|
-
cleanParams[key] = value;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
return cleanParams;
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* To obtain the route
|
|
493
|
-
* @param routeConfig
|
|
494
|
-
* @returns
|
|
495
|
-
*/
|
|
496
|
-
async fetchRoute(routeConfig, token) {
|
|
497
|
-
const options = {
|
|
498
|
-
method: "GET",
|
|
499
|
-
headers: {
|
|
500
|
-
"content-type": "application/json",
|
|
501
|
-
Authorization: `Bearer ${token}`,
|
|
502
|
-
},
|
|
503
|
-
};
|
|
504
|
-
const cleanParams = this.buildRouteParams(routeConfig);
|
|
505
|
-
return this.fetchFromUrl(this.routeBaseUrl + "route", cleanParams, options);
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* To obtain the route
|
|
509
|
-
* @param routeConfig
|
|
510
|
-
* @returns
|
|
511
|
-
*/
|
|
512
|
-
async fetchRouteV2(routeConfig, token) {
|
|
513
|
-
const options = {
|
|
514
|
-
method: "GET",
|
|
515
|
-
headers: {
|
|
516
|
-
"content-type": "application/json",
|
|
517
|
-
Authorization: `Bearer ${token}`,
|
|
518
|
-
},
|
|
519
|
-
};
|
|
520
|
-
const cleanParams = this.buildRouteParams(routeConfig);
|
|
521
|
-
return this.fetchFromUrl(this.routeBaseUrl + "v2/route", cleanParams, options);
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* To obtain the route from the live routing endpoint (`/sdk/liveroute`).
|
|
525
|
-
* @param routeConfig
|
|
526
|
-
* @returns
|
|
527
|
-
*/
|
|
528
|
-
async fetchLiveRoute(routeConfig, token) {
|
|
529
|
-
const options = {
|
|
530
|
-
method: "GET",
|
|
531
|
-
headers: {
|
|
532
|
-
"content-type": "application/json",
|
|
533
|
-
Authorization: `Bearer ${token}`,
|
|
534
|
-
},
|
|
535
|
-
};
|
|
536
|
-
const cleanParams = this.buildRouteParams(routeConfig);
|
|
537
|
-
return this.fetchFromUrl(this.routeBaseUrl + "liveroute", cleanParams, options);
|
|
538
|
-
}
|
|
539
|
-
/**
|
|
540
|
-
* To obtain info associated to an Institution based on id provided
|
|
541
|
-
* It return 403 if the institution id
|
|
542
|
-
* @param targetPlaceId
|
|
543
|
-
* @param token
|
|
544
|
-
* @returns
|
|
545
|
-
*/
|
|
546
|
-
async fetchInstitutions(token) {
|
|
547
|
-
const options = {
|
|
548
|
-
method: "GET",
|
|
549
|
-
headers: {
|
|
550
|
-
"content-type": "application/json",
|
|
551
|
-
Authorization: `Bearer ${token}`,
|
|
552
|
-
},
|
|
553
|
-
};
|
|
554
|
-
const params = {
|
|
555
|
-
lang: this.lang,
|
|
556
|
-
};
|
|
557
|
-
return this.fetchFromUrl(this.baseUrl + "institution", params, options);
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* To obtain places from an institution whose name is similar to provided input
|
|
561
|
-
* @param institutionId
|
|
562
|
-
* @param input Provided value to look for
|
|
563
|
-
* @param token Client identification
|
|
564
|
-
* @param parentIds Identifier of the parent place
|
|
565
|
-
* @param origin The ID of a totem or a place origin from directories. Used to return search results based on distance from the origin.
|
|
566
|
-
* @param lat Latitude as a string for location-based search.
|
|
567
|
-
* @param lng Longitude as a string for location-based search.
|
|
568
|
-
* @param floor Floor ID as a string for location-based search.
|
|
569
|
-
* @returns Response promise
|
|
570
|
-
*/
|
|
571
|
-
async fetchSearchResults(institutionId, input, token, parentIds, origin, lat, lng, floor) {
|
|
572
|
-
const options = {
|
|
573
|
-
method: "GET",
|
|
574
|
-
headers: {
|
|
575
|
-
"content-type": "application/json",
|
|
576
|
-
Authorization: `Bearer ${token}`,
|
|
577
|
-
},
|
|
578
|
-
};
|
|
579
|
-
const params = {
|
|
580
|
-
institution_id: institutionId,
|
|
581
|
-
input,
|
|
582
|
-
lang: this.lang,
|
|
583
|
-
};
|
|
584
|
-
if (parentIds) {
|
|
585
|
-
params.parentPlaces = [...parentIds];
|
|
586
|
-
}
|
|
587
|
-
if (origin) {
|
|
588
|
-
params.origin = origin;
|
|
589
|
-
}
|
|
590
|
-
if (lat) {
|
|
591
|
-
params.lat = lat;
|
|
592
|
-
}
|
|
593
|
-
if (lng) {
|
|
594
|
-
params.lng = lng;
|
|
595
|
-
}
|
|
596
|
-
if (floor) {
|
|
597
|
-
params.floor = floor;
|
|
598
|
-
}
|
|
599
|
-
return this.fetchFromUrl(this.baseUrl + "searchPlacesWithFilters", params, options);
|
|
600
|
-
}
|
|
601
|
-
/**
|
|
602
|
-
* Search places by one or more tags via the v2 endpoint `/api/sdk/v2/searchPlacesByTags`.
|
|
603
|
-
*
|
|
604
|
-
* Multiple tags are sent as a repeated/joined `tags` query parameter; the API
|
|
605
|
-
* accepts both `?tags=a&tags=b` and `?tags=a,b` forms.
|
|
606
|
-
*
|
|
607
|
-
* @param institutionId Institution to search within.
|
|
608
|
-
* @param tags Tags to match against. Must contain at least one entry.
|
|
609
|
-
* @param token Client API token.
|
|
610
|
-
* @param parentPlaces Optional list of parent place ids used to scope the search.
|
|
611
|
-
* @param sort Result ordering: `match` (Elastic scoring, default), `alphabetical`,
|
|
612
|
-
* or `distance` (requires `origin` or `lat`+`lng`+`floor`+`parentPlaces`).
|
|
613
|
-
* @param origin Place id of an origin (e.g. a totem) used as the distance reference.
|
|
614
|
-
* @param lat Latitude as string for distance-based ordering.
|
|
615
|
-
* @param lng Longitude as string for distance-based ordering.
|
|
616
|
-
* @param floor Floor id as string for distance-based ordering.
|
|
617
|
-
* @returns Response promise.
|
|
618
|
-
*/
|
|
619
|
-
async fetchSearchPlacesByTags(institutionId, tags, token, parentPlaces, sort, origin, lat, lng, floor) {
|
|
620
|
-
// The v2 endpoints authenticate via the Authorization header (Bearer),
|
|
621
|
-
// not via a `token` query parameter like the legacy /api/sdk/* routes.
|
|
622
|
-
const options = {
|
|
623
|
-
method: "GET",
|
|
624
|
-
headers: {
|
|
625
|
-
"content-type": "application/json",
|
|
626
|
-
Authorization: `Bearer ${token}`,
|
|
627
|
-
},
|
|
628
|
-
};
|
|
629
|
-
const params = {
|
|
630
|
-
institution_id: institutionId,
|
|
631
|
-
tags: [...tags],
|
|
632
|
-
lang: this.lang,
|
|
633
|
-
};
|
|
634
|
-
if (parentPlaces && parentPlaces.length > 0) {
|
|
635
|
-
params.parentPlaces = [...parentPlaces];
|
|
636
|
-
}
|
|
637
|
-
if (sort) {
|
|
638
|
-
params.sort = sort;
|
|
639
|
-
}
|
|
640
|
-
if (origin) {
|
|
641
|
-
params.origin = origin;
|
|
642
|
-
}
|
|
643
|
-
if (lat) {
|
|
644
|
-
params.lat = lat;
|
|
645
|
-
}
|
|
646
|
-
if (lng) {
|
|
647
|
-
params.lng = lng;
|
|
648
|
-
}
|
|
649
|
-
if (floor) {
|
|
650
|
-
params.floor = floor;
|
|
651
|
-
}
|
|
652
|
-
return this.fetchFromUrl(this.baseUrl + "searchPlacesByTags", params, options);
|
|
653
|
-
}
|
|
654
|
-
async fetchConfiguration(token, place_id, product) {
|
|
655
|
-
const options = {
|
|
656
|
-
method: "GET",
|
|
657
|
-
headers: {
|
|
658
|
-
"content-type": "application/json",
|
|
659
|
-
Authorization: `Bearer ${token}`,
|
|
660
|
-
},
|
|
661
|
-
};
|
|
662
|
-
const params = {
|
|
663
|
-
lang: this.lang,
|
|
664
|
-
};
|
|
665
|
-
if (place_id)
|
|
666
|
-
params.place_id = place_id;
|
|
667
|
-
if (product)
|
|
668
|
-
params.product = product;
|
|
669
|
-
return this.fetchFromUrl(this.baseUrl + "configuration", params, options);
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* Fetches the campaigns configured for a maps-group (totem screensaver playlist).
|
|
673
|
-
* `place_id` is the maps-group firebase id; `kiosk_id` optionally narrows to a
|
|
674
|
-
* single totem. Uses the api-key (`/api/sdk/v2/`) surface.
|
|
675
|
-
*/
|
|
676
|
-
async fetchCampaigns(token, place_id, kiosk_id) {
|
|
677
|
-
const options = {
|
|
678
|
-
method: "GET",
|
|
679
|
-
headers: {
|
|
680
|
-
"content-type": "application/json",
|
|
681
|
-
Authorization: `Bearer ${token}`,
|
|
682
|
-
},
|
|
683
|
-
};
|
|
684
|
-
const params = {
|
|
685
|
-
placeId: place_id,
|
|
686
|
-
};
|
|
687
|
-
if (kiosk_id)
|
|
688
|
-
params.kioskId = kiosk_id;
|
|
689
|
-
return this.fetchFromUrl(this.baseUrl + "campaigns", params, options);
|
|
690
|
-
}
|
|
691
|
-
async fetchCategories(token, place_id) {
|
|
692
|
-
const options = {
|
|
693
|
-
method: "GET",
|
|
694
|
-
headers: {
|
|
695
|
-
"content-type": "application/json",
|
|
696
|
-
Authorization: `Bearer ${token}`,
|
|
697
|
-
},
|
|
698
|
-
};
|
|
699
|
-
const params = {
|
|
700
|
-
lang: this.lang,
|
|
701
|
-
};
|
|
702
|
-
if (place_id)
|
|
703
|
-
params.id = place_id;
|
|
704
|
-
return this.fetchFromUrl(this.baseUrl + "category", params, options);
|
|
705
|
-
}
|
|
706
|
-
async fetchRoutesForOrigin(token, parentPlaceId, fromPlaceId, announceFormat, unitSystem, mode) {
|
|
707
|
-
const options = {
|
|
708
|
-
method: "GET",
|
|
709
|
-
headers: {
|
|
710
|
-
"content-type": "application/json",
|
|
711
|
-
Authorization: `Bearer ${token}`,
|
|
712
|
-
},
|
|
713
|
-
};
|
|
714
|
-
const params = {
|
|
715
|
-
placeId: parentPlaceId,
|
|
716
|
-
fromPlace: fromPlaceId,
|
|
717
|
-
announceFormat,
|
|
718
|
-
unitSystem,
|
|
719
|
-
mode,
|
|
720
|
-
lang: this.lang,
|
|
721
|
-
};
|
|
722
|
-
return this.fetchFromUrl(this.routeBaseUrl + "routes_for_origin", params, options);
|
|
723
|
-
}
|
|
724
|
-
async fetchCacheTimestamp(token, placeId) {
|
|
725
|
-
const options = {
|
|
726
|
-
method: "GET",
|
|
727
|
-
headers: {
|
|
728
|
-
"content-type": "application/json",
|
|
729
|
-
Authorization: `Bearer ${token}`,
|
|
730
|
-
},
|
|
731
|
-
};
|
|
732
|
-
const params = {
|
|
733
|
-
placeId,
|
|
734
|
-
};
|
|
735
|
-
return this.fetchFromUrl(this.routeBaseUrl + "cache_timestamp", params, options);
|
|
736
|
-
}
|
|
737
|
-
async fetchCssCustomization(token, type) {
|
|
738
|
-
const options = {
|
|
739
|
-
method: "GET",
|
|
740
|
-
headers: {
|
|
741
|
-
"content-type": "application/json",
|
|
742
|
-
Authorization: `Bearer ${token}`,
|
|
743
|
-
},
|
|
744
|
-
};
|
|
745
|
-
const params = {
|
|
746
|
-
type,
|
|
747
|
-
};
|
|
748
|
-
return this.fetchFromUrl(this.baseUrl + "styles/customStyles", params, options);
|
|
749
|
-
}
|
|
750
|
-
async postHealth(token, healthPingId, placeId, totemId, status) {
|
|
751
|
-
const requestData = JSON.stringify({
|
|
752
|
-
healthPingId: healthPingId,
|
|
753
|
-
placeId: placeId,
|
|
754
|
-
totemId: totemId,
|
|
755
|
-
status: status,
|
|
756
|
-
});
|
|
757
|
-
const params = {};
|
|
758
|
-
const options = {
|
|
759
|
-
method: "POST",
|
|
760
|
-
headers: {
|
|
761
|
-
accept: "application/json",
|
|
762
|
-
"Content-Type": "application/json",
|
|
763
|
-
Authorization: `Bearer ${token}`,
|
|
764
|
-
},
|
|
765
|
-
body: requestData,
|
|
766
|
-
};
|
|
767
|
-
return this.fetchFromUrl(this.baseUrlHealth, params, options);
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
exports.Requester = Requester;
|
|
771
|
-
//# sourceMappingURL=requester.js.map
|