atriusmaps-node-sdk 3.3.898 → 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 (62) 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 +77 -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/sdkServer/src/prepareSDKConfig.js +1 -1
  60. package/dist/src/utils/buildStructureLookup.js +1 -1
  61. package/dist/src/utils/date.js +1 -1
  62. package/package.json +1 -1
@@ -9,76 +9,23 @@ var geodesy = require('../../../src/utils/geodesy.js');
9
9
  var segmentBadges = require('./segmentBadges.js');
10
10
  var segmentCategories = require('./segmentCategories.js');
11
11
 
12
- /**
13
- * Calculate the general direction of a segment based on its waypoints.
14
- * @param {Object} segment - The segment object.
15
- * @param {Array} segment.waypoints - An array of waypoints.
16
- * waypoint {
17
- * position: { lat, lng, floorId, ordinal, structureId },
18
- * }
19
- * @returns {string} - The general direction of the segment.
20
- */
21
-
22
12
  const calculateSegmentGeneralDirection = ({ waypoints }, T) => {
23
13
  const [firstWaypoint] = waypoints;
24
14
  const lastWaypoint = waypoints[waypoints.length - 1];
25
15
  const from = helpers.point([firstWaypoint.position.lng, firstWaypoint.position.lat]);
26
16
  const to = helpers.point([lastWaypoint.position.lng, lastWaypoint.position.lat]);
27
17
  const bearingDegrees = bearing.bearing(from, to);
28
- // Convert bearing to general direction
29
- return geodesy.bearingToDirection(bearingDegrees, T); // returns cardinal direction 'north', 'northeast' etc as a string
18
+ return geodesy.bearingToDirection(bearingDegrees, T);
30
19
  };
