atriusmaps-node-sdk 3.3.387 → 3.3.388

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var name = "web-engine";
6
- var version = "3.3.387";
6
+ var version = "3.3.388";
7
7
  var license = "UNLICENSED";
8
8
  var type = "module";
9
9
  var main = "src/main.js";
@@ -217,7 +217,7 @@ const getSegmentType = (segment) => {
217
217
  * @param {boolean} requiresAccessibility
218
218
  * @return {{steps: Step[], segments: Segment[]}}
219
219
  */
220
- const buildSegments = (waypoints, fromEndpoint, toEndpoint, floorIdToNameMap, T, queueTypes, requiresAccessibility) => {
220
+ const buildSegments = (waypoints, fromEndpoint, toEndpoint, floorIdToNameMap, T, queueTypes, requiresAccessibility, securityPois) => {
221
221
  let rawSegments = createSegments(waypoints);
222
222
  rawSegments = addCurveLineCoordinates(rawSegments);
223
223
 
@@ -259,7 +259,7 @@ const buildSegments = (waypoints, fromEndpoint, toEndpoint, floorIdToNameMap, T,
259
259
  return cookedSegment
260
260
  });
261
261
 
262
- const steps = stepBuilder(rawSegments, R__namespace.prop('title', fromEndpoint), R__namespace.prop('title', toEndpoint), floorIdToNameMap, T, queueTypes);
262
+ const steps = stepBuilder(rawSegments, R__namespace.prop('title', fromEndpoint), R__namespace.prop('title', toEndpoint), floorIdToNameMap, T, queueTypes, requiresAccessibility, securityPois);
263
263
 
264
264
  return { segments, steps }
265
265
  };
@@ -2,6 +2,7 @@
2
2
 
3
3
  var R = require('ramda');
4
4
  var bounds = require('../../../src/utils/bounds.js');
5
+ var geodesy = require('../../../src/utils/geodesy.js');
5
6
  var segmentBadges = require('./segmentBadges.js');
6
7
  var segmentCategories = require('./segmentCategories.js');
7
8
 
@@ -33,7 +34,7 @@ var segmentCategories = require('./segmentCategories.js');
33
34
  * @param {boolean} requiresAccessibility
34
35
  * @return {Step[]} steps - list of navigation steps
35
36
  */
36
- function getSteps (segments, startName = '', destinationName = '', floorIdToNameMap, T, queueTypes = {}, requiresAccessibility) {
37
+ function getSteps (segments, startName = '', destinationName = '', floorIdToNameMap, T, queueTypes = {}, requiresAccessibility, securityPois = []) {
37
38
  return segments.map((segment, index) => {
38
39
  const securityWaitTimes = findPropWaypoints('securityWaitTimes')(segment.waypoints);
39
40
  const eta = (securityWaitTimes && !securityWaitTimes.isTemporarilyClosed) // if there is dynamic wait time and checkpoint is open, then use it
@@ -42,9 +43,8 @@ function getSteps (segments, startName = '', destinationName = '', floorIdToName
42
43
  const distance = Math.round(calculateSegmentDistance(segment.waypoints));
43
44
  const icon = getIcon(segment.segmentCategory);
44
45
  const animationAnchor = getAnimationAnchor(segment.segmentCategory, segment.waypoints);
45
- const primaryText = getPrimaryText(segments, index, startName, destinationName, floorIdToNameMap, T);
46
- const securityLaneName = getSecurityLaneName(queueTypes, segment.waypoints);
47
- const secondaryText = getSecondaryText(segment, eta, securityLaneName, T);
46
+ const primaryText = getPrimaryText(segments, index, startName, destinationName, floorIdToNameMap, T, securityPois, queueTypes);
47
+ const secondaryText = getSecondaryText(segment, eta, T);
48
48
  const bounds$1 = bounds.findBoundsOfWaypoints(segment.waypoints);
49
49
  const isAccessible = checkIfAccessible(segment);
50
50
 
@@ -155,17 +155,33 @@ function getAnimationAnchor (segmentCategory, waypoints) {
155
155
  return waypoints[index].position
156
156
  }
157
157
 
158
- function getPrimaryText (segments, index, startName, destinationName, floorIdToNameMap, T) {
158
+ function getPrimaryText (segments, index, startName, destinationName, floorIdToNameMap, T, securityPois, queueTypes) {
159
159
  const segment = segments[index];
160
160
  switch (segment.segmentCategory) {
161
161
  case segmentCategories.START:
162
162
  return getPositionName(segment.waypoints[0].position, startName)
163
163
  case segmentCategories.WALKING_TO_END:
164
164
  return getPositionName(segment.waypoints[segment.waypoints.length - 1].position, destinationName)
165
- case segmentCategories.WALKING_TO_SECURITY_CHECKPOINT:
165
+ case segmentCategories.WALKING_TO_SECURITY_CHECKPOINT: {
166
+ const lookAheadWaypoints = segments[index + 1].waypoints;
167
+ const laneName = getSecurityLaneName(queueTypes, lookAheadWaypoints);
168
+ const translated = T(`wayfinder:Security Lane`);
169
+ const securityLane = laneName ? `${laneName} ${translated}` : null; // add translation
170
+
171
+ const poiTitle = getClosestSecurityPoiTitle(lookAheadWaypoints, securityPois);
172
+ const displayName = securityLane || poiTitle; // Use laneName if defined; otherwise, poiTitle
173
+ return displayName || T(`wayfinder:${segment.type}`)
174
+ }
166
175
  case segmentCategories.WALKING_TO_PORTAL:
167
176
  return T(`wayfinder:${segments[index + 1].type}`)
168
- case segmentCategories.SECURITY_CHECKPOINT:
177
+ case segmentCategories.SECURITY_CHECKPOINT: {
178
+ const laneName = getSecurityLaneName(queueTypes, segment.waypoints);
179
+ const translated = T(`wayfinder:Security Lane`);
180
+ const securityLane = laneName ? `${laneName} ${translated}` : null;
181
+ const poiTitle = getClosestSecurityPoiTitle(segment.waypoints, securityPois);
182
+ const displayName = securityLane || poiTitle; // Use securityLane if defined; otherwise, poiTitle
183
+ return displayName || getLevelName(segment, floorIdToNameMap)
184
+ }
169
185
  case segmentCategories.ELEVATOR:
170
186
  case segmentCategories.ELEVATOR_DOWN:
171
187
  case segmentCategories.ELEVATOR_UP:
@@ -189,7 +205,7 @@ function getLevelName (segment, floorIdToNameMap) {
189
205
  return floorIdToNameMap[R.last(segment.waypoints).position.floorId]
190
206
  }
191
207
 
192
- function getSecondaryText (segment, minutes, securityLaneName, T, requiresAccessibility) {
208
+ function getSecondaryText (segment, minutes, T) {
193
209
  const zeroOrOtherKeys = translateZeroOrOther(minutes, T);
194
210
  const travelVerb = 'Proceed';
195
211
  switch (segment.segmentCategory) {
@@ -209,12 +225,11 @@ function getSecondaryText (segment, minutes, securityLaneName, T, requiresAccess
209
225
  case segmentCategories.WALKING_TO_END: return zeroOrOtherKeys(`${travelVerb} <1 minute to`, `${travelVerb} xx minute to`)
210
226
  case segmentCategories.WALK_DOWN: return zeroOrOtherKeys(`${travelVerb} <1 minute down to`, `${travelVerb} xx minute down to`)
211
227
  case segmentCategories.WALK_UP: return zeroOrOtherKeys(`${travelVerb} <1 minute up to`, `${travelVerb} xx minute up to`)
212
- // todo add stops for train and bus if needed
213
228
  case segmentCategories.TRAIN: return zeroOrOtherKeys('Take train <1 minute', 'Take train xx minute')
214
229
  case segmentCategories.BUS: return zeroOrOtherKeys('Take bus <1 minute', 'Take bus xx minute')
215
- case segmentCategories.SECURITY_CHECKPOINT: return securityLaneName
216
- ? T('wayfinder:Through _security_ to', { name: securityLaneName })
217
- : T('wayfinder:Through security to')
230
+ case segmentCategories.SECURITY_CHECKPOINT: {
231
+ return T('wayfinder:Through')
232
+ }
218
233
  case segmentCategories.RAMP: return T('wayfinder:Take ramp to')
219
234
  case segmentCategories.RAMP_UP: return T('wayfinder:Take ramp up to')
220
235
  case segmentCategories.RAMP_DOWN: return T('wayfinder:Take ramp down to')
@@ -242,4 +257,39 @@ const findPropWaypoints = propName => R.compose(
242
257
  R.find(R.prop(propName)),
243
258
  R.drop(1)); // because first waypoint is the end of previous segment and can be security checkpoint
244
259
 
260
+ /**
261
+ * Given an array of waypoints (with exactly one having portalType "Security Checkpoint")
262
+ * and an array of securityPois, this function uses the checkpoint's position
263
+ * to determine the closest security POI.
264
+ *
265
+ * @param {Array} waypoints - Array of waypoint objects.
266
+ * @param {Array} securityPois - Array of security POI objects.
267
+ * @returns {string|null} - The name of the closest security POI, or null if none found.
268
+ */
269
+ const getClosestSecurityPoiTitle = (waypoints, securityPois) => {
270
+ if (!waypoints || waypoints.length === 0) return null
271
+
272
+ const checkpointWaypoint = waypoints[0];
273
+ const { lat, lng, floorId } = checkpointWaypoint.position;
274
+ // Use all POIs with a valid position on the same floor as the checkpoint.
275
+ const sameFloorCandidates = securityPois.filter(
276
+ poi => poi.position && poi.position.floorId === floorId
277
+ );
278
+ let closest = null;
279
+ let minDistance = Infinity;
280
+ sameFloorCandidates.forEach(poi => {
281
+ const d = geodesy.distance(
282
+ lat,
283
+ lng,
284
+ poi.position.latitude,
285
+ poi.position.longitude
286
+ );
287
+ if (d < minDistance) {
288
+ minDistance = d;
289
+ closest = poi;
290
+ }
291
+ });
292
+ return closest ? closest.name : null
293
+ };
294
+
245
295
  module.exports = getSteps;
@@ -295,6 +295,13 @@ function create (app, config) {
295
295
  * @return {(Route|null)} route - route or null if no route available
296
296
  */
297
297
  async function getRoute ({ fromEndpoint, toEndpoint, options = {} }) {
298
+ const rawPois = await app.bus.get('poi/getAll') || {};
299
+ // Extract the POI objects (assuming rawPois is an array with one object)
300
+ const allPois = Array.isArray(rawPois) ? rawPois[0] : rawPois;
301
+ // Convert the object values to an array and filter by category
302
+ const securityPois = Object.values(allPois).filter(
303
+ poi => poi.category && poi.category.startsWith('security')
304
+ );
298
305
  return graphLoadedProm
299
306
  .then(async graph => {
300
307
  options.compareFindPaths = config.compareFindPaths;
@@ -305,14 +312,16 @@ function create (app, config) {
305
312
  const floorIdToNameMap = await app.bus.get('venueData/getFloorIdToNameMap');
306
313
  const queueTypes = await app.bus.get('venueData/getQueueTypes');
307
314
  const translate = app.gt();
308
- options.requiresAccessibility;
315
+ const isAccessible = options.requiresAccessibility;
309
316
  const { steps, segments } = segmentBuilder.buildSegments(
310
317
  route.waypoints,
311
318
  fromEndpoint,
312
319
  toEndpoint,
313
320
  floorIdToNameMap,
314
321
  translate,
315
- queueTypes);
322
+ queueTypes,
323
+ isAccessible,
324
+ securityPois);
316
325
 
317
326
  log.info('route', route);
318
327
  const time = Math.round(route.waypoints.reduce((total, { eta }) => total + eta, 0));
@@ -1 +1 @@
1
- var e="web-engine",s="3.3.387",o="UNLICENSED",l="module",t="src/main.js",r=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],a={colors:"cat utils/colors1.txt && node utils/processColors.js | pbcopy && cat utils/colors2.txt","cypress:a11y":"APPLITOOLS_IS_DISABLED=true && cypress open --browser chrome --env INPUT_MODALITY='keyboard'","cypress:comp":"APPLITOOLS_IS_DISABLED=true && cypress open --component --browser chrome","cypress:e2e":"APPLITOOLS_IS_DISABLED=true && cypress open --e2e --browser chrome",demo:"cd demo/ && yarn start","e2e:comp":"cypress run --component","e2e:record":"yarn cypress run --env RECORD_MODE=true",e2eSDKTest:"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./cypress/e2e/sdk && npx http-server' 8080 'yarn cypress run --spec cypress/e2e/sdk/**'",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh",i18nOverrides:"yarn node utils/i18nOverrideCli src/i18n src/i18n-overrides",lint:"eslint .",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol",prepare:"husky install",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:vitest":"vitest"},i=["defaults"],n={react:"^18.3.1"},c={"@azure/event-hubs":"^5.12.2","@dnd-kit/core":"^6.1.0","@dnd-kit/modifiers":"^7.0.0","@dnd-kit/sortable":"^8.0.0","@dnd-kit/utilities":"^3.2.2","@locus-labs/mod-badge":"^0.1.102","@locus-labs/mod-default-theme":"^0.0.113","@locus-labs/mod-footer":"^0.0.111","@locus-labs/mod-header":"^0.0.105","@locus-labs/mod-location-marker":"^0.0.104","@locus-labs/mod-map-legend":"^0.0.104","@locus-labs/mod-offscreen-indicator":"^0.0.104","@locus-labs/mod-pin":"^0.0.104","@locus-labs/mod-qr-code-card":"^0.0.104","@locus-labs/mod-qr-code-window":"^0.0.105","@locus-labs/mod-walk-time-matrix":"^0.0.103","@locus-labs/mol-desktop-building-level-selector":"^0.1.119","@locus-labs/mol-desktop-compass":"^0.1.120","@locus-labs/mol-desktop-default-theme":"^0.2.105","@locus-labs/mol-desktop-icon":"^0.1.131","@locus-labs/mol-desktop-logo":"^0.1.101","@locus-labs/mol-desktop-map-nav-button":"^0.1.130","@locus-labs/mol-desktop-tooltip":"^0.3.102","@locus-labs/mol-desktop-zoom-control":"^0.1.141","@locus-labs/mol-mobile-box":"^0.1.115","@locus-labs/mol-mobile-floating-action-button":"^0.0.117","@locus-labs/mol-mobile-icon":"^0.1.118","@locus-labs/mol-mobile-text":"^0.1.116","@locus-labs/mol-mobile-toast":"^0.1.102","@mapbox/mapbox-gl-draw":"^1.4.3","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.4","@turf/circle":"^6.5.0","@turf/helpers":"^6.5.0","@turf/point-to-line-distance":"^6.5.0","@vitejs/plugin-react":"^4.0.1","axe-core":"^4.9.0",browserslist:"^4.24.2","crypto-browserify":"^3.12.0","cypress-axe":"^1.5.0","cypress-multi-reporters":"^1.6.4","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^20.3.4","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"6.0.1",jsdom:"^25.0.1",jsonschema:"^1.2.6",luxon:"^3.3.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^1.6.0","mocha-junit-reporter":"^2.2.1",mochawesome:"^7.1.3","node-polyfill-webpack-plugin":"^1.1.4","path-browserify":"^1.0.1",polished:"^4.0.2","prop-types":"^15.7.2","query-string":"^8.1.0",ramda:"^0.30.1",react:"^18.3.1","react-compound-slider":"^3.3.1","react-dom":"^18.3.1","react-json-editor-ajrm":"^2.5.13","react-qr-svg":"^2.2.1","react-svg":"^16.1.29","react-virtualized-auto-sizer":"^1.0.2","react-window":"^1.8.11","smoothscroll-polyfill":"^0.4.4","styled-components":"^6.1.14","styled-normalize":"^8.0.6","throttle-debounce":"^3.0.1",trackjs:"^3.7.4","ua-parser-js":"^0.7.23",uuid:"3.3.2",zousan:"^3.0.1","zousan-plus":"^4.0.1"},p={"@applitools/eyes-cypress":"^3.47.0","@babel/core":"^7.26.0","@babel/eslint-parser":"^7.25.9","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-syntax-import-assertions":"^7.26.0","@babel/plugin-transform-modules-commonjs":"^7.25.9","@babel/plugin-transform-runtime":"^7.25.9","@babel/preset-env":"^7.26.0","@babel/preset-react":"^7.25.9","@testing-library/jest-dom":"^6.6.3","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^7.13.0","@typescript-eslint/parser":"^7.13.0","babel-jest":"^27.0.6","babel-loader":"^8.2.2","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^5.0.0","babel-plugin-styled-components":"^2.1.4","babel-polyfill":"^6.26.0","chai-colors":"^1.0.1","css-loader":"^5.2.4",cypress:"^12.17.2","cypress-browser-permissions":"^1.1.0","cypress-real-events":"^1.11.0","cypress-wait-until":"^1.7.1",eslint:"^8.57.0","eslint-config-standard":"^16.0.3","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-cypress":"^2.11.1","eslint-plugin-import":"^2.16.0","eslint-plugin-jest":"^28.6.0","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.1.0","eslint-plugin-react":"^7.12.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.3.0",glob:"^10.3.3",husky:"^6.0.0",jest:"29.7.0","jest-environment-jsdom":"^29.7.0","lint-staged":"^11.0.1","node-fetch":"^2.6.0","null-loader":"^4.0.1",nx:"19.4.2","nx-remotecache-azure":"^19.0.0","start-server-and-test":"^2.0.0",typescript:"^5.4.5",vite:"^4.3.9",vitest:"^2.1.5",webpack:"^5.96.1","webpack-merge":"^6.0.1"},d="yarn@4.3.1",m={node:"20.x"},u={},b={name:e,version:s,private:!0,license:o,type:l,main:t,workspaces:r,scripts:a,"lint-staged":{"*.js":["eslint --fix"]},browserslist:i,resolutions:n,dependencies:c,devDependencies:p,packageManager:d,engines:m,nx:u};export{i as browserslist,b as default,c as dependencies,p as devDependencies,m as engines,o as license,t as main,e as name,u as nx,d as packageManager,n as resolutions,a as scripts,l as type,s as version,r as workspaces};
1
+ var e="web-engine",s="3.3.388",o="UNLICENSED",l="module",t="src/main.js",r=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],a={colors:"cat utils/colors1.txt && node utils/processColors.js | pbcopy && cat utils/colors2.txt","cypress:a11y":"APPLITOOLS_IS_DISABLED=true && cypress open --browser chrome --env INPUT_MODALITY='keyboard'","cypress:comp":"APPLITOOLS_IS_DISABLED=true && cypress open --component --browser chrome","cypress:e2e":"APPLITOOLS_IS_DISABLED=true && cypress open --e2e --browser chrome",demo:"cd demo/ && yarn start","e2e:comp":"cypress run --component","e2e:record":"yarn cypress run --env RECORD_MODE=true",e2eSDKTest:"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./cypress/e2e/sdk && npx http-server' 8080 'yarn cypress run --spec cypress/e2e/sdk/**'",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh",i18nOverrides:"yarn node utils/i18nOverrideCli src/i18n src/i18n-overrides",lint:"eslint .",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol",prepare:"husky install",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:vitest":"vitest"},i=["defaults"],n={react:"^18.3.1"},c={"@azure/event-hubs":"^5.12.2","@dnd-kit/core":"^6.1.0","@dnd-kit/modifiers":"^7.0.0","@dnd-kit/sortable":"^8.0.0","@dnd-kit/utilities":"^3.2.2","@locus-labs/mod-badge":"^0.1.102","@locus-labs/mod-default-theme":"^0.0.113","@locus-labs/mod-footer":"^0.0.111","@locus-labs/mod-header":"^0.0.105","@locus-labs/mod-location-marker":"^0.0.104","@locus-labs/mod-map-legend":"^0.0.104","@locus-labs/mod-offscreen-indicator":"^0.0.104","@locus-labs/mod-pin":"^0.0.104","@locus-labs/mod-qr-code-card":"^0.0.104","@locus-labs/mod-qr-code-window":"^0.0.105","@locus-labs/mod-walk-time-matrix":"^0.0.103","@locus-labs/mol-desktop-building-level-selector":"^0.1.119","@locus-labs/mol-desktop-compass":"^0.1.120","@locus-labs/mol-desktop-default-theme":"^0.2.105","@locus-labs/mol-desktop-icon":"^0.1.131","@locus-labs/mol-desktop-logo":"^0.1.101","@locus-labs/mol-desktop-map-nav-button":"^0.1.130","@locus-labs/mol-desktop-tooltip":"^0.3.102","@locus-labs/mol-desktop-zoom-control":"^0.1.141","@locus-labs/mol-mobile-box":"^0.1.115","@locus-labs/mol-mobile-floating-action-button":"^0.0.117","@locus-labs/mol-mobile-icon":"^0.1.118","@locus-labs/mol-mobile-text":"^0.1.116","@locus-labs/mol-mobile-toast":"^0.1.102","@mapbox/mapbox-gl-draw":"^1.4.3","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.4","@turf/circle":"^6.5.0","@turf/helpers":"^6.5.0","@turf/point-to-line-distance":"^6.5.0","@vitejs/plugin-react":"^4.0.1","axe-core":"^4.9.0",browserslist:"^4.24.2","crypto-browserify":"^3.12.0","cypress-axe":"^1.5.0","cypress-multi-reporters":"^1.6.4","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^20.3.4","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"6.0.1",jsdom:"^25.0.1",jsonschema:"^1.2.6",luxon:"^3.3.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^1.6.0","mocha-junit-reporter":"^2.2.1",mochawesome:"^7.1.3","node-polyfill-webpack-plugin":"^1.1.4","path-browserify":"^1.0.1",polished:"^4.0.2","prop-types":"^15.7.2","query-string":"^8.1.0",ramda:"^0.30.1",react:"^18.3.1","react-compound-slider":"^3.3.1","react-dom":"^18.3.1","react-json-editor-ajrm":"^2.5.13","react-qr-svg":"^2.2.1","react-svg":"^16.1.29","react-virtualized-auto-sizer":"^1.0.2","react-window":"^1.8.11","smoothscroll-polyfill":"^0.4.4","styled-components":"^6.1.14","styled-normalize":"^8.0.6","throttle-debounce":"^3.0.1",trackjs:"^3.7.4","ua-parser-js":"^0.7.23",uuid:"3.3.2",zousan:"^3.0.1","zousan-plus":"^4.0.1"},p={"@applitools/eyes-cypress":"^3.47.0","@babel/core":"^7.26.0","@babel/eslint-parser":"^7.25.9","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-syntax-import-assertions":"^7.26.0","@babel/plugin-transform-modules-commonjs":"^7.25.9","@babel/plugin-transform-runtime":"^7.25.9","@babel/preset-env":"^7.26.0","@babel/preset-react":"^7.25.9","@testing-library/jest-dom":"^6.6.3","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^7.13.0","@typescript-eslint/parser":"^7.13.0","babel-jest":"^27.0.6","babel-loader":"^8.2.2","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^5.0.0","babel-plugin-styled-components":"^2.1.4","babel-polyfill":"^6.26.0","chai-colors":"^1.0.1","css-loader":"^5.2.4",cypress:"^12.17.2","cypress-browser-permissions":"^1.1.0","cypress-real-events":"^1.11.0","cypress-wait-until":"^1.7.1",eslint:"^8.57.0","eslint-config-standard":"^16.0.3","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-cypress":"^2.11.1","eslint-plugin-import":"^2.16.0","eslint-plugin-jest":"^28.6.0","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.1.0","eslint-plugin-react":"^7.12.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.3.0",glob:"^10.3.3",husky:"^6.0.0",jest:"29.7.0","jest-environment-jsdom":"^29.7.0","lint-staged":"^11.0.1","node-fetch":"^2.6.0","null-loader":"^4.0.1",nx:"19.4.2","nx-remotecache-azure":"^19.0.0","start-server-and-test":"^2.0.0",typescript:"^5.4.5",vite:"^4.3.9",vitest:"^2.1.5",webpack:"^5.96.1","webpack-merge":"^6.0.1"},d="yarn@4.3.1",m={node:"20.x"},u={},b={name:e,version:s,private:!0,license:o,type:l,main:t,workspaces:r,scripts:a,"lint-staged":{"*.js":["eslint --fix"]},browserslist:i,resolutions:n,dependencies:c,devDependencies:p,packageManager:d,engines:m,nx:u};export{i as browserslist,b as default,c as dependencies,p as devDependencies,m as engines,o as license,t as main,e as name,u as nx,d as packageManager,n as resolutions,a as scripts,l as type,s as version,r as workspaces};
@@ -1 +1 @@
1
- import*as e from"ramda";import{bezierCurveTo as t}from"../../../src/utils/geom.js";import o from"./segmentCategories.js";import a from"./stepBuilder.js";const n=e.map(e.converge(e.assoc("coordinates"),[e=>e.waypoints.flatMap(((e,o)=>o>0&&e.curvedPathForward&&e.curvedPathForward.length>0?e.curvedPathForward.flatMap((e=>t(e.start.lng,e.start.lat,e.in.lng,e.in.lat,e.out.lng,e.out.lat,e.end.lng,e.end.lat))).map((e=>[e.x,e.y])):[[e.position.lng,e.position.lat]])),e.identity])),r=t=>{const a=[];let n={segmentCategory:void 0,waypoints:[]},r=null,s=[];return n.waypoints=[t[0]],n.type=t[0].isPortal?t[0].portalType:"Walk",a.push(n),n={segmentCategory:void 0,waypoints:[]},t.forEach((e=>{s.push(e),r?(r.isPortal===e.isPortal&&r.isSecurityCheckpoint===e.isSecurityCheckpoint||(n.waypoints=s,e.isPortal||r.isPortal?(s.length>1&&s.pop(),s=!e.isPortal||"train"!==e.portalType.toLowerCase()&&"bus"!==e.portalType.toLowerCase()?[e]:[s[s.length-1],e]):s=[],r.poiId&&(n.poiId=r.poiId),a.push(n),n={segmentCategory:void 0,waypoints:[]},n.type=e.isPortal?e.portalType:"Walk"),n.levelDifference=e.levelDifference,r=e):(n.type=e.isPortal?e.portalType:"Walk",r=e)})),n.waypoints=s,0===s.length&&(n.waypoints=[r]),a.push(n),(e=>{e.forEach(((t,a)=>{0===a?t.segmentCategory=o.START:t.waypoints[t.waypoints.length-1].isDestination?t.segmentCategory=o.WALKING_TO_END:"Security Checkpoint"===t.type?t.segmentCategory=o.SECURITY_CHECKPOINT:"Bus"===t.type?t.segmentCategory=o.BUS:"Train"===t.type?t.segmentCategory=o.TRAIN:"Stairs"===t.type?t.levelDifference>0?t.segmentCategory=o.STAIRS_UP:t.levelDifference<0?t.segmentCategory=o.STAIRS_DOWN:t.segmentCategory=o.STAIRS:"Elevator"===t.type?t.levelDifference>0?t.segmentCategory=o.ELEVATOR_UP:t.levelDifference<0?t.segmentCategory=o.ELEVATOR_DOWN:t.segmentCategory=o.ELEVATOR:"Escalator"===t.type?t.levelDifference>0?t.segmentCategory=o.ESCALATOR_UP:t.levelDifference<0?t.segmentCategory=o.ESCALATOR_DOWN:t.segmentCategory=o.ESCALATOR:"Ramp"===t.type?t.levelDifference>0?t.segmentCategory=o.RAMP_UP:t.levelDifference<0?t.segmentCategory=o.RAMP_DOWN:t.segmentCategory=o.RAMP:"Security Checkpoint"===e[a+1].type?t.segmentCategory=o.WALKING_TO_SECURITY_CHECKPOINT:"Walk"!==e[a+1].type&&(t.segmentCategory=o.WALKING_TO_PORTAL)}))})(a),((e,t)=>{if(1===e.length){const a={segmentCategory:void 0,waypoints:[]};a.segmentCategory=o.WALKING_TO_END,a.type="Walk",a.waypoints=[t],e.push(a)}})(a,r),(t=>{t.forEach(((o,a)=>{if(a>1&&0===e.head(o.waypoints).levelDifference){const n=e.last(t[a-1].waypoints);o.waypoints=e.prepend(n,o.waypoints)}}))})(a),a},s=(t,s,i,p,l,g,y)=>{let c=r(t);c=n(c),s&&c[0].coordinates.unshift([s.lng,s.lat]),i&&e.last(c).coordinates.push([i.lng,i.lat]);return{segments:c.map(((t,a)=>{const n=e.last(t.waypoints),r=t.coordinates,s=!(t.levelDifference&&t.waypoints.every(e.prop("isPortal"))),i={levelId:n.position.structureId,ordinalId:`ordinal: ${n.position.ordinal}`,coordinates:r,shouldDrawSegment:s},p=[];if(o.WALKING_TO_PORTAL===t.segmentCategory){const t=c[a+1];p.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)})}else o.START!==t.segmentCategory&&p.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)});return i.badges=p,i.segmentType=(e=>"Train"===e.type?"nav.train":"Bus"===e.type?"nav.transit":"Security Checkpoint"===e.type?"nav.secure":"nav.primary")(t),t.poiId&&(i.poiId=t.poiId),i})),steps:a(c,e.prop("title",s),e.prop("title",i),p,l,g)}};export{s as buildSegments};
1
+ import*as e from"ramda";import{bezierCurveTo as t}from"../../../src/utils/geom.js";import o from"./segmentCategories.js";import a from"./stepBuilder.js";const n=e.map(e.converge(e.assoc("coordinates"),[e=>e.waypoints.flatMap(((e,o)=>o>0&&e.curvedPathForward&&e.curvedPathForward.length>0?e.curvedPathForward.flatMap((e=>t(e.start.lng,e.start.lat,e.in.lng,e.in.lat,e.out.lng,e.out.lat,e.end.lng,e.end.lat))).map((e=>[e.x,e.y])):[[e.position.lng,e.position.lat]])),e.identity])),r=t=>{const a=[];let n={segmentCategory:void 0,waypoints:[]},r=null,s=[];return n.waypoints=[t[0]],n.type=t[0].isPortal?t[0].portalType:"Walk",a.push(n),n={segmentCategory:void 0,waypoints:[]},t.forEach((e=>{s.push(e),r?(r.isPortal===e.isPortal&&r.isSecurityCheckpoint===e.isSecurityCheckpoint||(n.waypoints=s,e.isPortal||r.isPortal?(s.length>1&&s.pop(),s=!e.isPortal||"train"!==e.portalType.toLowerCase()&&"bus"!==e.portalType.toLowerCase()?[e]:[s[s.length-1],e]):s=[],r.poiId&&(n.poiId=r.poiId),a.push(n),n={segmentCategory:void 0,waypoints:[]},n.type=e.isPortal?e.portalType:"Walk"),n.levelDifference=e.levelDifference,r=e):(n.type=e.isPortal?e.portalType:"Walk",r=e)})),n.waypoints=s,0===s.length&&(n.waypoints=[r]),a.push(n),(e=>{e.forEach(((t,a)=>{0===a?t.segmentCategory=o.START:t.waypoints[t.waypoints.length-1].isDestination?t.segmentCategory=o.WALKING_TO_END:"Security Checkpoint"===t.type?t.segmentCategory=o.SECURITY_CHECKPOINT:"Bus"===t.type?t.segmentCategory=o.BUS:"Train"===t.type?t.segmentCategory=o.TRAIN:"Stairs"===t.type?t.levelDifference>0?t.segmentCategory=o.STAIRS_UP:t.levelDifference<0?t.segmentCategory=o.STAIRS_DOWN:t.segmentCategory=o.STAIRS:"Elevator"===t.type?t.levelDifference>0?t.segmentCategory=o.ELEVATOR_UP:t.levelDifference<0?t.segmentCategory=o.ELEVATOR_DOWN:t.segmentCategory=o.ELEVATOR:"Escalator"===t.type?t.levelDifference>0?t.segmentCategory=o.ESCALATOR_UP:t.levelDifference<0?t.segmentCategory=o.ESCALATOR_DOWN:t.segmentCategory=o.ESCALATOR:"Ramp"===t.type?t.levelDifference>0?t.segmentCategory=o.RAMP_UP:t.levelDifference<0?t.segmentCategory=o.RAMP_DOWN:t.segmentCategory=o.RAMP:"Security Checkpoint"===e[a+1].type?t.segmentCategory=o.WALKING_TO_SECURITY_CHECKPOINT:"Walk"!==e[a+1].type&&(t.segmentCategory=o.WALKING_TO_PORTAL)}))})(a),((e,t)=>{if(1===e.length){const a={segmentCategory:void 0,waypoints:[]};a.segmentCategory=o.WALKING_TO_END,a.type="Walk",a.waypoints=[t],e.push(a)}})(a,r),(t=>{t.forEach(((o,a)=>{if(a>1&&0===e.head(o.waypoints).levelDifference){const n=e.last(t[a-1].waypoints);o.waypoints=e.prepend(n,o.waypoints)}}))})(a),a},s=(t,s,i,p,l,g,y,c)=>{let m=r(t);m=n(m),s&&m[0].coordinates.unshift([s.lng,s.lat]),i&&e.last(m).coordinates.push([i.lng,i.lat]);return{segments:m.map(((t,a)=>{const n=e.last(t.waypoints),r=t.coordinates,s=!(t.levelDifference&&t.waypoints.every(e.prop("isPortal"))),i={levelId:n.position.structureId,ordinalId:`ordinal: ${n.position.ordinal}`,coordinates:r,shouldDrawSegment:s},p=[];if(o.WALKING_TO_PORTAL===t.segmentCategory){const t=m[a+1];p.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)})}else o.START!==t.segmentCategory&&p.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)});return i.badges=p,i.segmentType=(e=>"Train"===e.type?"nav.train":"Bus"===e.type?"nav.transit":"Security Checkpoint"===e.type?"nav.secure":"nav.primary")(t),t.poiId&&(i.poiId=t.poiId),i})),steps:a(m,e.prop("title",s),e.prop("title",i),p,l,g,y,c)}};export{s as buildSegments};
@@ -1 +1 @@
1
- import{compose as e,not as t,includes as r,__ as a,toLower as n,prop as s,last as c,find as u,propEq as i,drop as T}from"ramda";import{findBoundsOfWaypoints as o}from"../../../src/utils/bounds.js";import A from"./segmentBadges.js";import _ from"./segmentCategories.js";function R(e,t="",r="",a,n,u={},i){return e.map(((i,T)=>{const R=N("securityWaitTimes")(i.waypoints),L=R&&!R.isTemporarilyClosed?R.queueTime:Math.round(1===(y=i.waypoints).length?y[0].eta:y.map(s("eta")).slice(1).reduce(((e,t)=>e+t),0));var y;const I=Math.round(function(e){return 1===e.length?e[0].distance:e.map((e=>e.distance)).slice(1).reduce(((e,t)=>e+t),0)}(i.waypoints)),m=function(e){switch(e){case _.START:return A.START;case _.WALKING_TO_END:return A.END;case _.ELEVATOR:return A.ELEVATOR;case _.ELEVATOR_UP:return A.ELEVATOR_UP;case _.ELEVATOR_DOWN:return A.ELEVATOR_DOWN;case _.STAIRS:return A.STAIRS;case _.STAIRS_UP:return A.STAIRS_UP;case _.STAIRS_DOWN:return A.STAIRS_DOWN;case _.ESCALATOR:return A.ESCALATOR;case _.ESCALATOR_UP:return A.ESCALATOR_UP;case _.ESCALATOR_DOWN:return A.ESCALATOR_DOWN;case _.WALKING_TO_PORTAL:case _.WALK:case _.WALK_DOWN:case _.WALK_UP:return A.WALK;case _.TRAIN:return A.TRAIN;case _.TRAIN_UP:return A.TRAIN_UP;case _.TRAIN_DOWN:return A.TRAIN_DOWN;case _.BUS:return A.BUS;case _.BUS_UP:return A.BUS_UP;case _.BUS_DOWN:return A.BUS_DOWN;case _.SECURITY_CHECKPOINT:return A.SECURITY_CHECKPOINT;case _.RAMP:return A.RAMP;case _.RAMP_UP:return A.RAMP_UP;case _.RAMP_DOWN:return A.RAMP_DOWN;default:return A.WALK}}(i.segmentCategory),p=function(e,t){let r;switch(e){case _.START:r=0;break;case _.WALKING_TO_END:r=t.length-1;break;case _.WALKING_TO_PORTAL:r=Math.min(t.length-1,Math.ceil(t.length/2));break;default:r=t.length-1}return t[r].position}(i.segmentCategory,i.waypoints),P=function(e,t,r,a,n,s){const u=e[t];switch(u.segmentCategory){case _.START:return O(u.waypoints[0].position,r);case _.WALKING_TO_END:return O(u.waypoints[u.waypoints.length-1].position,a);case _.WALKING_TO_SECURITY_CHECKPOINT:case _.WALKING_TO_PORTAL:return s(`wayfinder:${e[t+1].type}`);case _.SECURITY_CHECKPOINT:case _.ELEVATOR:case _.ELEVATOR_DOWN:case _.ELEVATOR_UP:case _.ESCALATOR:case _.ESCALATOR_DOWN:case _.ESCALATOR_UP:case _.STAIRS:case _.STAIRS_DOWN:case _.STAIRS_UP:return function(e,t){return t[c(e.waypoints).position.floorId]}(u,n);default:return s(`wayfinder:${u.type}`)}}(e,T,t,r,a,n),W=function(e,t,r,a){const n=S(t,a),s="Proceed";switch(e.segmentCategory){case _.START:return a("wayfinder:Begin route at");case _.ELEVATOR:return a("wayfinder:Take elevator to");case _.ELEVATOR_UP:return a("wayfinder:Take elevator up to");case _.ELEVATOR_DOWN:return a("wayfinder:Take elevator down to");case _.STAIRS:return a("wayfinder:Take stairs to");case _.STAIRS_UP:return a("wayfinder:Take stairs up to");case _.STAIRS_DOWN:return a("wayfinder:Take stairs down to");case _.ESCALATOR:return a("wayfinder:Take escalator to");case _.ESCALATOR_UP:return a("wayfinder:Take escalator up to");case _.ESCALATOR_DOWN:return a("wayfinder:Take escalator down to");case _.WALK:case _.WALKING_TO_SECURITY_CHECKPOINT:case _.WALKING_TO_PORTAL:case _.WALKING_TO_END:return n(`${s} <1 minute to`,`${s} xx minute to`);case _.WALK_DOWN:return n(`${s} <1 minute down to`,`${s} xx minute down to`);case _.WALK_UP:return n(`${s} <1 minute up to`,`${s} xx minute up to`);case _.TRAIN:return n("Take train <1 minute","Take train xx minute");case _.BUS:return n("Take bus <1 minute","Take bus xx minute");case _.SECURITY_CHECKPOINT:return r?a("wayfinder:Through _security_ to",{name:r}):a("wayfinder:Through security to");case _.RAMP:return a("wayfinder:Take ramp to");case _.RAMP_UP:return a("wayfinder:Take ramp up to");case _.RAMP_DOWN:return a("wayfinder:Take ramp down to");default:return""}}(i,L,d(u,i.waypoints),n),w={primaryText:P,secondaryText:W,icon:m,animationAnchor:p,eta:L,distance:I,bounds:o(i.waypoints),isAccessible:E(i),securityWaitTimes:R};return i.poiId&&(w.poiId=i.poiId),w}))}function O(e,t){return e.name?e.name:t}const S=(e,t)=>(r,a)=>0===e?t("wayfinder:"+r):t("wayfinder:"+a,{count:e}),E=e(t,r(a,["escalator","stairs"]),n,s("type")),d=(e,t)=>{const r=N("securityLane")(t);if(!r)return;const a=s(r.type,e),n=u(i(r.id,"id"),a);return s("displayText",n)},N=t=>e(s(t),u(s(t)),T(1));export{R as default};
1
+ import{compose as e,not as t,includes as r,__ as n,toLower as a,prop as s,last as i,find as o,propEq as u,drop as c}from"ramda";import{findBoundsOfWaypoints as T}from"../../../src/utils/bounds.js";import{distance as A}from"../../../src/utils/geodesy.js";import _ from"./segmentBadges.js";import R from"./segmentCategories.js";function O(e,t="",r="",n,a,i={},o,u=[]){return e.map(((o,c)=>{const A=l("securityWaitTimes")(o.waypoints),O=A&&!A.isTemporarilyClosed?A.queueTime:Math.round(1===(N=o.waypoints).length?N[0].eta:N.map(s("eta")).slice(1).reduce(((e,t)=>e+t),0));var N;const I=Math.round(function(e){return 1===e.length?e[0].distance:e.map((e=>e.distance)).slice(1).reduce(((e,t)=>e+t),0)}(o.waypoints)),f=function(e){switch(e){case R.START:return _.START;case R.WALKING_TO_END:return _.END;case R.ELEVATOR:return _.ELEVATOR;case R.ELEVATOR_UP:return _.ELEVATOR_UP;case R.ELEVATOR_DOWN:return _.ELEVATOR_DOWN;case R.STAIRS:return _.STAIRS;case R.STAIRS_UP:return _.STAIRS_UP;case R.STAIRS_DOWN:return _.STAIRS_DOWN;case R.ESCALATOR:return _.ESCALATOR;case R.ESCALATOR_UP:return _.ESCALATOR_UP;case R.ESCALATOR_DOWN:return _.ESCALATOR_DOWN;case R.WALKING_TO_PORTAL:case R.WALK:case R.WALK_DOWN:case R.WALK_UP:return _.WALK;case R.TRAIN:return _.TRAIN;case R.TRAIN_UP:return _.TRAIN_UP;case R.TRAIN_DOWN:return _.TRAIN_DOWN;case R.BUS:return _.BUS;case R.BUS_UP:return _.BUS_UP;case R.BUS_DOWN:return _.BUS_DOWN;case R.SECURITY_CHECKPOINT:return _.SECURITY_CHECKPOINT;case R.RAMP:return _.RAMP;case R.RAMP_UP:return _.RAMP_UP;case R.RAMP_DOWN:return _.RAMP_DOWN;default:return _.WALK}}(o.segmentCategory),m=function(e,t){let r;switch(e){case R.START:r=0;break;case R.WALKING_TO_END:r=t.length-1;break;case R.WALKING_TO_PORTAL:r=Math.min(t.length-1,Math.ceil(t.length/2));break;default:r=t.length-1}return t[r].position}(o.segmentCategory,o.waypoints),w=function(e,t,r,n,a,s,i,o){const u=e[t];switch(u.segmentCategory){case R.START:return d(u.waypoints[0].position,r);case R.WALKING_TO_END:return d(u.waypoints[u.waypoints.length-1].position,n);case R.WALKING_TO_SECURITY_CHECKPOINT:{const r=e[t+1].waypoints,n=p(o,r),a=s("wayfinder:Security Lane"),c=n?`${n} ${a}`:null,T=L(r,i);return c||T||s(`wayfinder:${u.type}`)}case R.WALKING_TO_PORTAL:return s(`wayfinder:${e[t+1].type}`);case R.SECURITY_CHECKPOINT:{const e=p(o,u.waypoints),t=s("wayfinder:Security Lane"),r=e?`${e} ${t}`:null,n=L(u.waypoints,i);return r||n||S(u,a)}case R.ELEVATOR:case R.ELEVATOR_DOWN:case R.ELEVATOR_UP:case R.ESCALATOR:case R.ESCALATOR_DOWN:case R.ESCALATOR_UP:case R.STAIRS:case R.STAIRS_DOWN:case R.STAIRS_UP:return S(u,a);default:return s(`wayfinder:${u.type}`)}}(e,c,t,r,n,a,u,i),P=function(e,t,r){const n=E(t,r),a="Proceed";switch(e.segmentCategory){case R.START:return r("wayfinder:Begin route at");case R.ELEVATOR:return r("wayfinder:Take elevator to");case R.ELEVATOR_UP:return r("wayfinder:Take elevator up to");case R.ELEVATOR_DOWN:return r("wayfinder:Take elevator down to");case R.STAIRS:return r("wayfinder:Take stairs to");case R.STAIRS_UP:return r("wayfinder:Take stairs up to");case R.STAIRS_DOWN:return r("wayfinder:Take stairs down to");case R.ESCALATOR:return r("wayfinder:Take escalator to");case R.ESCALATOR_UP:return r("wayfinder:Take escalator up to");case R.ESCALATOR_DOWN:return r("wayfinder:Take escalator down to");case R.WALK:case R.WALKING_TO_SECURITY_CHECKPOINT:case R.WALKING_TO_PORTAL:case R.WALKING_TO_END:return n(`${a} <1 minute to`,`${a} xx minute to`);case R.WALK_DOWN:return n(`${a} <1 minute down to`,`${a} xx minute down to`);case R.WALK_UP:return n(`${a} <1 minute up to`,`${a} xx minute up to`);case R.TRAIN:return n("Take train <1 minute","Take train xx minute");case R.BUS:return n("Take bus <1 minute","Take bus xx minute");case R.SECURITY_CHECKPOINT:return r("wayfinder:Through");case R.RAMP:return r("wayfinder:Take ramp to");case R.RAMP_UP:return r("wayfinder:Take ramp up to");case R.RAMP_DOWN:return r("wayfinder:Take ramp down to");default:return""}}(o,O,a),W={primaryText:w,secondaryText:P,icon:f,animationAnchor:m,eta:O,distance:I,bounds:T(o.waypoints),isAccessible:y(o),securityWaitTimes:A};return o.poiId&&(W.poiId=o.poiId),W}))}function d(e,t){return e.name?e.name:t}function S(e,t){return t[i(e.waypoints).position.floorId]}const E=(e,t)=>(r,n)=>0===e?t("wayfinder:"+r):t("wayfinder:"+n,{count:e}),y=e(t,r(n,["escalator","stairs"]),a,s("type")),p=(e,t)=>{const r=l("securityLane")(t);if(!r)return;const n=s(r.type,e),a=o(u(r.id,"id"),n);return s("displayText",a)},l=t=>e(s(t),o(s(t)),c(1)),L=(e,t)=>{if(!e||0===e.length)return null;const r=e[0],{lat:n,lng:a,floorId:s}=r.position,i=t.filter((e=>e.position&&e.position.floorId===s));let o=null,u=1/0;return i.forEach((e=>{const t=A(n,a,e.position.latitude,e.position.longitude);t<u&&(u=t,o=e)})),o?o.name:null};export{O as default};
@@ -1 +1 @@
1
- import*as t from"ramda";import n from"zousan";import{buildStructuresLookup as o}from"../../../src/utils/buildStructureLookup.js";import{distance as e}from"../../../src/utils/geodesy.js";import{findRoute as i}from"./findRoute.js";import{createNavGraph as r}from"./navGraph.js";import{enrichDebugNavGraph as a}from"./navGraphDebug.js";import{buildSegments as s}from"./segmentBuilder.js";const u={SECURITY:"SecurityLane",IMMIGRATION:"ImmigrationLane"};function d(d,l){const p=d.log.sublog("wayfinder"),c=async()=>{d.bus.send("venueData/loadNavGraph")};let f=new n;d.bus.on("wayfinder/_getNavGraph",(()=>f)),d.bus.on("venueData/navGraphLoaded",(async({navGraphData:t,structures:n})=>{const e=o(n),i=await y(),a=r(t,e.floorIdToOrdinal,e.floorIdToStructureId,i);f.resolve(a)}));const y=async()=>{const n=await d.bus.get("poi/getByCategoryId",{categoryId:"security"});return t.pipe(t.map(m),t.filter(t.identity))(n)},m=n=>n.queue&&{type:t.path(["queue","queueType"],n),id:t.path(["queue","queueSubtype"],n)};d.bus.on("wayfinder/showNavLineFromPhysicalLocation",(async({toEndpoint:t,selectedSecurityLanes:n=null,requiresAccessibility:o})=>async function(t,n,o){const e=await T({fromEndpoint:t,toEndpoint:n,options:o});if(e){const{segments:t}=e;o.primary&&d.bus.send("map/resetNavlineFeatures"),d.bus.send("map/showNavlineFeatures",{segments:t,category:o.primary?"primary":"alternative"})}return e}(await d.bus.getFirst("user/getPhysicalLocation"),t,{selectedSecurityLanes:n,requiresAccessibility:o,primary:!0})));const h=(t,n)=>d.bus.get("poi/getById",{id:t}).then((o=>{if(o&&o.position)return w(o,n);throw Error("Unknown POI ID "+t)}));const I=["lat","lng","floorId","ordinal"],g=t.pipe(t.pick(I),t.keys,t.propEq(I.length,"length"),Boolean),w=(t,n)=>({lat:t.position.latitude,lng:t.position.longitude,floorId:t.position.floorId,ordinal:n(t.position.floorId),title:t.name});async function T({fromEndpoint:t,toEndpoint:n,options:o={}}){return f.then((async e=>{o.compareFindPaths=l.compareFindPaths;const r=i(e,t,n,o);if(!r)return null;t.floorId&&n.floorId&&b(t,n,r);const a=await d.bus.get("venueData/getFloorIdToNameMap"),u=await d.bus.get("venueData/getQueueTypes"),c=d.gt();o.requiresAccessibility;const{steps:f,segments:y}=s(r.waypoints,t,n,a,c,u);p.info("route",r);const m=Math.round(r.waypoints.reduce(((t,{eta:n})=>t+n),0)),h=Math.round(r.waypoints.reduce(((t,{distance:n})=>t+n),0));return{...r,segments:y,steps:f,time:m,distance:h}}))}d.bus.on("wayfinder/getNavigationEndpoint",(({ep:t})=>async function(t){return f.then((n=>{if(!t)throw Error("wayfinder: Invalid endpoint definition",t);if("number"==typeof t)return h(t,n.floorIdToOrdinal);if("string"==typeof t){if(t.match(/^\d+$/))return h(parseInt(t),n.floorIdToOrdinal);if(t.indexOf(",")>0){let[o,e,i,r]=t.split(",");if(!n.floorIdToStructureId(i))throw Error("Unknown floorId in endpoint: "+i);return r||(r="Starting Point"),{lat:parseFloat(o),lng:parseFloat(e),ordinal:n.floorIdToOrdinal(i),floorId:i,title:r}}}if(g(t))return t;if(t.latitude)return{lat:t.latitude,lng:t.longitude,floorId:t.floorId,ordinal:n.floorIdToOrdinal(t.floorId),title:t.title};if(t.position&&t.name)return w(t,n.floorIdToOrdinal);throw Error("Invalid start or end point: "+t)}))}(t))),d.bus.on("wayfinder/checkIfPathHasSecurity",(({fromEndpoint:n,toEndpoint:o,options:e={}})=>f.then((r=>{e.compareFindPaths=l.compareFindPaths;const a=i(r,n,o,e);if(!a)return{routeExists:!1};const s=n=>Boolean(a.waypoints.find(t.pathEq(n,["securityLane","type"])));return{routeExists:!0,queues:a.waypoints.filter((n=>t.pathEq(u.SECURITY,["securityLane","type"],n)||t.pathEq(u.IMMIGRATION,["securityLane","type"],n))),hasSecurity:s(u.SECURITY),hasImmigration:s(u.IMMIGRATION)}})))),d.bus.on("wayfinder/getRoute",T);const b=(t,n,o)=>d.bus.send("session/submitEvent",{type:"navigation",startPosition:{venueId:t.floorId.split("-")[0],buildingId:o.waypoints[0].position.structureId,floorId:o.waypoints[0].position.floorId,lat:o.waypoints[0].position.lat,lng:o.waypoints[0].position.lng},endPosition:{venueId:n.floorId.split("-")[0],buildingId:o.waypoints[o.waypoints.length-1].position.structureId,floorId:o.waypoints[o.waypoints.length-1].position.floorId,lat:o.waypoints[o.waypoints.length-1].position.lat,lng:o.waypoints[o.waypoints.length-1].position.lng}});function v(n,o,e,i){let r=t.clone(n);return r=E(r,e,i),o&&o.length?{...r,transitTime:S(o,"transitTime"),distance:S(o,"distance")}:(r.distance="start"===i?P(r,e):P(e,r),r.transitTime=L(r.distance),r)}function S(n,o){return t.aperture(2,n).map((([n,o])=>{return(e=o.id,n=>t.find((t=>t.dst===e),n.edges))(n);var e})).map(t.prop(o)).reduce(((t,n)=>t+n),0)}function E(t,n,o){return{...t,[o+"Information"]:{lat:n?.lat||n?.position?.latitude,lng:n?.lng||n?.position?.longitude,floorId:n?.floorId||n?.position?.floorId}}}function P(t,n){return e(n?.lat||n?.position?.latitude,n?.lng||n?.position?.longitude,t?.lat||t?.position?.latitude,t?.lng||t?.position?.longitude)}function L(t){return t/60}function O(n){const o=n.filter((t=>null!==t));return t.sortBy(t.propOr(1/0,"transitTime"),o)}function q(n,o,e,i,r){const a=F(o,i,n),s=F(e,n,r);if(!a||!s)return null;const u=N(o,a),d=N(e,s);let l=t.clone(n);return l=E(l,i,"start"),l=E(l,r,"end"),{...l,transitTime:u+d,distance:a+s,startInformation:{...l.startInformation,transitTime:u,distance:a},endInformation:{...l.endInformation,transitTime:d,distance:s}}}function N(t,n){return t&&t.length?S(t,"transitTime"):L(n)}function F(t,n,o){return t&&t.length?S(t,"distance"):P(o,n)}return d.bus.on("wayfinder/addPathTimeSingle",(async({poi:t,startLocation:n,options:o={}})=>n?f.then((e=>function(t,n,o,e){const i=w(o,t.floorIdToOrdinal),r=t.findShortestPath(e,i,n);return v(o,r,e,"start")}(e,o,t,n))):t)),d.bus.on("wayfinder/addPathTimeMultiple",(async({pois:n,startLocation:o,options:e={}})=>o?f.then((i=>function(n,o,e,i){try{const r=t.clone(e),a=r.map((t=>w(t,n.floorIdToOrdinal))),s=n.findAllShortestPaths(i,a,o);return O(r.map(((t,n)=>v(t,s[n],i,"start"))))}catch(t){return p.error(t),e}}(i,e,n,o))):n)),d.bus.on("wayfinder/multipointAddPathTimeMultiple",(async({pois:n,startLocation:o,endLocation:e,options:i={}})=>o||e?f.then((r=>function(n,o,e,i,r){try{const a=t.clone(e),s=a.map((t=>w(t,n.floorIdToOrdinal)));let u,d,l;return i&&(u=n.findAllShortestPaths(i,s,o)),r&&(d=function(t,n,o,e){const i=[];for(const r of n)i.push(t.findShortestPath(r,o,e));return i}(n,s,r,o)),l=i&&r?a.map(((t,n)=>q(t,u[n],d[n],i,r))):i?a.map(((t,n)=>v(t,u[n],i,"start"))):a.map(((t,n)=>v(t,d[n],r,"end"))),O(l)}catch(t){return p.error(t),e}}(r,i,n,o,e))):n)),d.bus.on("wayfinder/multipointAddPathTimeSingle",(async({poi:t,startLocation:n,endLocation:o,options:e={}})=>n||o?f.then((i=>function(t,n,o,e,i){const r=w(o,t.floorIdToOrdinal);let a,s;e&&(a=t.findShortestPath(e,r,n));i&&(s=t.findShortestPath(r,i,n));return e&&i?q(o,a,s,e,i):e?v(o,a,e,"start"):i?v(o,s,i,"end"):o}(i,e,t,n,o))):t)),d.bus.on("venueData/loadNewVenue",(()=>{f=new n,c()})),d.bus.on("poi/setDynamicData",(({plugin:t,idValuesMap:n})=>{"security"===t&&f.then((t=>t.updateWithSecurityWaitTime(n)))})),d.bus.on("wayfinder/getNavGraphFeatures",(()=>f.then((({_nodes:t})=>a(t))))),{init:c,internal:{resolveNavGraph:t=>f.resolve(t),prepareSecurityLanes:y}}}export{u as SecurityLaneType,d as create};
1
+ import*as t from"ramda";import n from"zousan";import{buildStructuresLookup as o}from"../../../src/utils/buildStructureLookup.js";import{distance as e}from"../../../src/utils/geodesy.js";import{findRoute as i}from"./findRoute.js";import{createNavGraph as r}from"./navGraph.js";import{enrichDebugNavGraph as a}from"./navGraphDebug.js";import{buildSegments as s}from"./segmentBuilder.js";const u={SECURITY:"SecurityLane",IMMIGRATION:"ImmigrationLane"};function l(l,d){const p=l.log.sublog("wayfinder"),c=async()=>{l.bus.send("venueData/loadNavGraph")};let f=new n;l.bus.on("wayfinder/_getNavGraph",(()=>f)),l.bus.on("venueData/navGraphLoaded",(async({navGraphData:t,structures:n})=>{const e=o(n),i=await y(),a=r(t,e.floorIdToOrdinal,e.floorIdToStructureId,i);f.resolve(a)}));const y=async()=>{const n=await l.bus.get("poi/getByCategoryId",{categoryId:"security"});return t.pipe(t.map(m),t.filter(t.identity))(n)},m=n=>n.queue&&{type:t.path(["queue","queueType"],n),id:t.path(["queue","queueSubtype"],n)};l.bus.on("wayfinder/showNavLineFromPhysicalLocation",(async({toEndpoint:t,selectedSecurityLanes:n=null,requiresAccessibility:o})=>async function(t,n,o){const e=await b({fromEndpoint:t,toEndpoint:n,options:o});if(e){const{segments:t}=e;o.primary&&l.bus.send("map/resetNavlineFeatures"),l.bus.send("map/showNavlineFeatures",{segments:t,category:o.primary?"primary":"alternative"})}return e}(await l.bus.getFirst("user/getPhysicalLocation"),t,{selectedSecurityLanes:n,requiresAccessibility:o,primary:!0})));const h=(t,n)=>l.bus.get("poi/getById",{id:t}).then((o=>{if(o&&o.position)return w(o,n);throw Error("Unknown POI ID "+t)}));const g=["lat","lng","floorId","ordinal"],I=t.pipe(t.pick(g),t.keys,t.propEq(g.length,"length"),Boolean),w=(t,n)=>({lat:t.position.latitude,lng:t.position.longitude,floorId:t.position.floorId,ordinal:n(t.position.floorId),title:t.name});async function b({fromEndpoint:t,toEndpoint:n,options:o={}}){const e=await l.bus.get("poi/getAll")||{},r=Array.isArray(e)?e[0]:e,a=Object.values(r).filter((t=>t.category&&t.category.startsWith("security")));return f.then((async e=>{o.compareFindPaths=d.compareFindPaths;const r=i(e,t,n,o);if(!r)return null;t.floorId&&n.floorId&&T(t,n,r);const u=await l.bus.get("venueData/getFloorIdToNameMap"),c=await l.bus.get("venueData/getQueueTypes"),f=l.gt(),y=o.requiresAccessibility,{steps:m,segments:h}=s(r.waypoints,t,n,u,f,c,y,a);p.info("route",r);const g=Math.round(r.waypoints.reduce(((t,{eta:n})=>t+n),0)),I=Math.round(r.waypoints.reduce(((t,{distance:n})=>t+n),0));return{...r,segments:h,steps:m,time:g,distance:I}}))}l.bus.on("wayfinder/getNavigationEndpoint",(({ep:t})=>async function(t){return f.then((n=>{if(!t)throw Error("wayfinder: Invalid endpoint definition",t);if("number"==typeof t)return h(t,n.floorIdToOrdinal);if("string"==typeof t){if(t.match(/^\d+$/))return h(parseInt(t),n.floorIdToOrdinal);if(t.indexOf(",")>0){let[o,e,i,r]=t.split(",");if(!n.floorIdToStructureId(i))throw Error("Unknown floorId in endpoint: "+i);return r||(r="Starting Point"),{lat:parseFloat(o),lng:parseFloat(e),ordinal:n.floorIdToOrdinal(i),floorId:i,title:r}}}if(I(t))return t;if(t.latitude)return{lat:t.latitude,lng:t.longitude,floorId:t.floorId,ordinal:n.floorIdToOrdinal(t.floorId),title:t.title};if(t.position&&t.name)return w(t,n.floorIdToOrdinal);throw Error("Invalid start or end point: "+t)}))}(t))),l.bus.on("wayfinder/checkIfPathHasSecurity",(({fromEndpoint:n,toEndpoint:o,options:e={}})=>f.then((r=>{e.compareFindPaths=d.compareFindPaths;const a=i(r,n,o,e);if(!a)return{routeExists:!1};const s=n=>Boolean(a.waypoints.find(t.pathEq(n,["securityLane","type"])));return{routeExists:!0,queues:a.waypoints.filter((n=>t.pathEq(u.SECURITY,["securityLane","type"],n)||t.pathEq(u.IMMIGRATION,["securityLane","type"],n))),hasSecurity:s(u.SECURITY),hasImmigration:s(u.IMMIGRATION)}})))),l.bus.on("wayfinder/getRoute",b);const T=(t,n,o)=>l.bus.send("session/submitEvent",{type:"navigation",startPosition:{venueId:t.floorId.split("-")[0],buildingId:o.waypoints[0].position.structureId,floorId:o.waypoints[0].position.floorId,lat:o.waypoints[0].position.lat,lng:o.waypoints[0].position.lng},endPosition:{venueId:n.floorId.split("-")[0],buildingId:o.waypoints[o.waypoints.length-1].position.structureId,floorId:o.waypoints[o.waypoints.length-1].position.floorId,lat:o.waypoints[o.waypoints.length-1].position.lat,lng:o.waypoints[o.waypoints.length-1].position.lng}});function v(n,o,e,i){let r=t.clone(n);return r=E(r,e,i),o&&o.length?{...r,transitTime:S(o,"transitTime"),distance:S(o,"distance")}:(r.distance="start"===i?P(r,e):P(e,r),r.transitTime=L(r.distance),r)}function S(n,o){return t.aperture(2,n).map((([n,o])=>{return(e=o.id,n=>t.find((t=>t.dst===e),n.edges))(n);var e})).map(t.prop(o)).reduce(((t,n)=>t+n),0)}function E(t,n,o){return{...t,[o+"Information"]:{lat:n?.lat||n?.position?.latitude,lng:n?.lng||n?.position?.longitude,floorId:n?.floorId||n?.position?.floorId}}}function P(t,n){return e(n?.lat||n?.position?.latitude,n?.lng||n?.position?.longitude,t?.lat||t?.position?.latitude,t?.lng||t?.position?.longitude)}function L(t){return t/60}function O(n){const o=n.filter((t=>null!==t));return t.sortBy(t.propOr(1/0,"transitTime"),o)}function q(n,o,e,i,r){const a=N(o,i,n),s=N(e,n,r);if(!a||!s)return null;const u=A(o,a),l=A(e,s);let d=t.clone(n);return d=E(d,i,"start"),d=E(d,r,"end"),{...d,transitTime:u+l,distance:a+s,startInformation:{...d.startInformation,transitTime:u,distance:a},endInformation:{...d.endInformation,transitTime:l,distance:s}}}function A(t,n){return t&&t.length?S(t,"transitTime"):L(n)}function N(t,n,o){return t&&t.length?S(t,"distance"):P(o,n)}return l.bus.on("wayfinder/addPathTimeSingle",(async({poi:t,startLocation:n,options:o={}})=>n?f.then((e=>function(t,n,o,e){const i=w(o,t.floorIdToOrdinal),r=t.findShortestPath(e,i,n);return v(o,r,e,"start")}(e,o,t,n))):t)),l.bus.on("wayfinder/addPathTimeMultiple",(async({pois:n,startLocation:o,options:e={}})=>o?f.then((i=>function(n,o,e,i){try{const r=t.clone(e),a=r.map((t=>w(t,n.floorIdToOrdinal))),s=n.findAllShortestPaths(i,a,o);return O(r.map(((t,n)=>v(t,s[n],i,"start"))))}catch(t){return p.error(t),e}}(i,e,n,o))):n)),l.bus.on("wayfinder/multipointAddPathTimeMultiple",(async({pois:n,startLocation:o,endLocation:e,options:i={}})=>o||e?f.then((r=>function(n,o,e,i,r){try{const a=t.clone(e),s=a.map((t=>w(t,n.floorIdToOrdinal)));let u,l,d;return i&&(u=n.findAllShortestPaths(i,s,o)),r&&(l=function(t,n,o,e){const i=[];for(const r of n)i.push(t.findShortestPath(r,o,e));return i}(n,s,r,o)),d=i&&r?a.map(((t,n)=>q(t,u[n],l[n],i,r))):i?a.map(((t,n)=>v(t,u[n],i,"start"))):a.map(((t,n)=>v(t,l[n],r,"end"))),O(d)}catch(t){return p.error(t),e}}(r,i,n,o,e))):n)),l.bus.on("wayfinder/multipointAddPathTimeSingle",(async({poi:t,startLocation:n,endLocation:o,options:e={}})=>n||o?f.then((i=>function(t,n,o,e,i){const r=w(o,t.floorIdToOrdinal);let a,s;e&&(a=t.findShortestPath(e,r,n));i&&(s=t.findShortestPath(r,i,n));return e&&i?q(o,a,s,e,i):e?v(o,a,e,"start"):i?v(o,s,i,"end"):o}(i,e,t,n,o))):t)),l.bus.on("venueData/loadNewVenue",(()=>{f=new n,c()})),l.bus.on("poi/setDynamicData",(({plugin:t,idValuesMap:n})=>{"security"===t&&f.then((t=>t.updateWithSecurityWaitTime(n)))})),l.bus.on("wayfinder/getNavGraphFeatures",(()=>f.then((({_nodes:t})=>a(t))))),{init:c,internal:{resolveNavGraph:t=>f.resolve(t),prepareSecurityLanes:y}}}export{u as SecurityLaneType,l as create};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atriusmaps-node-sdk",
3
- "version": "3.3.387",
3
+ "version": "3.3.388",
4
4
  "description": "This project provides an API to Atrius Personal Wayfinder maps within a Node environment. See the README.md for more information",
5
5
  "keywords": [
6
6
  "map",