atriusmaps-node-sdk 3.3.721 → 3.3.723
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/deploy/prepareSDKConfig.js +40 -14
- package/dist/cjs/nodesdk/nodeEntry.js +14 -5
- package/dist/cjs/package.json.js +1 -1
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +14 -7
- package/dist/cjs/plugins/dynamicPois/src/processors.js +3 -1
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +55 -21
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +6 -2
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +19 -8
- package/dist/cjs/plugins/searchService/src/poiSearch.js +3 -2
- package/dist/cjs/plugins/searchService/src/searchService.js +6 -2
- package/dist/cjs/plugins/searchService/src/utils.js +3 -1
- package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +53 -21
- package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +17 -7
- package/dist/cjs/plugins/wayfinder/src/findRoute.js +21 -7
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +56 -20
- package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +3 -1
- package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +75 -33
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +15 -5
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +47 -18
- package/dist/cjs/src/app.js +21 -8
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +15 -6
- package/dist/cjs/src/configs/postproc-stateTracking.js +8 -3
- package/dist/cjs/src/debugTools.js +8 -3
- package/dist/cjs/src/env.js +2 -1
- package/dist/cjs/src/extModules/bustle.js +40 -16
- package/dist/cjs/src/extModules/flexapi/src/validate.js +42 -18
- package/dist/cjs/src/extModules/log.js +16 -6
- package/dist/cjs/src/historyManager.js +3 -1
- package/dist/cjs/src/utils/configUtils.js +21 -8
- package/dist/cjs/src/utils/dom.js +19 -10
- package/dist/cjs/src/utils/funcs.js +8 -3
- package/dist/cjs/src/utils/geom.js +15 -5
- package/dist/cjs/src/utils/isInitialState.js +7 -3
- package/dist/cjs/src/utils/location.js +17 -8
- package/dist/cjs/src/utils/observable.js +17 -6
- package/dist/cjs/src/utils/rand.js +6 -2
- package/dist/package.json.js +1 -1
- package/dist/plugins/wayfinder/src/navGraph.js +1 -1
- package/dist/plugins/wayfinder/src/stepBuilder.js +1 -1
- package/package.json +1 -1
|
@@ -51,18 +51,26 @@ function prepareSDKConfig(sc) {
|
|
|
51
51
|
const validateHostAppId = hostAppId => (hostAppId ? trunc(hostAppId.toString(), 128) : undefined);
|
|
52
52
|
const validateHostAppVersion = hostAppVersion => (hostAppVersion ? trunc(hostAppVersion.toString(), 128) : undefined);
|
|
53
53
|
const validateHostAppProperties = hostAppProperties => {
|
|
54
|
-
if (!hostAppProperties || typeof hostAppProperties !== 'object')
|
|
54
|
+
if (!hostAppProperties || typeof hostAppProperties !== 'object') {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
55
57
|
|
|
56
58
|
const ret = {}; // lets build this back up ourselves to ensure its purity
|
|
57
59
|
const keys = Object.keys(hostAppProperties);
|
|
58
60
|
|
|
59
|
-
if (keys.length > 10)
|
|
61
|
+
if (keys.length > 10) {
|
|
62
|
+
keys.length = 10;
|
|
63
|
+
}
|
|
60
64
|
|
|
61
65
|
keys.forEach(key => {
|
|
62
66
|
let cleanKey = trunc(key.toString().replaceAll(/[^a-zA-Z0-9_]/g, ''), 128);
|
|
63
|
-
if (!cleanKey.match(/^[a-zA-Z]+/))
|
|
67
|
+
if (!cleanKey.match(/^[a-zA-Z]+/)) {
|
|
68
|
+
cleanKey = 'X' + cleanKey;
|
|
69
|
+
} // force to start with alpha char
|
|
64
70
|
let cleanVal = hostAppProperties[key];
|
|
65
|
-
if (cleanVal === null || cleanVal === undefined)
|
|
71
|
+
if (cleanVal === null || cleanVal === undefined) {
|
|
72
|
+
cleanVal = '';
|
|
73
|
+
}
|
|
66
74
|
cleanVal = trunc(cleanVal.toString(), 128);
|
|
67
75
|
ret[cleanKey] = cleanVal;
|
|
68
76
|
});
|
|
@@ -98,7 +106,9 @@ function prepareSDKConfig(sc) {
|
|
|
98
106
|
uuid: typeof document !== 'undefined' && document && document.location ? document.location.host : 'unknown', // used in analytics
|
|
99
107
|
};
|
|
100
108
|
|
|
101
|
-
if (anaytics2ActiveFlag !== undefined)
|
|
109
|
+
if (anaytics2ActiveFlag !== undefined) {
|
|
110
|
+
config.plugins.analytics2.active = anaytics2ActiveFlag;
|
|
111
|
+
}
|
|
102
112
|
|
|
103
113
|
// return an object with the named property set to the specified value, unless the
|
|
104
114
|
// value is undefined, then return an empty object
|
|
@@ -114,7 +124,7 @@ function prepareSDKConfig(sc) {
|
|
|
114
124
|
},
|
|
115
125
|
};
|
|
116
126
|
config.plugins.userMenu = { noLangOptions };
|
|
117
|
-
if (pinnedLocation)
|
|
127
|
+
if (pinnedLocation) {
|
|
118
128
|
config.plugins['online/pinnedLocation'] = {
|
|
119
129
|
location: pinnedLocation,
|
|
120
130
|
zoom: pinnedLocationZoom,
|
|
@@ -122,20 +132,26 @@ function prepareSDKConfig(sc) {
|
|
|
122
132
|
bearing: pinnedLocationBearing,
|
|
123
133
|
pitch: pinnedLocationPitch,
|
|
124
134
|
};
|
|
135
|
+
}
|
|
125
136
|
}
|
|
126
137
|
|
|
127
138
|
config.plugins.searchService = defaultSearchTerms ? { defaultSearchTerms } : {};
|
|
128
139
|
handleI18NParm(sc, 'defaultSearchTerms', config.plugins.searchService);
|
|
129
140
|
|
|
130
141
|
if (extendsConfig.includes('sdkVisual')) {
|
|
131
|
-
if (poiCategories)
|
|
132
|
-
|
|
142
|
+
if (poiCategories) {
|
|
143
|
+
config.plugins['online/homeView'] = { poiCategories };
|
|
144
|
+
} else {
|
|
145
|
+
config.plugins['online/homeView'] = {};
|
|
146
|
+
}
|
|
133
147
|
handleI18NParm(sc, 'poiCategories', config.plugins['online/homeView']);
|
|
134
148
|
}
|
|
135
149
|
// Allow *specific* additional plugins
|
|
136
150
|
// for now, this is just for internal use
|
|
137
151
|
if (plugins) {
|
|
138
|
-
if (plugins.draw)
|
|
152
|
+
if (plugins.draw) {
|
|
153
|
+
config.plugins.draw = plugins.draw;
|
|
154
|
+
}
|
|
139
155
|
// To get flight status working, one needs 3 plugins. This is a bad design, there should just be one and it provides
|
|
140
156
|
// all 3 of these services. Lets migrate to a single plugin at some point - but until then, lets at least make it look
|
|
141
157
|
// like a single plugin for SDK users. The only plugin that currently has configurable properties is "flightStatus" - so
|
|
@@ -152,15 +168,25 @@ function prepareSDKConfig(sc) {
|
|
|
152
168
|
config.plugins.deepLinking = { trackURL: true };
|
|
153
169
|
}
|
|
154
170
|
|
|
155
|
-
if (supportURLDeepLinks)
|
|
171
|
+
if (supportURLDeepLinks) {
|
|
172
|
+
config.configPostProc.push('mol-url-parms');
|
|
173
|
+
}
|
|
156
174
|
|
|
157
|
-
if (initState)
|
|
175
|
+
if (initState) {
|
|
176
|
+
postprocStateTracking.setStateFromStateString(config, atob(initState), true);
|
|
177
|
+
}
|
|
158
178
|
|
|
159
|
-
if (deepLinkParms)
|
|
179
|
+
if (deepLinkParms) {
|
|
180
|
+
postprocMolUrlParms.setDeepLinksForParms(config, new URLSearchParams(deepLinkParms), true);
|
|
181
|
+
}
|
|
160
182
|
|
|
161
|
-
if (desktopViewMinWidth !== undefined)
|
|
183
|
+
if (desktopViewMinWidth !== undefined) {
|
|
184
|
+
config.desktopViewMinWidth = desktopViewMinWidth;
|
|
185
|
+
}
|
|
162
186
|
|
|
163
|
-
if (forceDesktop)
|
|
187
|
+
if (forceDesktop) {
|
|
188
|
+
config.desktopViewMinWidth = 0;
|
|
189
|
+
}
|
|
164
190
|
|
|
165
191
|
if (dynamicPoisUrlBaseV1) {
|
|
166
192
|
config.plugins.dynamicPois = {
|
|
@@ -41,8 +41,11 @@ const log = function () {
|
|
|
41
41
|
.map(arg => (typeof arg === 'object' ? JSON.stringify(arg) : arg))
|
|
42
42
|
.join(' ');
|
|
43
43
|
const lines = msg.split('\n');
|
|
44
|
-
if (lines.length > 1)
|
|
45
|
-
|
|
44
|
+
if (lines.length > 1) {
|
|
45
|
+
msg = lines[0] + `… (+ ${lines.length - 1} lines)`;
|
|
46
|
+
} else if (msg.length > 256) {
|
|
47
|
+
msg = msg.substring(0, 255) + `… (length: ${msg.length} chars)`;
|
|
48
|
+
}
|
|
46
49
|
console.log(msg);
|
|
47
50
|
}
|
|
48
51
|
};
|
|
@@ -52,7 +55,9 @@ function addCommands(map, commands) {
|
|
|
52
55
|
commands.forEach(sig => {
|
|
53
56
|
map[sig.command] = function () {
|
|
54
57
|
const cob = { command: sig.command };
|
|
55
|
-
for (let i = 0; i < arguments.length; i++)
|
|
58
|
+
for (let i = 0; i < arguments.length; i++) {
|
|
59
|
+
cob[sig.args[i].name] = arguments[i];
|
|
60
|
+
}
|
|
56
61
|
return map(cob);
|
|
57
62
|
};
|
|
58
63
|
});
|
|
@@ -68,7 +73,9 @@ async function newMap(sdkConfig) {
|
|
|
68
73
|
|
|
69
74
|
controller.create(config).then(app => {
|
|
70
75
|
const map = (payload, arg2) => {
|
|
71
|
-
if (typeof payload === 'string')
|
|
76
|
+
if (typeof payload === 'string') {
|
|
77
|
+
payload = { ...arg2, command: payload };
|
|
78
|
+
}
|
|
72
79
|
log('Sending command object: ', payload);
|
|
73
80
|
return app.bus
|
|
74
81
|
.get('clientAPI/execute', payload)
|
|
@@ -103,7 +110,9 @@ const Init = {
|
|
|
103
110
|
newMap: config => newMap(config),
|
|
104
111
|
setLogging: flag => {
|
|
105
112
|
sdkLogging = flag;
|
|
106
|
-
if (flag)
|
|
113
|
+
if (flag) {
|
|
114
|
+
log(`${LIB_NAME} v${version} Logging enabled.`);
|
|
115
|
+
}
|
|
107
116
|
},
|
|
108
117
|
};
|
|
109
118
|
|
package/dist/cjs/package.json.js
CHANGED
|
@@ -43,7 +43,9 @@ function create(app, config = {}) {
|
|
|
43
43
|
const T = app.gt();
|
|
44
44
|
|
|
45
45
|
// used in testing
|
|
46
|
-
if (config._overrideRefreshFrequency)
|
|
46
|
+
if (config._overrideRefreshFrequency) {
|
|
47
|
+
REFRESH_FREQUENCY = config._overrideRefreshFrequency;
|
|
48
|
+
}
|
|
47
49
|
|
|
48
50
|
// by returning this dynamicDataLoaded promise, we hold sdkReady event until this is resolved
|
|
49
51
|
app.bus.on('system/readywhenyouare', () => state.dynamicDataNotPending);
|
|
@@ -63,8 +65,8 @@ function create(app, config = {}) {
|
|
|
63
65
|
const response = await fetch(dynamicPoisUrl, {
|
|
64
66
|
headers: { [ACCOUNT_ID_HEADER]: accountId },
|
|
65
67
|
});
|
|
66
|
-
if (response.ok)
|
|
67
|
-
|
|
68
|
+
if (response.ok) // 404 if customer does not have dynamic POIs
|
|
69
|
+
{
|
|
68
70
|
return response
|
|
69
71
|
.json()
|
|
70
72
|
.then(({ data }) => processDynamicPois(data))
|
|
@@ -72,19 +74,22 @@ function create(app, config = {}) {
|
|
|
72
74
|
fetchSuccessCount++;
|
|
73
75
|
})
|
|
74
76
|
.catch(console.error);
|
|
75
|
-
else {
|
|
77
|
+
} else {
|
|
76
78
|
console.warn('dynamicPois: fetch response status not ok', response);
|
|
77
79
|
fetchFailuresCount++;
|
|
78
80
|
// Don't keep trying after multiple fails unless past success is at least 50%
|
|
79
|
-
if (fetchFailuresCount >= MAX_FETCH_FAILS && fetchFailuresCount > fetchSuccessCount)
|
|
81
|
+
if (fetchFailuresCount >= MAX_FETCH_FAILS && fetchFailuresCount > fetchSuccessCount) {
|
|
80
82
|
clearInterval(fetchIntervalHandle);
|
|
83
|
+
}
|
|
81
84
|
}
|
|
82
85
|
};
|
|
83
86
|
|
|
84
87
|
return updateFromAPI()
|
|
85
88
|
.then(() => {
|
|
86
89
|
fetchIntervalHandle = setInterval(updateFromAPI, REFRESH_FREQUENCY);
|
|
87
|
-
if (typeof fetchIntervalHandle.unref === 'function')
|
|
90
|
+
if (typeof fetchIntervalHandle.unref === 'function') {
|
|
91
|
+
fetchIntervalHandle.unref();
|
|
92
|
+
} // Node only - do not keep-alive Lambda or other short-term environments
|
|
88
93
|
})
|
|
89
94
|
.finally(() => state.dynamicDataNotPending.resolve(true)); // even in case of failure, we don't want to hold up the UI
|
|
90
95
|
};
|
|
@@ -105,7 +110,9 @@ function create(app, config = {}) {
|
|
|
105
110
|
const nameMap = {};
|
|
106
111
|
for (const poiId of idArray) {
|
|
107
112
|
const poi = await app.bus.get('poi/getById', { id: poiId });
|
|
108
|
-
if (poi)
|
|
113
|
+
if (poi) {
|
|
114
|
+
nameMap[poiId] = poi.name;
|
|
115
|
+
}
|
|
109
116
|
}
|
|
110
117
|
return nameMap;
|
|
111
118
|
};
|
|
@@ -46,7 +46,9 @@ const processParkingPOIS = poiMap => {
|
|
|
46
46
|
R__namespace.filter(poi => poi.category === 'parking'),
|
|
47
47
|
R__namespace.map(poi => {
|
|
48
48
|
const da = poi.dynamicAttributes;
|
|
49
|
-
if (!da)
|
|
49
|
+
if (!da) {
|
|
50
|
+
throw Error(`No dynamicAttributes defined for parking POI ${poi.poiId}`);
|
|
51
|
+
}
|
|
50
52
|
const age = (Date.now() - poi.timestamp) / 1000; // how long ago this was updated by backend (in seconds)
|
|
51
53
|
const props =
|
|
52
54
|
age < da['parking.timeToLive'] // if this update is recent enough, consider it "valid"
|
|
@@ -59,19 +59,23 @@ async function create(app, config) {
|
|
|
59
59
|
poi.distance = null;
|
|
60
60
|
poi.isNavigable = poi.isNavigable === undefined || poi.isNavigable === true; // isNavigable is true as default, and is optional in the POI data
|
|
61
61
|
// poi.isNavigable = /^[a-mA-M]+/.test(poi.name) // uncomment for easy testing of isNavigable
|
|
62
|
-
if (poi.capacity)
|
|
62
|
+
if (poi.capacity) {
|
|
63
63
|
addToRoomInfo(poi, {
|
|
64
64
|
name: `Seats ${poi.capacity.join('-')}`,
|
|
65
65
|
svgId: 'number-of-seats',
|
|
66
66
|
});
|
|
67
|
-
|
|
67
|
+
}
|
|
68
|
+
if (poi.category.startsWith('meeting')) {
|
|
68
69
|
addToRoomInfo(poi, {
|
|
69
70
|
name: app.gt()('poiView:Conference Room'),
|
|
70
71
|
svgId: 'conference-room',
|
|
71
72
|
});
|
|
73
|
+
}
|
|
72
74
|
|
|
73
75
|
const roomId = getRoomId(poi);
|
|
74
|
-
if (roomId)
|
|
76
|
+
if (roomId) {
|
|
77
|
+
poi.roomId = roomId;
|
|
78
|
+
}
|
|
75
79
|
|
|
76
80
|
return [poi.poiId, fixPositionInfo(poi, structuresLookup)];
|
|
77
81
|
}),
|
|
@@ -101,14 +105,18 @@ async function create(app, config) {
|
|
|
101
105
|
try {
|
|
102
106
|
const pos = poi.position;
|
|
103
107
|
const n = navGraph.findClosestNode(pos.floorId, pos.latitude, pos.longitude);
|
|
104
|
-
if (!n)
|
|
108
|
+
if (!n) {
|
|
109
|
+
badPois.push({ id: poi.poiId, e: 'No closest Navgraph Node' });
|
|
110
|
+
}
|
|
105
111
|
} catch (e) {
|
|
106
112
|
log.error(e);
|
|
107
113
|
badPois.push({ id: poi.poiId, e: e.message });
|
|
108
114
|
}
|
|
109
115
|
});
|
|
110
116
|
|
|
111
|
-
if (badPois.length)
|
|
117
|
+
if (badPois.length) {
|
|
118
|
+
log.warn('badPois:', badPois);
|
|
119
|
+
}
|
|
112
120
|
|
|
113
121
|
log(`Total time for navgraph POI check: ${Date.now() - start}ms`);
|
|
114
122
|
}
|
|
@@ -118,15 +126,17 @@ async function create(app, config) {
|
|
|
118
126
|
Object.values(pois).forEach(poi => {
|
|
119
127
|
try {
|
|
120
128
|
const pos = poi.position;
|
|
121
|
-
if (!pos)
|
|
122
|
-
|
|
129
|
+
if (!pos) {
|
|
130
|
+
badPois.push({ poi, e: 'No position information' });
|
|
131
|
+
} else {
|
|
123
132
|
['buildingId', 'structureName', 'floorId', 'floorName', 'floorOrdinal', 'latitude', 'longitude'].forEach(
|
|
124
133
|
k => {
|
|
125
|
-
if (pos[k] === null || pos[k] === undefined)
|
|
134
|
+
if (pos[k] === null || pos[k] === undefined) {
|
|
126
135
|
badPois.push({
|
|
127
136
|
id: poi.poiId,
|
|
128
137
|
e: `invalid position property: ${k}: ${pos[k]}`,
|
|
129
138
|
});
|
|
139
|
+
}
|
|
130
140
|
},
|
|
131
141
|
);
|
|
132
142
|
}
|
|
@@ -147,7 +157,9 @@ async function create(app, config) {
|
|
|
147
157
|
}
|
|
148
158
|
|
|
149
159
|
async function enhanceImages(pois) {
|
|
150
|
-
for (const poi of Object.values(pois))
|
|
160
|
+
for (const poi of Object.values(pois)) {
|
|
161
|
+
await addImages(poi);
|
|
162
|
+
}
|
|
151
163
|
|
|
152
164
|
return pois;
|
|
153
165
|
}
|
|
@@ -155,17 +167,24 @@ async function create(app, config) {
|
|
|
155
167
|
app.bus.on('venueData/poiDataLoaded', async ({ pois, structures }) => {
|
|
156
168
|
const structuresLookup = buildStructureLookup.buildStructuresLookup(structures);
|
|
157
169
|
pois = formatPois(pois, structuresLookup);
|
|
158
|
-
if (configUtils.debugIsTrue(app, 'pseudoTransPois'))
|
|
159
|
-
for (const id in pois)
|
|
170
|
+
if (configUtils.debugIsTrue(app, 'pseudoTransPois')) {
|
|
171
|
+
for (const id in pois) {
|
|
172
|
+
pois[id] = pseudoTransPoi(pois[id], app.i18n().language);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
160
175
|
|
|
161
176
|
pois = filterBadPois(pois);
|
|
162
177
|
|
|
163
178
|
await enhanceImages(pois);
|
|
164
179
|
poisLoaded.resolve(pois);
|
|
165
180
|
|
|
166
|
-
if (app.config.debug && app.env.isBrowser)
|
|
181
|
+
if (app.config.debug && app.env.isBrowser) {
|
|
182
|
+
window._pois = pois;
|
|
183
|
+
}
|
|
167
184
|
|
|
168
|
-
if (app.config.debug)
|
|
185
|
+
if (app.config.debug) {
|
|
186
|
+
checkNavgraph(pois);
|
|
187
|
+
} // this doesn't change the pois, but warns in the console...
|
|
169
188
|
});
|
|
170
189
|
|
|
171
190
|
app.bus.on('poi/getById', async ({ id }) => {
|
|
@@ -188,7 +207,9 @@ async function create(app, config) {
|
|
|
188
207
|
const addOtherSecurityLanesIfNeeded = async poi => {
|
|
189
208
|
const primaryCheckpointId = R__namespace.path(checkpointPath, poi);
|
|
190
209
|
|
|
191
|
-
if (!primaryCheckpointId)
|
|
210
|
+
if (!primaryCheckpointId) {
|
|
211
|
+
return poi;
|
|
212
|
+
}
|
|
192
213
|
|
|
193
214
|
const queueTypes = await app.bus.get('venueData/getQueueTypes');
|
|
194
215
|
const securityPoisMap = await app.bus.get('poi/getByCategoryId', {
|
|
@@ -203,7 +224,9 @@ async function create(app, config) {
|
|
|
203
224
|
const prepareOtherSecurityLanes = (queueTypes, currentPoi, securityPois) => {
|
|
204
225
|
const queueTypePath = ['queue', 'queueType'];
|
|
205
226
|
const queueType = R__namespace.path(queueTypePath, currentPoi);
|
|
206
|
-
if (!queueType)
|
|
227
|
+
if (!queueType) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
207
230
|
|
|
208
231
|
const queueSubtypes = queueTypes[queueType];
|
|
209
232
|
const primaryCheckpointId = R__namespace.path(checkpointPath, currentPoi);
|
|
@@ -220,7 +243,9 @@ async function create(app, config) {
|
|
|
220
243
|
// if the value passed is non-null, simply return it. Else throw the error with the message specified.
|
|
221
244
|
// This is useful to insert into pipelines.
|
|
222
245
|
const ensureDefined = errorMsg => value => {
|
|
223
|
-
if (value != null)
|
|
246
|
+
if (value != null) {
|
|
247
|
+
return value;
|
|
248
|
+
}
|
|
224
249
|
throw Error(errorMsg);
|
|
225
250
|
};
|
|
226
251
|
|
|
@@ -239,7 +264,9 @@ async function create(app, config) {
|
|
|
239
264
|
const isFullUrl = url => !!url?.startsWith('https:');
|
|
240
265
|
|
|
241
266
|
async function addImages(poi) {
|
|
242
|
-
if (!poi)
|
|
267
|
+
if (!poi) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
243
270
|
const dpr = typeof window === 'undefined' ? 1 : window.devicePixelRatio || 1;
|
|
244
271
|
const size = `${Math.round(351 * dpr)}x${Math.round(197 * dpr)}`;
|
|
245
272
|
|
|
@@ -308,15 +335,22 @@ async function create(app, config) {
|
|
|
308
335
|
|
|
309
336
|
function pseudoTransPoi(poi, lang) {
|
|
310
337
|
['description', 'nearbyLandmark', 'name', 'phone', 'operationHours'].forEach(p => {
|
|
311
|
-
if (poi[p])
|
|
338
|
+
if (poi[p]) {
|
|
339
|
+
poi[p] = i18n.toLang(poi[p], lang);
|
|
340
|
+
}
|
|
312
341
|
});
|
|
313
|
-
if (poi.keywords)
|
|
342
|
+
if (poi.keywords) {
|
|
314
343
|
poi.keywords = poi.keywords.map(keyword => {
|
|
315
344
|
keyword.name = i18n.toLang(keyword.name, lang);
|
|
316
345
|
return keyword;
|
|
317
346
|
});
|
|
318
|
-
|
|
319
|
-
if (poi.position.
|
|
347
|
+
}
|
|
348
|
+
if (poi.position.floorName) {
|
|
349
|
+
poi.position.floorName = i18n.toLang(poi.position.floorName, lang);
|
|
350
|
+
}
|
|
351
|
+
if (poi.position.structureName) {
|
|
352
|
+
poi.position.structureName = i18n.toLang(poi.position.structureName, lang);
|
|
353
|
+
}
|
|
320
354
|
return poi;
|
|
321
355
|
}
|
|
322
356
|
|
|
@@ -74,7 +74,9 @@ function handleHeadless(app) {
|
|
|
74
74
|
const fromEndpoint = await location.locationToEndpoint(app, from);
|
|
75
75
|
const toEndpoint = await location.locationToEndpoint(app, to);
|
|
76
76
|
const options = { requiresAccessibility: !!accessible };
|
|
77
|
-
if (queueTypes)
|
|
77
|
+
if (queueTypes) {
|
|
78
|
+
options.selectedSecurityLanes = { SecurityLane: queueTypes };
|
|
79
|
+
}
|
|
78
80
|
return app.bus
|
|
79
81
|
.get('wayfinder/getRoute', { fromEndpoint, toEndpoint, options })
|
|
80
82
|
.then(R__namespace.pick(['distance', 'time', 'steps', 'navline', 'waypoints']));
|
|
@@ -83,7 +85,9 @@ function handleHeadless(app) {
|
|
|
83
85
|
app.bus.on('clientAPI/getDirectionsMultiple', async ({ locations, accessible, queueTypes }) => {
|
|
84
86
|
const endpoints = await Promise.all(locations.map(async l => location.locationToEndpoint(app, l)));
|
|
85
87
|
const options = { requiresAccessibility: !!accessible };
|
|
86
|
-
if (queueTypes)
|
|
88
|
+
if (queueTypes) {
|
|
89
|
+
options.selectedSecurityLanes = { SecurityLane: queueTypes };
|
|
90
|
+
}
|
|
87
91
|
const routes = await Promise.all(
|
|
88
92
|
R__namespace.aperture(2, endpoints).map(async a =>
|
|
89
93
|
app.bus.get('wayfinder/getRoute', {
|
|
@@ -21,7 +21,9 @@ function getBrowserCom(app) {
|
|
|
21
21
|
payload,
|
|
22
22
|
type: 'LL-server',
|
|
23
23
|
};
|
|
24
|
-
if (clientMsgId)
|
|
24
|
+
if (clientMsgId) {
|
|
25
|
+
ob.clientMsgId = clientMsgId;
|
|
26
|
+
}
|
|
25
27
|
try {
|
|
26
28
|
window.postMessage(ob, '*');
|
|
27
29
|
} catch (e) {
|
|
@@ -35,7 +37,9 @@ function getBrowserCom(app) {
|
|
|
35
37
|
payload,
|
|
36
38
|
type: 'LL-server',
|
|
37
39
|
};
|
|
38
|
-
if (clientMsgId)
|
|
40
|
+
if (clientMsgId) {
|
|
41
|
+
ob.clientMsgId = clientMsgId;
|
|
42
|
+
}
|
|
39
43
|
window.postMessage(ob, '*');
|
|
40
44
|
};
|
|
41
45
|
|
|
@@ -56,14 +60,18 @@ function getBrowserCom(app) {
|
|
|
56
60
|
.get('clientAPI/execute', d.payload)
|
|
57
61
|
.then(resOb => sendResponse(resOb, d.msgId))
|
|
58
62
|
.catch(er => {
|
|
59
|
-
if (app.config.debug)
|
|
63
|
+
if (app.config.debug) {
|
|
64
|
+
console.error(er);
|
|
65
|
+
}
|
|
60
66
|
sendError(er.message, d.msgId);
|
|
61
67
|
});
|
|
62
68
|
}
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
// Listen for HTML5 postMessage events - these come from SDKClient apps
|
|
66
|
-
if (removePreviousListener)
|
|
72
|
+
if (removePreviousListener) {
|
|
73
|
+
removePreviousListener();
|
|
74
|
+
}
|
|
67
75
|
window.addEventListener('message', msgHandler);
|
|
68
76
|
removePreviousListener = () => window.removeEventListener('message', msgHandler);
|
|
69
77
|
|
|
@@ -224,19 +232,22 @@ async function create(app, config) {
|
|
|
224
232
|
app.bus
|
|
225
233
|
.get('clientAPI/execute', { command: 'getCommandJSON' })
|
|
226
234
|
.then(commandJSON => sendEvent('ready', { commandJSON }));
|
|
227
|
-
if (!config.headless && app.config.uiHide && app.config.uiHide.sidebar && app.env.isDesktop())
|
|
235
|
+
if (!config.headless && app.config.uiHide && app.config.uiHide.sidebar && app.env.isDesktop()) {
|
|
228
236
|
app.bus.send('map/changePadding', {
|
|
229
237
|
padding: { left: 55, right: 55, top: 72, bottom: 22 },
|
|
230
238
|
});
|
|
239
|
+
}
|
|
231
240
|
};
|
|
232
241
|
|
|
233
|
-
if (config.headless)
|
|
234
|
-
|
|
242
|
+
if (config.headless) // in headless case, we are ready once data is ready
|
|
243
|
+
{
|
|
235
244
|
Promise.all([
|
|
236
245
|
new Promise(resolve => app.bus.monitor('venueData/navGraphLoaded', resolve)),
|
|
237
246
|
new Promise(resolve => app.bus.monitor('venueData/poiDataLoaded', resolve)),
|
|
238
247
|
]).then(weReady);
|
|
239
|
-
else
|
|
248
|
+
} else {
|
|
249
|
+
app.bus.on('map/mapReadyToShow', weReady);
|
|
250
|
+
}
|
|
240
251
|
|
|
241
252
|
app.bus.on('sdkServer/sendEvent', ({ eventName, ...props }) => sendEvent(eventName, props));
|
|
242
253
|
};
|
|
@@ -45,9 +45,10 @@ function createPOISearch(pois, lang) {
|
|
|
45
45
|
|
|
46
46
|
function search(queryParams) {
|
|
47
47
|
const options = { ...queryParams };
|
|
48
|
-
if (!options.limit)
|
|
49
|
-
|
|
48
|
+
if (!options.limit) // sometimes limit is NaN or undefined!
|
|
49
|
+
{
|
|
50
50
|
options.limit = DEFAULT_RESULTS_LIMIT;
|
|
51
|
+
}
|
|
51
52
|
const ids = index.search(options);
|
|
52
53
|
return Object.values(R__namespace.pick(ids, pois));
|
|
53
54
|
}
|
|
@@ -61,7 +61,9 @@ function create(app, config) {
|
|
|
61
61
|
|
|
62
62
|
async function searchNearby() {
|
|
63
63
|
const startLocation = await app.bus.getFirst('user/getPhysicalLocation');
|
|
64
|
-
if (!startLocation?.floorId)
|
|
64
|
+
if (!startLocation?.floorId) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
65
67
|
const poisSameFloor = await app.bus.get('poi/getByFloorId', {
|
|
66
68
|
floorId: startLocation?.floorId,
|
|
67
69
|
});
|
|
@@ -226,7 +228,9 @@ function create(app, config) {
|
|
|
226
228
|
* @param {Object<string, Object>} - dictionary of POI id to dynamic data object
|
|
227
229
|
*/
|
|
228
230
|
app.bus.on('poi/setDynamicData', async ({ plugin, idValuesMap }) => {
|
|
229
|
-
if (plugin !== 'grab')
|
|
231
|
+
if (plugin !== 'grab') {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
230
234
|
|
|
231
235
|
const dynamicPoisPromises = Object.keys(idValuesMap).map(id => app.bus.get('poi/getById', { id }));
|
|
232
236
|
|
|
@@ -19,7 +19,9 @@ const getFlexSearchInstance = ({ lang, type = 'standard' }) => {
|
|
|
19
19
|
|
|
20
20
|
// Use the full tokenizer for non-ASCII languages and for standard searching
|
|
21
21
|
// but use "forward" for typeahead
|
|
22
|
-
if (NON_ASCII_LANGUAGES.includes(lang))
|
|
22
|
+
if (NON_ASCII_LANGUAGES.includes(lang)) {
|
|
23
|
+
options.tokenize = 'full';
|
|
24
|
+
}
|
|
23
25
|
|
|
24
26
|
return new FlexSearch.Index(options);
|
|
25
27
|
};
|