atriusmaps-node-sdk 3.3.898 → 3.3.900
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/nodesdk/nodeEntry.js +36 -58
- package/dist/cjs/package.json.js +8 -4
- package/dist/cjs/plugins/clientAPI/src/clientAPI.js +8 -6
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +50 -142
- package/dist/cjs/plugins/dynamicPois/src/processors.js +31 -53
- package/dist/cjs/plugins/flightStatus/src/flightDetailsMapper.js +47 -116
- package/dist/cjs/plugins/flightStatus/src/flightStatus.js +48 -82
- package/dist/cjs/plugins/flightStatus/src/utils.js +4 -14
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +77 -154
- package/dist/cjs/plugins/sdkServer/src/prepareSDKConfig.js +45 -76
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +70 -79
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +97 -147
- package/dist/cjs/plugins/searchService/src/flexsearchExports/lang.js +16 -190
- package/dist/cjs/plugins/searchService/src/flexsearchExports/simple.js +28 -35
- package/dist/cjs/plugins/searchService/src/poiSearch.js +10 -21
- package/dist/cjs/plugins/searchService/src/searchService.js +45 -147
- package/dist/cjs/plugins/searchService/src/searchTypeahead.js +17 -28
- package/dist/cjs/plugins/searchService/src/utils.js +9 -13
- package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +148 -304
- package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +47 -126
- package/dist/cjs/plugins/wayfinder/src/findRoute.js +6 -73
- package/dist/cjs/plugins/wayfinder/src/minPriorityQueue.js +7 -27
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +78 -259
- package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +26 -57
- package/dist/cjs/plugins/wayfinder/src/segmentBadges.js +25 -25
- package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +50 -133
- package/dist/cjs/plugins/wayfinder/src/segmentCategories.js +29 -29
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +53 -145
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +105 -349
- package/dist/cjs/src/app.js +53 -91
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +34 -43
- package/dist/cjs/src/configs/postproc-stateTracking.js +1 -19
- package/dist/cjs/src/controller.js +4 -26
- package/dist/cjs/src/debugTools.js +55 -94
- package/dist/cjs/src/env.js +8 -19
- package/dist/cjs/src/extModules/bustle.js +15 -71
- package/dist/cjs/src/extModules/flexapi/src/help.js +7 -22
- package/dist/cjs/src/extModules/flexapi/src/index.js +15 -29
- package/dist/cjs/src/extModules/flexapi/src/validate.js +45 -93
- package/dist/cjs/src/extModules/geohasher.js +13 -31
- package/dist/cjs/src/extModules/log.js +18 -29
- package/dist/cjs/src/historyManager.js +4 -6
- package/dist/cjs/src/utils/bounds.js +2 -4
- package/dist/cjs/src/utils/buildStructureLookup.js +7 -7
- package/dist/cjs/src/utils/configUtils.js +7 -43
- package/dist/cjs/src/utils/date.js +5 -17
- package/dist/cjs/src/utils/distance.js +2 -2
- package/dist/cjs/src/utils/dom.js +9 -24
- package/dist/cjs/src/utils/funcs.js +15 -30
- package/dist/cjs/src/utils/geodesy.js +24 -39
- package/dist/cjs/src/utils/geom.js +32 -148
- package/dist/cjs/src/utils/i18n.js +39 -70
- package/dist/cjs/src/utils/isInitialState.js +7 -13
- package/dist/cjs/src/utils/location.js +10 -29
- package/dist/cjs/src/utils/observable.js +4 -29
- package/dist/cjs/src/utils/rand.js +9 -80
- package/dist/cjs/utils/constants.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/plugins/sdkServer/src/prepareSDKConfig.js +1 -1
- package/dist/src/utils/buildStructureLookup.js +1 -1
- package/dist/src/utils/date.js +1 -1
- package/package.json +1 -1
|
@@ -26,13 +26,11 @@ function _interopNamespaceDefault(e) {
|
|
|
26
26
|
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
27
27
|
|
|
28
28
|
async function create(app) {
|
|
29
|
-
const log = app.log.sublog(
|
|
29
|
+
const log = app.log.sublog("poiDataManager");
|
|
30
30
|
const init = () => {
|
|
31
|
-
app.bus.send(
|
|
31
|
+
app.bus.send("venueData/loadPoiData");
|
|
32
32
|
};
|
|
33
|
-
|
|
34
33
|
let poisLoaded = new Zousan();
|
|
35
|
-
|
|
36
34
|
const fixPositionInfo = (poi, structuresLookup) => {
|
|
37
35
|
const { position } = poi;
|
|
38
36
|
const structure = structuresLookup.floorIdToStructure(position.floorId);
|
|
@@ -46,99 +44,88 @@ async function create(app) {
|
|
|
46
44
|
structureName: structure.name,
|
|
47
45
|
buildingId: structure.id,
|
|
48
46
|
floorName: floor.name,
|
|
49
|
-
floorOrdinal: floor.ordinal
|
|
47
|
+
floorOrdinal: floor.ordinal
|
|
50
48
|
};
|
|
51
49
|
return { ...poi, position: detailedPosition };
|
|
52
50
|
};
|
|
53
|
-
|
|
54
|
-
// todo R.map may be enough to update dictionary values
|
|
55
51
|
const formatPois = (pois, structuresLookup) => {
|
|
56
52
|
return R__namespace.pipe(
|
|
57
53
|
R__namespace.values,
|
|
58
|
-
R__namespace.map(poi => {
|
|
54
|
+
R__namespace.map((poi) => {
|
|
59
55
|
poi.distance = null;
|
|
60
56
|
poi.staticName = poi.name;
|
|
61
|
-
poi.isNavigable = poi.isNavigable ===
|
|
62
|
-
// poi.isNavigable = /^[a-mA-M]+/.test(poi.name) // uncomment for easy testing of isNavigable
|
|
57
|
+
poi.isNavigable = poi.isNavigable === void 0 || poi.isNavigable === true;
|
|
63
58
|
if (poi.capacity) {
|
|
64
59
|
addToRoomInfo(poi, {
|
|
65
|
-
name: `Seats ${poi.capacity.join(
|
|
66
|
-
svgId:
|
|
60
|
+
name: `Seats ${poi.capacity.join("-")}`,
|
|
61
|
+
svgId: "number-of-seats"
|
|
67
62
|
});
|
|
68
63
|
}
|
|
69
|
-
if (poi.category.startsWith(
|
|
64
|
+
if (poi.category.startsWith("meeting")) {
|
|
70
65
|
addToRoomInfo(poi, {
|
|
71
|
-
name: app.gt()(
|
|
72
|
-
svgId:
|
|
66
|
+
name: app.gt()("poiView:Conference Room"),
|
|
67
|
+
svgId: "conference-room"
|
|
73
68
|
});
|
|
74
69
|
}
|
|
75
|
-
|
|
76
70
|
const roomId = getRoomId(poi);
|
|
77
71
|
if (roomId) {
|
|
78
72
|
poi.roomId = roomId;
|
|
79
73
|
}
|
|
80
|
-
|
|
81
74
|
return [poi.poiId, fixPositionInfo(poi, structuresLookup)];
|
|
82
75
|
}),
|
|
83
|
-
R__namespace.fromPairs
|
|
76
|
+
R__namespace.fromPairs
|
|
84
77
|
)(pois);
|
|
85
78
|
};
|
|
86
|
-
|
|
87
79
|
const addToRoomInfo = (poi, value) => {
|
|
88
80
|
if (!poi.roomInfo) {
|
|
89
81
|
poi.roomInfo = [];
|
|
90
82
|
}
|
|
91
83
|
poi.roomInfo.push(value);
|
|
92
84
|
};
|
|
93
|
-
|
|
94
85
|
const getRoomId = R__namespace.pipe(
|
|
95
|
-
R__namespace.propOr([],
|
|
96
|
-
R__namespace.find(R__namespace.propEq(
|
|
97
|
-
R__namespace.prop(
|
|
98
|
-
R__namespace.unless(R__namespace.isNil, R__namespace.tail)
|
|
86
|
+
R__namespace.propOr([], "externalIds"),
|
|
87
|
+
R__namespace.find(R__namespace.propEq("roomId", "type")),
|
|
88
|
+
R__namespace.prop("id"),
|
|
89
|
+
R__namespace.unless(R__namespace.isNil, R__namespace.tail)
|
|
99
90
|
);
|
|
100
|
-
|
|
101
91
|
async function checkNavgraph(pois) {
|
|
102
92
|
const start = Date.now();
|
|
103
93
|
const badPois = [];
|
|
104
|
-
const navGraph = await app.bus.get(
|
|
105
|
-
Object.values(pois).forEach(poi => {
|
|
94
|
+
const navGraph = await app.bus.get("wayfinder/_getNavGraph");
|
|
95
|
+
Object.values(pois).forEach((poi) => {
|
|
106
96
|
try {
|
|
107
97
|
const pos = poi.position;
|
|
108
98
|
const n = navGraph.findClosestNode(pos.floorId, pos.latitude, pos.longitude);
|
|
109
99
|
if (!n) {
|
|
110
|
-
badPois.push({ id: poi.poiId, e:
|
|
100
|
+
badPois.push({ id: poi.poiId, e: "No closest Navgraph Node" });
|
|
111
101
|
}
|
|
112
102
|
} catch (e) {
|
|
113
103
|
log.error(e);
|
|
114
104
|
badPois.push({ id: poi.poiId, e: e.message });
|
|
115
105
|
}
|
|
116
106
|
});
|
|
117
|
-
|
|
118
107
|
if (badPois.length) {
|
|
119
|
-
log.warn(
|
|
108
|
+
log.warn("badPois:", badPois);
|
|
120
109
|
}
|
|
121
|
-
|
|
122
110
|
log(`Total time for navgraph POI check: ${Date.now() - start}ms`);
|
|
123
111
|
}
|
|
124
|
-
|
|
125
112
|
function filterBadPois(pois) {
|
|
126
113
|
const badPois = [];
|
|
127
|
-
Object.values(pois).forEach(poi => {
|
|
114
|
+
Object.values(pois).forEach((poi) => {
|
|
128
115
|
try {
|
|
129
116
|
const pos = poi.position;
|
|
130
117
|
if (!pos) {
|
|
131
|
-
badPois.push({ poi, e:
|
|
118
|
+
badPois.push({ poi, e: "No position information" });
|
|
132
119
|
} else {
|
|
133
|
-
[
|
|
134
|
-
k => {
|
|
135
|
-
if (pos[k] === null || pos[k] ===
|
|
120
|
+
["buildingId", "structureName", "floorId", "floorName", "floorOrdinal", "latitude", "longitude"].forEach(
|
|
121
|
+
(k) => {
|
|
122
|
+
if (pos[k] === null || pos[k] === void 0) {
|
|
136
123
|
badPois.push({
|
|
137
124
|
id: poi.poiId,
|
|
138
|
-
e: `invalid position property: ${k}: ${pos[k]}
|
|
125
|
+
e: `invalid position property: ${k}: ${pos[k]}`
|
|
139
126
|
});
|
|
140
127
|
}
|
|
141
|
-
}
|
|
128
|
+
}
|
|
142
129
|
);
|
|
143
130
|
}
|
|
144
131
|
} catch (e) {
|
|
@@ -146,171 +133,128 @@ async function create(app) {
|
|
|
146
133
|
badPois.push({ id: poi.poiId, e: e.message });
|
|
147
134
|
}
|
|
148
135
|
});
|
|
149
|
-
|
|
150
136
|
if (badPois.length) {
|
|
151
|
-
log.warn(
|
|
152
|
-
badPois.forEach(ob => {
|
|
137
|
+
log.warn("badPois:", badPois);
|
|
138
|
+
badPois.forEach((ob) => {
|
|
153
139
|
delete pois[ob.id];
|
|
154
140
|
});
|
|
155
141
|
}
|
|
156
|
-
|
|
157
142
|
return pois;
|
|
158
143
|
}
|
|
159
|
-
|
|
160
144
|
async function enhanceImages(pois) {
|
|
161
145
|
for (const poi of Object.values(pois)) {
|
|
162
146
|
await addImages(poi);
|
|
163
147
|
}
|
|
164
|
-
|
|
165
148
|
return pois;
|
|
166
149
|
}
|
|
167
|
-
|
|
168
|
-
app.bus.on('venueData/poiDataLoaded', async ({ pois, structures }) => {
|
|
150
|
+
app.bus.on("venueData/poiDataLoaded", async ({ pois, structures }) => {
|
|
169
151
|
const structuresLookup = buildStructureLookup.buildStructuresLookup(structures);
|
|
170
152
|
pois = formatPois(pois, structuresLookup);
|
|
171
|
-
if (configUtils.debugIsTrue(app,
|
|
153
|
+
if (configUtils.debugIsTrue(app, "pseudoTransPois")) {
|
|
172
154
|
for (const id in pois) {
|
|
173
155
|
pois[id] = pseudoTransPoi(pois[id], app.i18n().language);
|
|
174
156
|
}
|
|
175
157
|
}
|
|
176
|
-
|
|
177
158
|
pois = filterBadPois(pois);
|
|
178
|
-
|
|
179
159
|
await enhanceImages(pois);
|
|
180
160
|
poisLoaded.resolve(pois);
|
|
181
|
-
|
|
182
161
|
if (app.config.debug && app.env.isBrowser) {
|
|
183
162
|
window._pois = pois;
|
|
184
163
|
}
|
|
185
|
-
|
|
186
164
|
if (app.config.debug) {
|
|
187
165
|
checkNavgraph(pois);
|
|
188
|
-
}
|
|
166
|
+
}
|
|
189
167
|
});
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return poisLoaded.then(pois => pois[id]);
|
|
168
|
+
app.bus.on("poi/getById", async ({ id }) => {
|
|
169
|
+
return poisLoaded.then((pois) => pois[id]);
|
|
193
170
|
});
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
poisLoaded.then(R__namespace.pickBy(R__namespace.pathEq(floorId, [
|
|
171
|
+
app.bus.on(
|
|
172
|
+
"poi/getByFloorId",
|
|
173
|
+
async ({ floorId }) => poisLoaded.then(R__namespace.pickBy(R__namespace.pathEq(floorId, ["position", "floorId"])))
|
|
197
174
|
);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
// returns true for exact category matches or parent category matches
|
|
201
|
-
const categoryMatch = poi => poi.category === categoryId || poi.category.startsWith(categoryId + '.');
|
|
175
|
+
app.bus.on("poi/getByCategoryId", async ({ categoryId }) => {
|
|
176
|
+
const categoryMatch = (poi) => poi.category === categoryId || poi.category.startsWith(categoryId + ".");
|
|
202
177
|
return poisLoaded.then(R__namespace.pickBy(categoryMatch));
|
|
203
178
|
});
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
const checkpointPath = ['queue', 'primaryQueueId'];
|
|
208
|
-
const addOtherSecurityLanesIfNeeded = async poi => {
|
|
179
|
+
app.bus.on("poi/getAll", async () => poisLoaded);
|
|
180
|
+
const checkpointPath = ["queue", "primaryQueueId"];
|
|
181
|
+
const addOtherSecurityLanesIfNeeded = async (poi) => {
|
|
209
182
|
const primaryCheckpointId = R__namespace.path(checkpointPath, poi);
|
|
210
|
-
|
|
211
183
|
if (!primaryCheckpointId) {
|
|
212
184
|
return poi;
|
|
213
185
|
}
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
categoryId: 'security',
|
|
186
|
+
const queueTypes = await app.bus.get("venueData/getQueueTypes");
|
|
187
|
+
const securityPoisMap = await app.bus.get("poi/getByCategoryId", {
|
|
188
|
+
categoryId: "security"
|
|
218
189
|
});
|
|
219
190
|
const securityPoisList = Object.values(securityPoisMap);
|
|
220
|
-
|
|
221
191
|
poi.queue.otherQueues = prepareOtherSecurityLanes(queueTypes, poi, securityPoisList);
|
|
222
192
|
return poi;
|
|
223
193
|
};
|
|
224
|
-
|
|
225
194
|
const prepareOtherSecurityLanes = (queueTypes, currentPoi, securityPois) => {
|
|
226
|
-
const queueTypePath = [
|
|
195
|
+
const queueTypePath = ["queue", "queueType"];
|
|
227
196
|
const queueType = R__namespace.path(queueTypePath, currentPoi);
|
|
228
197
|
if (!queueType) {
|
|
229
198
|
return null;
|
|
230
199
|
}
|
|
231
|
-
|
|
232
200
|
const queueSubtypes = queueTypes[queueType];
|
|
233
201
|
const primaryCheckpointId = R__namespace.path(checkpointPath, currentPoi);
|
|
234
|
-
return securityPois
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
.
|
|
238
|
-
|
|
239
|
-
const lane = getLaneData(laneId)(queueSubtypes);
|
|
240
|
-
return { poiId: poi.poiId, ...lane };
|
|
241
|
-
});
|
|
202
|
+
return securityPois.filter(R__namespace.pathEq(primaryCheckpointId, checkpointPath)).filter((poi) => poi.poiId !== currentPoi.poiId).map((poi) => {
|
|
203
|
+
const laneId = R__namespace.path(["queue", "queueSubtype"], poi);
|
|
204
|
+
const lane = getLaneData(laneId)(queueSubtypes);
|
|
205
|
+
return { poiId: poi.poiId, ...lane };
|
|
206
|
+
});
|
|
242
207
|
};
|
|
243
|
-
|
|
244
|
-
// if the value passed is non-null, simply return it. Else throw the error with the message specified.
|
|
245
|
-
// This is useful to insert into pipelines.
|
|
246
|
-
const ensureDefined = errorMsg => value => {
|
|
208
|
+
const ensureDefined = (errorMsg) => (value) => {
|
|
247
209
|
if (value != null) {
|
|
248
210
|
return value;
|
|
249
211
|
}
|
|
250
212
|
throw Error(errorMsg);
|
|
251
213
|
};
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Updates security checkpoint POI with a list of related security checkpoints.
|
|
262
|
-
*/
|
|
263
|
-
app.bus.on('poi/addOtherSecurityLanes', ({ poi }) => addOtherSecurityLanesIfNeeded(poi));
|
|
264
|
-
|
|
265
|
-
const isFullUrl = url => !!url?.startsWith('https:');
|
|
266
|
-
|
|
214
|
+
const getLaneData = (laneId) => R__namespace.pipe(
|
|
215
|
+
R__namespace.find(R__namespace.propEq(laneId, "id")),
|
|
216
|
+
ensureDefined(`No queue found with ID: ${laneId}`),
|
|
217
|
+
R__namespace.pick(["displayText", "imageId"])
|
|
218
|
+
);
|
|
219
|
+
app.bus.on("poi/addOtherSecurityLanes", ({ poi }) => addOtherSecurityLanesIfNeeded(poi));
|
|
220
|
+
const isFullUrl = (url) => !!url?.startsWith("https:");
|
|
267
221
|
async function addImages(poi) {
|
|
268
222
|
if (!poi) {
|
|
269
223
|
return;
|
|
270
224
|
}
|
|
271
|
-
const dpr = typeof window ===
|
|
225
|
+
const dpr = typeof window === "undefined" ? 1 : window.devicePixelRatio || 1;
|
|
272
226
|
const size = `${Math.round(351 * dpr)}x${Math.round(197 * dpr)}`;
|
|
273
|
-
|
|
274
227
|
if (!R__namespace.length(poi.images)) {
|
|
275
228
|
poi.images = [];
|
|
276
229
|
} else if (!isFullUrl(poi.images[0])) {
|
|
277
|
-
// then images are not yet transformed
|
|
278
230
|
poi.images = await Zousan.all(
|
|
279
|
-
poi.images.map(imageName => app.bus.get(
|
|
231
|
+
poi.images.map((imageName) => app.bus.get("venueData/getPoiImageUrl", { imageName, size }))
|
|
280
232
|
);
|
|
281
233
|
}
|
|
282
|
-
|
|
283
234
|
if (!R__namespace.length(poi.fullImages)) {
|
|
284
235
|
poi.fullImages = [];
|
|
285
236
|
} else if (!isFullUrl(poi.fullImages[0]?.url)) {
|
|
286
|
-
// then images are not yet transformed
|
|
287
237
|
poi.fullImages = await Zousan.all(
|
|
288
238
|
poi.fullImages.map(async ({ url, ...rest }) => {
|
|
289
|
-
const fullUrl = await app.bus.get(
|
|
239
|
+
const fullUrl = await app.bus.get("venueData/getPoiImageUrl", {
|
|
290
240
|
imageName: url,
|
|
291
|
-
size
|
|
241
|
+
size
|
|
292
242
|
});
|
|
293
243
|
return { url: fullUrl, ...rest };
|
|
294
|
-
})
|
|
244
|
+
})
|
|
295
245
|
);
|
|
296
246
|
}
|
|
297
|
-
|
|
298
247
|
return poi;
|
|
299
248
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
app.bus.on(
|
|
303
|
-
|
|
304
|
-
app.bus.on('venueData/loadNewVenue', () => {
|
|
249
|
+
const getUniqueCategories = R__namespace.memoizeWith(R__namespace.identity, R__namespace.pipe(R__namespace.pluck("category"), R__namespace.values, R__namespace.uniq));
|
|
250
|
+
app.bus.on("poi/getAllCategories", async () => poisLoaded.then(getUniqueCategories));
|
|
251
|
+
app.bus.on("venueData/loadNewVenue", () => {
|
|
305
252
|
poisLoaded = new Zousan();
|
|
306
253
|
init();
|
|
307
254
|
});
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
app.bus.on('poi/setDynamicData', ({ plugin, idValuesMap }) => {
|
|
311
|
-
poisLoaded.then(pois => {
|
|
255
|
+
app.bus.on("poi/setDynamicData", ({ plugin, idValuesMap }) => {
|
|
256
|
+
poisLoaded.then((pois) => {
|
|
312
257
|
for (const poiId in idValuesMap) {
|
|
313
|
-
// const dd = { [plugin]: idValuesMap[poiId] }
|
|
314
258
|
const dynamicData = pois[poiId].dynamicData || {};
|
|
315
259
|
dynamicData[plugin] = { ...idValuesMap[poiId] };
|
|
316
260
|
const newPoi = R__namespace.mergeRight(pois[poiId], { dynamicData });
|
|
@@ -318,60 +262,40 @@ async function create(app) {
|
|
|
318
262
|
}
|
|
319
263
|
});
|
|
320
264
|
});
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
// A null or empty-string name value reverts to the original name stashed before the first override.
|
|
324
|
-
app.bus.on('poi/setCoreAttributes', idAttributesMap => {
|
|
325
|
-
poisLoaded.then(pois => {
|
|
265
|
+
app.bus.on("poi/setCoreAttributes", (idAttributesMap) => {
|
|
266
|
+
poisLoaded.then((pois) => {
|
|
326
267
|
for (const poiId in idAttributesMap) {
|
|
327
268
|
const changed = applyCorePoiAttributes(pois, poiId, idAttributesMap[poiId]);
|
|
328
269
|
if (changed) {
|
|
329
|
-
app.bus.send(
|
|
270
|
+
app.bus.send("map/mutateFeature", { poiId, name: pois[poiId].name });
|
|
330
271
|
}
|
|
331
272
|
}
|
|
332
273
|
});
|
|
333
274
|
});
|
|
334
|
-
|
|
335
|
-
const runTest = async testRoutine => {
|
|
275
|
+
const runTest = async (testRoutine) => {
|
|
336
276
|
await testRoutine();
|
|
337
277
|
return poisLoaded;
|
|
338
278
|
};
|
|
339
|
-
|
|
340
279
|
return {
|
|
341
280
|
init,
|
|
342
281
|
runTest,
|
|
343
282
|
internal: {
|
|
344
283
|
addImages,
|
|
345
284
|
pseudoTransPoi,
|
|
346
|
-
applyCorePoiAttributes
|
|
347
|
-
}
|
|
285
|
+
applyCorePoiAttributes
|
|
286
|
+
}
|
|
348
287
|
};
|
|
349
288
|
}
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Applies or reverts a single POI's core attributes.
|
|
353
|
-
*
|
|
354
|
-
* - A `null` or empty-string name reverts the POI to the original name stashed before the first override.
|
|
355
|
-
* - Any other name value stashes the original (if not already stashed) then applies the override.
|
|
356
|
-
*
|
|
357
|
-
* Returns `true` if the POI's name was changed (so the caller can fire downstream events), `false` otherwise.
|
|
358
|
-
*
|
|
359
|
-
* @param {Object} pois - Mutable map of POI id → POI object.
|
|
360
|
-
* @param {string} poiId - ID of the POI to update.
|
|
361
|
-
* @param {Object} attributes - Attributes to apply (currently supports `name`).
|
|
362
|
-
*/
|
|
363
289
|
function applyCorePoiAttributes(pois, poiId, attributes) {
|
|
364
290
|
if (!pois[poiId]) {
|
|
365
291
|
return false;
|
|
366
292
|
}
|
|
367
293
|
const { name } = attributes;
|
|
368
294
|
if (!name) {
|
|
369
|
-
// Revert: restore original name from before first override (null and "" both revert)
|
|
370
295
|
pois[poiId] = R__namespace.mergeRight(pois[poiId], {
|
|
371
|
-
name: pois[poiId]._originalName ?? pois[poiId].name
|
|
296
|
+
name: pois[poiId]._originalName ?? pois[poiId].name
|
|
372
297
|
});
|
|
373
298
|
} else {
|
|
374
|
-
// First override: stash original name before clobbering
|
|
375
299
|
if (!pois[poiId]._originalName) {
|
|
376
300
|
pois[poiId] = R__namespace.mergeRight(pois[poiId], { _originalName: pois[poiId].name });
|
|
377
301
|
}
|
|
@@ -379,15 +303,14 @@ function applyCorePoiAttributes(pois, poiId, attributes) {
|
|
|
379
303
|
}
|
|
380
304
|
return true;
|
|
381
305
|
}
|
|
382
|
-
|
|
383
306
|
function pseudoTransPoi(poi, lang) {
|
|
384
|
-
[
|
|
307
|
+
["description", "nearbyLandmark", "name", "phone", "operationHours"].forEach((p) => {
|
|
385
308
|
if (poi[p]) {
|
|
386
309
|
poi[p] = i18n.toLang(poi[p], lang);
|
|
387
310
|
}
|
|
388
311
|
});
|
|
389
312
|
if (poi.keywords) {
|
|
390
|
-
poi.keywords = poi.keywords.map(keyword => {
|
|
313
|
+
poi.keywords = poi.keywords.map((keyword) => {
|
|
391
314
|
keyword.name = i18n.toLang(keyword.name, lang);
|
|
392
315
|
return keyword;
|
|
393
316
|
});
|
|
@@ -42,43 +42,35 @@ function prepareSDKConfig(sc) {
|
|
|
42
42
|
pinnedLocationZoom,
|
|
43
43
|
pinnedLocationFocusAtStart,
|
|
44
44
|
pinnedLocationBearing,
|
|
45
|
-
pinnedLocationPitch
|
|
45
|
+
pinnedLocationPitch
|
|
46
46
|
} = sc;
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const validateHostAppProperties = hostAppProperties => {
|
|
55
|
-
if (!hostAppProperties || typeof hostAppProperties !== 'object') {
|
|
56
|
-
return undefined;
|
|
47
|
+
const extendsConfig = parentConfig ? [parentConfig] : headless ? ["sdkHeadless"] : ["sdkVisual"];
|
|
48
|
+
const trunc = (str, len) => str && str.length > len ? str.substring(0, len) : str;
|
|
49
|
+
const validateHostAppId = (hostAppId2) => hostAppId2 ? trunc(hostAppId2.toString(), 128) : void 0;
|
|
50
|
+
const validateHostAppVersion = (hostAppVersion2) => hostAppVersion2 ? trunc(hostAppVersion2.toString(), 128) : void 0;
|
|
51
|
+
const validateHostAppProperties = (hostAppProperties2) => {
|
|
52
|
+
if (!hostAppProperties2 || typeof hostAppProperties2 !== "object") {
|
|
53
|
+
return void 0;
|
|
57
54
|
}
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
const keys = Object.keys(hostAppProperties);
|
|
61
|
-
|
|
55
|
+
const ret = {};
|
|
56
|
+
const keys = Object.keys(hostAppProperties2);
|
|
62
57
|
if (keys.length > 10) {
|
|
63
58
|
keys.length = 10;
|
|
64
59
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
let cleanKey = trunc(key.toString().replaceAll(/[^a-zA-Z0-9_]/g, ''), 128);
|
|
60
|
+
keys.forEach((key) => {
|
|
61
|
+
let cleanKey = trunc(key.toString().replaceAll(/[^a-zA-Z0-9_]/g, ""), 128);
|
|
68
62
|
if (!cleanKey.match(/^[a-zA-Z]+/)) {
|
|
69
|
-
cleanKey =
|
|
70
|
-
}
|
|
71
|
-
let cleanVal =
|
|
72
|
-
if (cleanVal === null || cleanVal ===
|
|
73
|
-
cleanVal =
|
|
63
|
+
cleanKey = "X" + cleanKey;
|
|
64
|
+
}
|
|
65
|
+
let cleanVal = hostAppProperties2[key];
|
|
66
|
+
if (cleanVal === null || cleanVal === void 0) {
|
|
67
|
+
cleanVal = "";
|
|
74
68
|
}
|
|
75
69
|
cleanVal = trunc(cleanVal.toString(), 128);
|
|
76
70
|
ret[cleanKey] = cleanVal;
|
|
77
71
|
});
|
|
78
|
-
|
|
79
72
|
return ret;
|
|
80
73
|
};
|
|
81
|
-
|
|
82
74
|
const config = {
|
|
83
75
|
name,
|
|
84
76
|
engineName,
|
|
@@ -93,116 +85,93 @@ function prepareSDKConfig(sc) {
|
|
|
93
85
|
venueDataLoader: {
|
|
94
86
|
dataFetch,
|
|
95
87
|
venueId,
|
|
96
|
-
accountId
|
|
88
|
+
accountId
|
|
97
89
|
},
|
|
98
90
|
sdkServer: {
|
|
99
|
-
headless
|
|
91
|
+
headless
|
|
100
92
|
},
|
|
101
93
|
analytics2: {
|
|
102
94
|
hostAppId: validateHostAppId(hostAppId),
|
|
103
95
|
hostAppVersion: validateHostAppVersion(hostAppVersion),
|
|
104
|
-
hostAppProperties: validateHostAppProperties(hostAppProperties)
|
|
105
|
-
}
|
|
96
|
+
hostAppProperties: validateHostAppProperties(hostAppProperties)
|
|
97
|
+
}
|
|
106
98
|
},
|
|
107
|
-
uuid: typeof document !==
|
|
99
|
+
uuid: typeof document !== "undefined" && document && document.location ? document.location.host : "unknown"
|
|
100
|
+
// used in analytics
|
|
108
101
|
};
|
|
109
|
-
|
|
110
|
-
if (analytics2ActiveFlag !== undefined) {
|
|
102
|
+
if (analytics2ActiveFlag !== void 0) {
|
|
111
103
|
config.plugins.analytics2.active = analytics2ActiveFlag;
|
|
112
104
|
}
|
|
113
|
-
|
|
114
|
-
// return an object with the named property set to the specified value, unless the
|
|
115
|
-
// value is undefined, then return an empty object
|
|
116
|
-
const setIfDef = (name, value) => (value !== undefined ? { [name]: value } : {});
|
|
117
|
-
|
|
105
|
+
const setIfDef = (name2, value) => value !== void 0 ? { [name2]: value } : {};
|
|
118
106
|
if (!headless) {
|
|
119
|
-
config.plugins[
|
|
107
|
+
config.plugins["online/headerOnline"] = { searchPlaceholder };
|
|
120
108
|
config.plugins.mapRenderer = {
|
|
121
|
-
...setIfDef(
|
|
109
|
+
...setIfDef("enablePoiSelection", enablePoiSelection),
|
|
122
110
|
surroundConfig: showSurround ? {} : null,
|
|
123
111
|
viewLimits: {
|
|
124
|
-
...setIfDef(
|
|
125
|
-
...setIfDef(
|
|
126
|
-
}
|
|
112
|
+
...setIfDef("maxZoom", maxZoom),
|
|
113
|
+
...setIfDef("minZoom", minZoom)
|
|
114
|
+
}
|
|
127
115
|
};
|
|
128
116
|
config.plugins.userMenu = { noLangOptions };
|
|
129
117
|
if (pinnedLocation) {
|
|
130
|
-
config.plugins[
|
|
118
|
+
config.plugins["online/pinnedLocation"] = {
|
|
131
119
|
location: pinnedLocation,
|
|
132
120
|
zoom: pinnedLocationZoom,
|
|
133
121
|
focusAtStart: pinnedLocationFocusAtStart,
|
|
134
122
|
bearing: pinnedLocationBearing,
|
|
135
|
-
pitch: pinnedLocationPitch
|
|
123
|
+
pitch: pinnedLocationPitch
|
|
136
124
|
};
|
|
137
125
|
}
|
|
138
126
|
}
|
|
139
|
-
|
|
140
127
|
config.plugins.searchService = defaultSearchTerms ? { defaultSearchTerms } : {};
|
|
141
|
-
handleI18NParm(sc,
|
|
142
|
-
|
|
143
|
-
if (extendsConfig.includes('sdkVisual')) {
|
|
128
|
+
handleI18NParm(sc, "defaultSearchTerms", config.plugins.searchService);
|
|
129
|
+
if (extendsConfig.includes("sdkVisual")) {
|
|
144
130
|
if (poiCategories) {
|
|
145
|
-
config.plugins[
|
|
131
|
+
config.plugins["online/homeView"] = { poiCategories };
|
|
146
132
|
} else {
|
|
147
|
-
config.plugins[
|
|
133
|
+
config.plugins["online/homeView"] = {};
|
|
148
134
|
}
|
|
149
|
-
handleI18NParm(sc,
|
|
135
|
+
handleI18NParm(sc, "poiCategories", config.plugins["online/homeView"]);
|
|
150
136
|
}
|
|
151
|
-
// Allow *specific* additional plugins
|
|
152
|
-
// for now, this is just for internal use
|
|
153
137
|
if (plugins) {
|
|
154
138
|
if (plugins.draw) {
|
|
155
139
|
config.plugins.draw = plugins.draw;
|
|
156
140
|
}
|
|
157
|
-
// To get flight status working, one needs 3 plugins. This is a bad design, there should just be one and it provides
|
|
158
|
-
// all 3 of these services. Lets migrate to a single plugin at some point - but until then, lets at least make it look
|
|
159
|
-
// like a single plugin for SDK users. The only plugin that currently has configurable properties is "flightStatus" - so
|
|
160
|
-
// lets let SDK users define that one and its single property (apiKey) and we'll just create the other two by default.
|
|
161
141
|
if (plugins.flightStatus) {
|
|
162
142
|
config.plugins.flightStatus = plugins.flightStatus;
|
|
163
|
-
config.plugins[
|
|
164
|
-
config.plugins[
|
|
143
|
+
config.plugins["online/flightDetails"] = {};
|
|
144
|
+
config.plugins["online/flightDetailsSearch"] = {};
|
|
165
145
|
}
|
|
166
146
|
}
|
|
167
|
-
|
|
168
147
|
if (preserveStateInURL) {
|
|
169
|
-
config.configPostProc.push(
|
|
148
|
+
config.configPostProc.push("stateTracking");
|
|
170
149
|
config.plugins.deepLinking = { trackURL: true };
|
|
171
150
|
}
|
|
172
|
-
|
|
173
151
|
if (supportURLDeepLinks) {
|
|
174
|
-
config.configPostProc.push(
|
|
152
|
+
config.configPostProc.push("mol-url-parms");
|
|
175
153
|
}
|
|
176
|
-
|
|
177
154
|
if (initState) {
|
|
178
155
|
postprocStateTracking.setStateFromStateString(config, funcs.b64DecodeUnicode(initState), true);
|
|
179
156
|
}
|
|
180
|
-
|
|
181
157
|
if (deepLinkParms) {
|
|
182
158
|
postprocMolUrlParms.setDeepLinksForParms(config, new URLSearchParams(deepLinkParms), true);
|
|
183
159
|
}
|
|
184
|
-
|
|
185
|
-
if (desktopViewMinWidth !== undefined) {
|
|
160
|
+
if (desktopViewMinWidth !== void 0) {
|
|
186
161
|
config.desktopViewMinWidth = desktopViewMinWidth;
|
|
187
162
|
}
|
|
188
|
-
|
|
189
163
|
if (forceDesktop) {
|
|
190
164
|
config.desktopViewMinWidth = 0;
|
|
191
165
|
}
|
|
192
|
-
|
|
193
166
|
if (dynamicPoisUrlBaseV1) {
|
|
194
167
|
config.plugins.dynamicPois = {
|
|
195
|
-
urlBaseV1: dynamicPoisUrlBaseV1
|
|
168
|
+
urlBaseV1: dynamicPoisUrlBaseV1
|
|
196
169
|
};
|
|
197
170
|
}
|
|
198
|
-
|
|
199
|
-
return funcs.filterOb((k, v) => v !== undefined, config); // remove any undefined values
|
|
171
|
+
return funcs.filterOb((k, v) => v !== void 0, config);
|
|
200
172
|
}
|
|
201
|
-
|
|
202
173
|
function handleI18NParm(sdkConfig, prefix, configDest) {
|
|
203
|
-
Object.keys(sdkConfig)
|
|
204
|
-
.filter(key => key.startsWith(prefix + '-'))
|
|
205
|
-
.forEach(key => (configDest[key] = sdkConfig[key]));
|
|
174
|
+
Object.keys(sdkConfig).filter((key) => key.startsWith(prefix + "-")).forEach((key) => configDest[key] = sdkConfig[key]);
|
|
206
175
|
}
|
|
207
176
|
|
|
208
177
|
module.exports = prepareSDKConfig;
|