atriusmaps-node-sdk 3.3.897 → 3.3.899

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