31
-
32
- /**
33
- * @typedef Step
34
- * @property {string} primaryText
35
- * @property {string} secondaryText
36
- * @property {string} icon
37
- * @property {Position} animationAnchor
38
- * @property {number} eta
39
- * @property {number} distance
40
- * @property {boolean} isAccessible
41
- * @property {Bounds} bounds
42
- * @property {SecurityWaitTime} securityWaitTimes
43
- *
44
- * @typedef Position
45
- * @property {number} lat
46
- * @property {number} lng
47
- * @property {string} floorId
48
- * @property {number} ordinal
49
- * @property {string} structureId
50
- *
51
- * @param {Segment[]} segments
52
- * @param {string} startName
53
- * @param {string} destinationName
54
- * @param floorIdToNameMap
55
- * @param {function} T - translate function
56
- * @param {QueueTypes} queueTypes
57
- * @param {boolean} requiresAccessibility
58
- * @return {Step[]} steps - list of navigation steps
59
- */
60
- function getSteps(
61
- segments,
62
- startName = '',
63
- destinationName = '',
64
- floorIdToNameMap,
65
- T,
66
- queueTypes = {},
67
- requiresAccessibility,
68
- securityPois = [],
69
- currentUnits,
70
- ) {
20
+ function getSteps(segments, startName = "", destinationName = "", floorIdToNameMap, T, queueTypes = {}, requiresAccessibility, securityPois = [], currentUnits) {
71
21
  return segments.map((segment, index) => {
72
- const securityWaitTimes = findPropWaypoints('securityWaitTimes')(segment.waypoints);
73
- const eta =
74
- securityWaitTimes && !securityWaitTimes.isTemporarilyClosed // if there is dynamic wait time and checkpoint is open, then use it
75
- ? securityWaitTimes.queueTime
76
- : Math.round(calculateSegmentEta(segment.waypoints));
77
- const distance$1 = Math.round(calculateSegmentDistance(segment.waypoints)); // this is meters
78
- const currentUnitsDistance = currentUnits === 'yards' ? distance.metersToYards(distance$1) : distance$1;
22
+ const securityWaitTimes = findPropWaypoints("securityWaitTimes")(segment.waypoints);
23
+ const eta = securityWaitTimes && !securityWaitTimes.isTemporarilyClosed ? securityWaitTimes.queueTime : Math.round(calculateSegmentEta(segment.waypoints));
24
+ const distance$1 = Math.round(calculateSegmentDistance(segment.waypoints));
25
+ const currentUnitsDistance = currentUnits === "yards" ? distance.metersToYards(distance$1) : distance$1;
79
26
  const icon = getIcon(segment.segmentCategory);
80
27
  const animationAnchor = getAnimationAnchor(segment.segmentCategory, segment.waypoints);
81
- const direction = calculateSegmentGeneralDirection(segment, T); // returns string like 'north', 'southwest', etc.
28
+ const direction = calculateSegmentGeneralDirection(segment, T);
82
29
  const primaryText = getPrimaryText(
83
30
  segments,
84
31
  index,
@@ -87,13 +34,12 @@ function getSteps(
87
34
  floorIdToNameMap,
88
35
  T,
89
36
  securityPois,
90
- queueTypes,
37
+ queueTypes
91
38
  );
92
- const secondaryText = getSecondaryText(segment, eta, T, false); // this is old but apparently relied on by customers using JS SDK and Mobile SDK
93
- const secondaryTextUI = getSecondaryText(segment, eta, T, true, direction, currentUnits, currentUnitsDistance); // this is used in Webengine UI
39
+ const secondaryText = getSecondaryText(segment, eta, T, false);
40
+ const secondaryTextUI = getSecondaryText(segment, eta, T, true, direction, currentUnits, currentUnitsDistance);
94
41
  const bounds$1 = bounds.findBoundsOfWaypoints(segment.waypoints);
95
42
  const isAccessible = checkIfAccessible(segment);
96
-
97
43
  const step = {
98
44
  primaryText,
99
45
  secondaryText,
@@ -104,37 +50,26 @@ function getSteps(
104
50
  distance: distance$1,
105
51
  bounds: bounds$1,
106
52
  isAccessible,
107
- securityWaitTimes,
53
+ securityWaitTimes
108
54
  };
109
-
110
55
  if (segment.poiId) {
111
56
  step.poiId = segment.poiId;
112
57
  }
113
-
114
58
  return step;
115
59
  });
116
60
  }
117
-
118
61
  function calculateSegmentEta(waypoints) {
119
62
  if (waypoints.length === 1) {
120
63
  return waypoints[0].eta;
121
- } // for stairs/elevator segments. should be removed once segment builder will be refactored to not append waypoint from previous semgnent
122
- return waypoints
123
- .map(R.prop('eta'))
124
- .slice(1) // first waypoint is end of previous segment and is added only to connect segments for navline calculation
125
- .reduce((segmentEta, eta) => segmentEta + eta, 0.0);
64
+ }
65
+ return waypoints.map(R.prop("eta")).slice(1).reduce((segmentEta, eta) => segmentEta + eta, 0);
126
66
  }
127
-
128
67
  function calculateSegmentDistance(waypoints) {
129
68
  if (waypoints.length === 1) {
130
69
  return waypoints[0].distance;
131
- } // for stairs/elevator segments. should be removed once segment builder will be refactored to not append waypoint from previous semgnent
132
- return waypoints
133
- .map(waypoint => waypoint.distance)
134
- .slice(1) // first waypoint is end of previous segment and is added only to connect segments for navline calculation
135
- .reduce((segmentDistance, distance) => segmentDistance + distance, 0.0);
70
+ }
71
+ return waypoints.map((waypoint) => waypoint.distance).slice(1).reduce((segmentDistance, distance) => segmentDistance + distance, 0);
136
72
  }
137
-
138
73
  function getIcon(segmentCategory) {
139
74
  switch (segmentCategory) {
140
75
  case segmentCategories.START:
@@ -194,7 +129,6 @@ function getIcon(segmentCategory) {
194
129
  return segmentBadges.WALK;
195
130
  }
196
131
  }
197
-
198
132
  function getAnimationAnchor(segmentCategory, waypoints) {
199
133
  let index;
200
134
  switch (segmentCategory) {
@@ -212,7 +146,6 @@ function getAnimationAnchor(segmentCategory, waypoints) {
212
146
  }
213
147
  return waypoints[index].position;
214
148
  }
215
-
216
149
  function getPrimaryText(segments, index, startName, destinationName, floorIdToNameMap, T, securityPois, queueTypes) {
217
150
  const segment = segments[index];
218
151
  switch (segment.segmentCategory) {
@@ -224,9 +157,8 @@ function getPrimaryText(segments, index, startName, destinationName, floorIdToNa
224
157
  const lookAheadWaypoints = segments[index + 1].waypoints;
225
158
  const laneName = getSecurityLaneName(queueTypes, lookAheadWaypoints);
226
159
  const securityLane = laneName ? T(`wayfinder:Security Lane`, { laneName }) : null;
227
-
228
160
  const poiTitle = getClosestSecurityPoiTitle(lookAheadWaypoints, securityPois);
229
- const displayName = securityLane || poiTitle; // Use laneName if defined; otherwise, poiTitle
161
+ const displayName = securityLane || poiTitle;
230
162
  return displayName || T(`wayfinder:${segment.type}`);
231
163
  }
232
164
  case segmentCategories.WALKING_TO_PORTAL:
@@ -235,7 +167,7 @@ function getPrimaryText(segments, index, startName, destinationName, floorIdToNa
235
167
  const laneName = getSecurityLaneName(queueTypes, segment.waypoints);
236
168
  const securityLane = laneName ? T(`wayfinder:Security Lane`, { laneName }) : null;
237
169
  const poiTitle = getClosestSecurityPoiTitle(segment.waypoints, securityPois);
238
- const displayName = securityLane || poiTitle; // Use securityLane if defined; otherwise, poiTitle
170
+ const displayName = securityLane || poiTitle;
239
171
  return displayName || getLevelName(segment, floorIdToNameMap);
240
172
  }
241
173
  case segmentCategories.ELEVATOR:
@@ -255,49 +187,45 @@ function getPrimaryText(segments, index, startName, destinationName, floorIdToNa
255
187
  return T(`wayfinder:${segment.type}`);
256
188
  }
257
189
  }
258
-
259
190
  function getPositionName(position, poiName) {
260
191
  if (position.name) {
261
192
  return position.name;
262
193
  }
263
194
  return poiName;
264
195
  }
265
-
266
196
  function getLevelName(segment, floorIdToNameMap) {
267
197
  return floorIdToNameMap[R.last(segment.waypoints).position.floorId];
268
198
  }
269
-
270
199
  function getSecondaryText(segment, minutes, T, ui, direction, currentUnits, currentUnitsDistance) {
271
200
  const zeroOrOtherKeys = translateZeroOrOther(minutes, T);
272
-
273
- const travelVerb = 'Proceed';
201
+ const travelVerb = "Proceed";
274
202
  switch (segment.segmentCategory) {
275
203
  case segmentCategories.START:
276
- return T('wayfinder:Begin route at');
204
+ return T("wayfinder:Begin route at");
277
205
  case segmentCategories.ELEVATOR:
278
- return T('wayfinder:Take elevator to');
206
+ return T("wayfinder:Take elevator to");
279
207
  case segmentCategories.ELEVATOR_UP:
280
- return T('wayfinder:Take elevator up to');
208
+ return T("wayfinder:Take elevator up to");
281
209
  case segmentCategories.ELEVATOR_DOWN:
282
- return T('wayfinder:Take elevator down to');
210
+ return T("wayfinder:Take elevator down to");
283
211
  case segmentCategories.STAIRS:
284
- return T('wayfinder:Take stairs to');
212
+ return T("wayfinder:Take stairs to");
285
213
  case segmentCategories.STAIRS_UP:
286
- return T('wayfinder:Take stairs up to');
214
+ return T("wayfinder:Take stairs up to");
287
215
  case segmentCategories.STAIRS_DOWN:
288
- return T('wayfinder:Take stairs down to');
216
+ return T("wayfinder:Take stairs down to");
289
217
  case segmentCategories.ACCESSIBLE_STAIRS:
290
- return T('wayfinder:Take accessible stairs to');
218
+ return T("wayfinder:Take accessible stairs to");
291
219
  case segmentCategories.ACCESSIBLE_STAIRS_UP:
292
- return T('wayfinder:Take accessible stairs up to');
220
+ return T("wayfinder:Take accessible stairs up to");
293
221
  case segmentCategories.ACCESSIBLE_STAIRS_DOWN:
294
- return T('wayfinder:Take accessible stairs down to');
222
+ return T("wayfinder:Take accessible stairs down to");
295
223
  case segmentCategories.ESCALATOR:
296
- return T('wayfinder:Take escalator to');
224
+ return T("wayfinder:Take escalator to");
297
225
  case segmentCategories.ESCALATOR_UP:
298
- return T('wayfinder:Take escalator up to');
226
+ return T("wayfinder:Take escalator up to");
299
227
  case segmentCategories.ESCALATOR_DOWN:
300
- return T('wayfinder:Take escalator down to');
228
+ return T("wayfinder:Take escalator down to");
301
229
  case segmentCategories.WALK:
302
230
  case segmentCategories.WALKING_TO_SECURITY_CHECKPOINT:
303
231
  case segmentCategories.WALKING_TO_PORTAL:
@@ -313,73 +241,53 @@ function getSecondaryText(segment, minutes, T, ui, direction, currentUnits, curr
313
241
  case segmentCategories.WALK_UP:
314
242
  return zeroOrOtherKeys(`${travelVerb} <1 minute up to`, `${travelVerb} xx minute up to`);
315
243
  case segmentCategories.TRAIN:
316
- return zeroOrOtherKeys('Take train <1 minute', 'Take train xx minute');
244
+ return zeroOrOtherKeys("Take train <1 minute", "Take train xx minute");
317
245
  case segmentCategories.BUS:
318
- return zeroOrOtherKeys('Take bus <1 minute', 'Take bus xx minute');
246
+ return zeroOrOtherKeys("Take bus <1 minute", "Take bus xx minute");
319
247
  case segmentCategories.SECURITY_CHECKPOINT: {
320
- return T('wayfinder:Through');
248
+ return T("wayfinder:Through");
321
249
  }
322
250
  case segmentCategories.RAMP:
323
- return T('wayfinder:Take ramp to');
251
+ return T("wayfinder:Take ramp to");
324
252
  case segmentCategories.RAMP_UP:
325
- return T('wayfinder:Take ramp up to');
253
+ return T("wayfinder:Take ramp up to");
326
254
  case segmentCategories.RAMP_DOWN:
327
- return T('wayfinder:Take ramp down to');
255
+ return T("wayfinder:Take ramp down to");
328
256
  default:
329
- return '';
257
+ return "";
330
258
  }
331
259
  }
332
-
333
260
  const createSecondaryTextWithHeading = (currentUnitsDistance, currentUnits, direction, T) => {
334
- return currentUnits === 'meters'
335
- ? T(`wayfinder:Proceed __direction__ __count__ meter to`, {
336
- direction,
337
- count: currentUnitsDistance,
338
- })
339
- : T(`wayfinder:Proceed __direction__ __count__ yard to`, {
340
- direction,
341
- count: currentUnitsDistance,
342
- });
261
+ return currentUnits === "meters" ? T(`wayfinder:Proceed __direction__ __count__ meter to`, {
262
+ direction,
263
+ count: currentUnitsDistance
264
+ }) : T(`wayfinder:Proceed __direction__ __count__ yard to`, {
265
+ direction,
266
+ count: currentUnitsDistance
267
+ });
343
268
  };
344
-
345
- const translateZeroOrOther = (count, T) => (zeroKey, otherKey) =>
346
- count === 0 ? T('wayfinder:' + zeroKey) : T('wayfinder:' + otherKey, { count });
347
-
348
- const checkIfAccessible = R.compose(R.not, R.includes(R.__, ['escalator', 'stairs']), R.toLower, R.prop('type'));
349
-
269
+ const translateZeroOrOther = (count, T) => (zeroKey, otherKey) => count === 0 ? T("wayfinder:" + zeroKey) : T("wayfinder:" + otherKey, { count });
270
+ const checkIfAccessible = R.compose(R.not, R.includes(R.__, ["escalator", "stairs"]), R.toLower, R.prop("type"));
350
271
  const getSecurityLaneName = (queueTypes, waypoints) => {
351
- const lane = findPropWaypoints('securityLane')(waypoints);
272
+ const lane = findPropWaypoints("securityLane")(waypoints);
352
273
  if (!lane) {
353
274
  return;
354
275
  }
355
276
  const types = R.prop(lane.type, queueTypes);
356
- const laneType = R.find(R.propEq(lane.id, 'id'), types);
357
- return R.prop('displayText', laneType);
277
+ const laneType = R.find(R.propEq(lane.id, "id"), types);
278
+ return R.prop("displayText", laneType);
358
279
  };
359
-
360
- const findPropWaypoints = propName => R.compose(R.prop(propName), R.find(R.prop(propName)), R.drop(1)); // because first waypoint is the end of previous segment and can be security checkpoint
361
-
362
- /**
363
- * Given an array of waypoints (with exactly one having portalType "Security Checkpoint")
364
- * and an array of securityPois, this function uses the checkpoint's position
365
- * to determine the closest security POI.
366
- *
367
- * @param {Array} waypoints - Array of waypoint objects.
368
- * @param {Array} securityPois - Array of security POI objects.
369
- * @returns {string|null} - The name of the closest security POI, or null if none found.
370
- */
280
+ const findPropWaypoints = (propName) => R.compose(R.prop(propName), R.find(R.prop(propName)), R.drop(1));
371
281
  const getClosestSecurityPoiTitle = (waypoints, securityPois) => {
372
282
  if (!waypoints || waypoints.length === 0) {
373
283
  return null;
374
284
  }
375
-
376
285
  const checkpointWaypoint = waypoints[0];
377
286
  const { lat, lng, floorId } = checkpointWaypoint.position;
378
- // Use all POIs with a valid position on the same floor as the checkpoint.
379
- const sameFloorCandidates = securityPois.filter(poi => poi.position && poi.position.floorId === floorId);
287
+ const sameFloorCandidates = securityPois.filter((poi) => poi.position && poi.position.floorId === floorId);
380
288
  let closest = null;
381
289
  let minDistance = Infinity;
382
- sameFloorCandidates.forEach(poi => {
290
+ sameFloorCandidates.forEach((poi) => {
383
291
  const d = geodesy.distance(lat, lng, poi.position.latitude, poi.position.longitude);
384
292
  if (d < minDistance) {
385
293
  minDistance = d;