atriusmaps-node-sdk 3.3.332 → 3.3.334

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.
@@ -90,9 +90,8 @@ function prepareSDKConfig (sc) {
90
90
  }
91
91
  };
92
92
  config.plugins.userMenu = { noLangOptions };
93
- if (pinnedLocation) {
94
- config.plugins['online/bluedot'] = { pinnedLocation };
95
- }
93
+ if (pinnedLocation)
94
+ config.plugins['online/pinnedLocation'] = { location: pinnedLocation };
96
95
  }
97
96
 
98
97
  config.plugins.searchService = defaultSearchTerms
@@ -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.332";
6
+ var version = "3.3.334";
7
7
  var license = "UNLICENSED";
8
8
  var type = "module";
9
9
  var main = "src/main.js";
@@ -84,6 +84,7 @@ var dependencies = {
84
84
  "axe-core": "^4.9.0",
85
85
  "crypto-browserify": "^3.12.0",
86
86
  "cypress-axe": "^1.5.0",
87
+ "cypress-multi-reporters": "^1.6.4",
87
88
  "file-loader": "^6.2.0",
88
89
  flexsearch: "^0.7.31",
89
90
  "h3-js": "^4.1.0",
@@ -95,6 +96,8 @@ var dependencies = {
95
96
  luxon: "^3.3.0",
96
97
  "maplibre-gl": "~2.1.9",
97
98
  "mini-css-extract-plugin": "^1.6.0",
99
+ "mocha-junit-reporter": "^2.2.1",
100
+ mochawesome: "^7.1.3",
98
101
  "node-polyfill-webpack-plugin": "^1.1.4",
99
102
  "path-browserify": "^1.0.1",
100
103
  polished: "^4.0.2",
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var R = require('ramda');
6
- var util = require('./util.js');
6
+ var location = require('../../../src/utils/location.js');
7
7
 
8
8
  function _interopNamespace(e) {
9
9
  if (e && e.__esModule) return e;
@@ -61,8 +61,8 @@ function handleHeadless (app) {
61
61
  app.bus.on('clientAPI/destroy', async () => app.destroy());
62
62
 
63
63
  app.bus.on('clientAPI/getDirections', async ({ from, to, accessible, queueTypes }) => {
64
- const fromEndpoint = await util.locationToEndpoint(app, from);
65
- const toEndpoint = await util.locationToEndpoint(app, to);
64
+ const fromEndpoint = await location.locationToEndpoint(app, from);
65
+ const toEndpoint = await location.locationToEndpoint(app, to);
66
66
  const options = { requiresAccessibility: !!accessible };
67
67
  if (queueTypes)
68
68
  options.selectedSecurityLanes = { SecurityLane: queueTypes };
@@ -71,7 +71,7 @@ function handleHeadless (app) {
71
71
  });
72
72
 
73
73
  app.bus.on('clientAPI/getDirectionsMultiple', async ({ locations, accessible, queueTypes }) => {
74
- const endpoints = await Promise.all(locations.map(async l => util.locationToEndpoint(app, l)));
74
+ const endpoints = await Promise.all(locations.map(async l => location.locationToEndpoint(app, l)));
75
75
  const options = { requiresAccessibility: !!accessible };
76
76
  if (queueTypes)
77
77
  options.selectedSecurityLanes = { SecurityLane: queueTypes };
@@ -91,7 +91,7 @@ function handleHeadless (app) {
91
91
 
92
92
  app.bus.on('clientAPI/getAllPOIs', async () => app.bus.get('poi/getAll'));
93
93
 
94
- app.bus.on('clientAPI/getStructures', () => util.getStructures(app));
94
+ app.bus.on('clientAPI/getStructures', () => location.getStructures(app));
95
95
 
96
96
  const isNotFunction = o => typeof o !== 'function';
97
97
  app.bus.on('clientAPI/getVenueData', async () => {
@@ -66,7 +66,7 @@ function create (app, config) {
66
66
  app.bus.on('search/queryNearbyAsync', searchNearby);
67
67
 
68
68
  async function searchNearby () {
69
- const startLocation = await app.bus.get('user/getPhysicalLocation');
69
+ const startLocation = await app.bus.getFirst('user/getPhysicalLocation');
70
70
  if (!startLocation?.floorId) return []
71
71
  const poisSameFloor = await app.bus.get('poi/getByFloorId', { floorId: startLocation?.floorId });
72
72
  const isNotPortal = poi => poi.category.indexOf('portal') === -1 && poi.category !== 'element.door';
@@ -148,7 +148,7 @@ function create (app, config) {
148
148
  * @returns {Route}
149
149
  */
150
150
  app.bus.on('wayfinder/showNavLineFromPhysicalLocation', async ({ toEndpoint, selectedSecurityLanes = null, requiresAccessibility }) => {
151
- const physicalLocation = await app.bus.get('user/getPhysicalLocation');
151
+ const physicalLocation = await app.bus.getFirst('user/getPhysicalLocation');
152
152
  return navigateFromTo(physicalLocation, toEndpoint, { selectedSecurityLanes, requiresAccessibility, primary: true })
153
153
  });
154
154
 
@@ -12,6 +12,14 @@ var Zousan__default = /*#__PURE__*/_interopDefaultLegacy(Zousan);
12
12
  * Bustle is a highly performant event bus that offers event order guarantees.
13
13
  */
14
14
 
15
+ const bustleResponseComparitor = (r1, r2) => {
16
+ if (r1.responseOrder == null) // null or undefined
17
+ return r2.responseOrder == null ? 0 : 1 // any order is higher pri than none
18
+ if (r2.responseOrder == null)
19
+ return -1
20
+ return r1.responseOrder - r2.responseOrder
21
+ };
22
+
15
23
  // Remove element from array at index specified and return the removed element.
16
24
  // Source array will then have item removed.
17
25
  const arRmAt = (ar, index) => ar.splice(index, 1)[0]; // oh yah, thats intuitive!
@@ -113,12 +121,21 @@ function create (opts = { }) {
113
121
 
114
122
  // Used when there is a single listener that provides information or a service,
115
123
  // a get sends a message to that listener, ensures it gets exactly 1 result,
116
- // and returns that result.
124
+ // and returns that result. If there are 0 or more than 1 listener, the returned
125
+ // promise is rejected
117
126
  const get = (ev, ob) =>
118
127
  send(ev, ob).then(res => res.length !== 1
119
128
  ? Zousan__default["default"].reject(`${ev} event did not return a single result, but ${res.length} results.`)
120
129
  : res[0]);
121
130
 
131
+ // Allows for any number of listeners to exist - but extracts the first one
132
+ // and returns it. If there are NO listeners, undefined is returned. The promise
133
+ // is never rejected.
134
+ const getFirst = (ev, ob) =>
135
+ send(ev, ob).then(res => res.length >= 1
136
+ ? res.sort(bustleResponseComparitor)[0]
137
+ : undefined);
138
+
122
139
  function send (ev, ob) {
123
140
  if (opts.showEvents) {
124
141
  if (typeof opts.showEvents === 'function') {
@@ -130,7 +147,7 @@ function create (opts = { }) {
130
147
  return new Zousan__default["default"](resolve => Zousan__default["default"].soon(serve(ev, ob, resolve)))
131
148
  }
132
149
 
133
- return { get, moff, monitor, off, on, send }
150
+ return { get, getFirst, moff, monitor, off, on, send }
134
151
  }
135
152
 
136
153
  exports.create = create;
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var geom = require('./geom.js');
6
+
7
+ /**
8
+ * Allows for flexibility in the manner in which you specify a location. This may call to getVenueData, so you should not
9
+ * call this function until you are in the init stage of your plugin, to ensure the venueDataLoader plugin has had a chance
10
+ * to register its getVenueData listener.
11
+ *
12
+ * @param {Object} app The app object
13
+ * @param {Object} location A location in the map, which can be a {poid} or {lat,lng,ord} or {lat,lng,ordinal} or {lat,lng,floorId}
14
+ * @returns an Endpoint { lat, lng, ordinal, floorId, title }
15
+ */
16
+ async function locationToEndpoint (app, location) {
17
+ if (location.poiId)
18
+ return app.bus.get('wayfinder/getNavigationEndpoint', { ep: location.poiId })
19
+ let { lat, lng, ord, ordinal, floorId, title = '' } = location;
20
+ if (ordinal === undefined && ord !== undefined)
21
+ ordinal = ord; // normalize on "ordinal"
22
+ if (ordinal !== undefined && floorId !== undefined) // we are good to go
23
+ return { lat, lng, ordinal, floorId, title }
24
+
25
+ // We are missing either an ordinal or a floorId.. we can get a floor object from either one and retrieve the other
26
+ const structures = await getStructures(app);
27
+
28
+ // Note: floor can be legitimately null here - if floorId was null and the location is not within a building...
29
+ const floor = ordinal !== undefined ? geom.getFloorAt(structures, lat, lng, ordinal) : geom.getFloor(structures, floorId);
30
+
31
+ if (ordinal !== undefined)
32
+ return { lat, lng, ordinal, floorId: floor ? floor.id : null, title }
33
+
34
+ // if ordinal was not defined, then we need a floor, so if floor is still null here, bad dog.
35
+ if (!floor)
36
+ throw Error('Call to locationToEndpoint with no ordinal and no floorId (or an invalid one): ' + floorId)
37
+
38
+ return { lat, lng, floorId, ordinal: floor.ordinal, title }
39
+ }
40
+
41
+ const getStructures = async app => app.bus.get('venueData/getVenueData').then(vd => vd.structures);
42
+
43
+ exports.getStructures = getStructures;
44
+ exports.locationToEndpoint = locationToEndpoint;
@@ -1 +1 @@
1
- import{setDeepLinksForParms as e}from"../src/configs/postproc-mol-url-parms.js";import{setStateFromStateString as i}from"../src/configs/postproc-stateTracking.js";import{filterOb as n}from"../src/utils/funcs.js";function t(t){const{name:s,debug:a,headless:r,theme:l,defaultSearchTerms:c,venueId:p,accountId:u,poiCategories:d,preserveStateInURL:g,supportURLDeepLinks:h,initState:m,deepLinkParms:f,uiHide:v,renderDiv:S,parentConfig:k,desktopViewMinWidth:P,forceDesktop:L,hostAppId:V,hostAppVersion:b,hostAppProperties:w,logFilter:A,searchPlaceholder:y,dataFetch:D,engineName:I,dynamicPoisUrlBaseV1:j,plugins:Z,anaytics2ActiveFlag:F,enablePoiSelection:O,minZoom:T,maxZoom:x,noLangOptions:C,pinnedLocation:M}=t,R=k?[k]:r?["sdkHeadless"]:["sdkVisual"],U=(e,i)=>e&&e.length>i?e.substring(0,i):e,W={name:s,engineName:I,extends:R,debug:a,logFilter:A,theme:l,uiHide:v,renderDiv:S,configPostProc:[],plugins:{venueDataLoader:{dataFetch:D,venueId:p,accountId:u},sdkServer:{headless:r},analytics2:{hostAppId:(e=>e?U(e.toString(),128):void 0)(V),hostAppVersion:(e=>e?U(e.toString(),128):void 0)(b),hostAppProperties:(e=>{if(!e||"object"!=typeof e)return;const i={},n=Object.keys(e);return n.length>10&&(n.length=10),n.forEach((n=>{let t=U(n.toString().replaceAll(/[^a-zA-Z0-9_]/g,""),128);t.match(/^[a-zA-Z]+/)||(t="X"+t);let o=e[n];null==o&&(o=""),o=U(o.toString(),128),i[t]=o})),i})(w)}},uuid:"undefined"!=typeof document&&document&&document.location?document.location.host:"unknown"};void 0!==F&&(W.plugins.analytics2.active=F);const H=(e,i)=>void 0!==i?{[e]:i}:{};return r||(W.plugins["online/headerOnline"]={searchPlaceholder:y},W.plugins.mapRenderer={...H("enablePoiSelection",O),viewLimits:{...H("maxZoom",x),...H("minZoom",T)}},W.plugins.userMenu={noLangOptions:C},M&&(W.plugins["online/bluedot"]={pinnedLocation:M})),W.plugins.searchService=c?{defaultSearchTerms:c}:{},o(t,"defaultSearchTerms",W.plugins.searchService),R.includes("sdkVisual")&&(W.plugins["online/homeView"]=d?{poiCategories:d}:{},o(t,"poiCategories",W.plugins["online/homeView"])),Z&&(Z.draw&&(W.plugins.draw=Z.draw),Z.flightStatus&&(W.plugins.flightStatus=Z.flightStatus,W.plugins["online/flightDetails"]={},W.plugins["online/flightDetailsSearch"]={})),g&&(W.configPostProc.push("stateTracking"),W.plugins.deepLinking={trackURL:!0}),h&&W.configPostProc.push("mol-url-parms"),m&&i(W,atob(m),!0),f&&e(W,f,!0),void 0!==P&&(W.desktopViewMinWidth=P),L&&(W.desktopViewMinWidth=0),j&&(W.plugins.dynamicPois={urlBaseV1:j}),n(((e,i)=>void 0!==i),W)}function o(e,i,n){Object.keys(e).filter((e=>e.startsWith(i+"-"))).forEach((i=>n[i]=e[i]))}export{t as default};
1
+ import{setDeepLinksForParms as e}from"../src/configs/postproc-mol-url-parms.js";import{setStateFromStateString as i}from"../src/configs/postproc-stateTracking.js";import{filterOb as n}from"../src/utils/funcs.js";function t(t){const{name:s,debug:a,headless:r,theme:l,defaultSearchTerms:c,venueId:p,accountId:u,poiCategories:d,preserveStateInURL:g,supportURLDeepLinks:h,initState:m,deepLinkParms:f,uiHide:v,renderDiv:S,parentConfig:k,desktopViewMinWidth:P,forceDesktop:L,hostAppId:V,hostAppVersion:w,hostAppProperties:A,logFilter:b,searchPlaceholder:y,dataFetch:D,engineName:I,dynamicPoisUrlBaseV1:j,plugins:Z,anaytics2ActiveFlag:F,enablePoiSelection:O,minZoom:T,maxZoom:x,noLangOptions:C,pinnedLocation:M}=t,R=k?[k]:r?["sdkHeadless"]:["sdkVisual"],U=(e,i)=>e&&e.length>i?e.substring(0,i):e,W={name:s,engineName:I,extends:R,debug:a,logFilter:b,theme:l,uiHide:v,renderDiv:S,configPostProc:[],plugins:{venueDataLoader:{dataFetch:D,venueId:p,accountId:u},sdkServer:{headless:r},analytics2:{hostAppId:(e=>e?U(e.toString(),128):void 0)(V),hostAppVersion:(e=>e?U(e.toString(),128):void 0)(w),hostAppProperties:(e=>{if(!e||"object"!=typeof e)return;const i={},n=Object.keys(e);return n.length>10&&(n.length=10),n.forEach((n=>{let t=U(n.toString().replaceAll(/[^a-zA-Z0-9_]/g,""),128);t.match(/^[a-zA-Z]+/)||(t="X"+t);let o=e[n];null==o&&(o=""),o=U(o.toString(),128),i[t]=o})),i})(A)}},uuid:"undefined"!=typeof document&&document&&document.location?document.location.host:"unknown"};void 0!==F&&(W.plugins.analytics2.active=F);const H=(e,i)=>void 0!==i?{[e]:i}:{};return r||(W.plugins["online/headerOnline"]={searchPlaceholder:y},W.plugins.mapRenderer={...H("enablePoiSelection",O),viewLimits:{...H("maxZoom",x),...H("minZoom",T)}},W.plugins.userMenu={noLangOptions:C},M&&(W.plugins["online/pinnedLocation"]={location:M})),W.plugins.searchService=c?{defaultSearchTerms:c}:{},o(t,"defaultSearchTerms",W.plugins.searchService),R.includes("sdkVisual")&&(W.plugins["online/homeView"]=d?{poiCategories:d}:{},o(t,"poiCategories",W.plugins["online/homeView"])),Z&&(Z.draw&&(W.plugins.draw=Z.draw),Z.flightStatus&&(W.plugins.flightStatus=Z.flightStatus,W.plugins["online/flightDetails"]={},W.plugins["online/flightDetailsSearch"]={})),g&&(W.configPostProc.push("stateTracking"),W.plugins.deepLinking={trackURL:!0}),h&&W.configPostProc.push("mol-url-parms"),m&&i(W,atob(m),!0),f&&e(W,f,!0),void 0!==P&&(W.desktopViewMinWidth=P),L&&(W.desktopViewMinWidth=0),j&&(W.plugins.dynamicPois={urlBaseV1:j}),n(((e,i)=>void 0!==i),W)}function o(e,i,n){Object.keys(e).filter((e=>e.startsWith(i+"-"))).forEach((i=>n[i]=e[i]))}export{t as default};
@@ -1 +1 @@
1
- var e="web-engine",s="3.3.332",o="UNLICENSED",l="module",r="src/main.js",t=["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",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/**'",demo:"cd demo/ && yarn start","e2e:comp":"cypress run --component","e2e:record":"yarn cypress run --env RECORD_MODE=true",e2eTest:"percy exec -- cypress run --browser chrome",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:vitest":"vitest",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:e2e:video":"cypress run"},i=["defaults"],n={"@azure/event-hubs":"^5.6.0","@dnd-kit/core":"^6.0.8","@dnd-kit/modifiers":"^7.0.0","@dnd-kit/sortable":"^7.0.2","@dnd-kit/utilities":"^3.2.1","@john-osullivan/react-window-dynamic-fork":"^1.9.0-alpha.1","@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.3.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.1.2","@turf/circle":"^6.5.0","@turf/helpers":"^6.5.0","@turf/point-to-line-distance":"^6.5.0","@vitejs/plugin-react":"^4.0.1",IObject:"^0.7.2","axe-core":"^4.9.0","crypto-browserify":"^3.12.0","cypress-axe":"^1.5.0","file-loader":"^6.2.0",flexsearch:"^0.7.31","h3-js":"^4.1.0",i18next:"^20.3.4","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"4.0.1",jsdom:"^25.0.0",jsonschema:"^1.2.6",luxon:"^3.3.0","maplibre-gl":"~2.1.9","mini-css-extract-plugin":"^1.6.0","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.28.0",react:"^17.0.2","react-compound-slider":"^3.3.1","react-dom":"^17.0.2","react-json-editor-ajrm":"^2.5.13","react-qr-svg":"^2.2.1","react-svg":"^16.1.29","react-tageditor":"^0.2.3","react-virtualized-auto-sizer":"^1.0.2","smoothscroll-polyfill":"^0.4.4","styled-components":"5.1.0","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"},c={"@applitools/eyes-cypress":"^3.44.0","@babel/core":"^7.14.8","@babel/eslint-parser":"^7.24.7","@babel/plugin-proposal-class-properties":"^7.8.3","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-syntax-import-assertions":"^7.20.0","@babel/plugin-transform-modules-commonjs":"^7.8.3","@babel/plugin-transform-runtime":"^7.8.3","@babel/preset-env":"^7.14.8","@babel/preset-react":"^7.8.3","@percy/cli":"^1.0.0-beta.60","@percy/cypress":"^3.1.0","@testing-library/jest-dom":"^6.5.0","@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-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:"27.5.1","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.0.5",webpack:"^5.84.1","webpack-merge":"^5.8.0"},p="yarn@4.3.1",d={node:">=20"},m={},u={name:e,version:s,private:!0,license:o,type:l,main:r,workspaces:t,scripts:a,"lint-staged":{"*.js":["eslint --fix"]},browserslist:i,dependencies:n,devDependencies:c,packageManager:p,engines:d,nx:m};export{i as browserslist,u as default,n as dependencies,c as devDependencies,d as engines,o as license,r as main,e as name,m as nx,p as packageManager,a as scripts,l as type,s as version,t as workspaces};
1
+ var e="web-engine",s="3.3.334",o="UNLICENSED",r="module",l="src/main.js",t=["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",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/**'",demo:"cd demo/ && yarn start","e2e:comp":"cypress run --component","e2e:record":"yarn cypress run --env RECORD_MODE=true",e2eTest:"percy exec -- cypress run --browser chrome",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:vitest":"vitest",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:e2e:video":"cypress run"},i=["defaults"],n={"@azure/event-hubs":"^5.6.0","@dnd-kit/core":"^6.0.8","@dnd-kit/modifiers":"^7.0.0","@dnd-kit/sortable":"^7.0.2","@dnd-kit/utilities":"^3.2.1","@john-osullivan/react-window-dynamic-fork":"^1.9.0-alpha.1","@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.3.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.1.2","@turf/circle":"^6.5.0","@turf/helpers":"^6.5.0","@turf/point-to-line-distance":"^6.5.0","@vitejs/plugin-react":"^4.0.1",IObject:"^0.7.2","axe-core":"^4.9.0","crypto-browserify":"^3.12.0","cypress-axe":"^1.5.0","cypress-multi-reporters":"^1.6.4","file-loader":"^6.2.0",flexsearch:"^0.7.31","h3-js":"^4.1.0",i18next:"^20.3.4","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"4.0.1",jsdom:"^25.0.0",jsonschema:"^1.2.6",luxon:"^3.3.0","maplibre-gl":"~2.1.9","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.28.0",react:"^17.0.2","react-compound-slider":"^3.3.1","react-dom":"^17.0.2","react-json-editor-ajrm":"^2.5.13","react-qr-svg":"^2.2.1","react-svg":"^16.1.29","react-tageditor":"^0.2.3","react-virtualized-auto-sizer":"^1.0.2","smoothscroll-polyfill":"^0.4.4","styled-components":"5.1.0","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"},c={"@applitools/eyes-cypress":"^3.44.0","@babel/core":"^7.14.8","@babel/eslint-parser":"^7.24.7","@babel/plugin-proposal-class-properties":"^7.8.3","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-syntax-import-assertions":"^7.20.0","@babel/plugin-transform-modules-commonjs":"^7.8.3","@babel/plugin-transform-runtime":"^7.8.3","@babel/preset-env":"^7.14.8","@babel/preset-react":"^7.8.3","@percy/cli":"^1.0.0-beta.60","@percy/cypress":"^3.1.0","@testing-library/jest-dom":"^6.5.0","@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-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:"27.5.1","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.0.5",webpack:"^5.84.1","webpack-merge":"^5.8.0"},p="yarn@4.3.1",d={node:">=20"},m={},u={name:e,version:s,private:!0,license:o,type:r,main:l,workspaces:t,scripts:a,"lint-staged":{"*.js":["eslint --fix"]},browserslist:i,dependencies:n,devDependencies:c,packageManager:p,engines:d,nx:m};export{i as browserslist,u as default,n as dependencies,c as devDependencies,d as engines,o as license,l as main,e as name,m as nx,p as packageManager,a as scripts,r as type,s as version,t as workspaces};
@@ -1 +1 @@
1
- import*as e from"ramda";import{locationToEndpoint as t,getStructures as n}from"./util.js";const s=[{command:"destroy"},{command:"getDirections",args:[{name:"from",type:"location"},{name:"to",type:"location"},{name:"accessible",type:"boolean",optional:!0},{name:"queueTypes",type:"list",itemType:{type:"string"},optional:!0}]},{command:"getDirectionsMultiple",args:[{name:"locations",type:"list",itemType:{type:"location"}},{name:"accessible",type:"boolean",optional:!0},{name:"queueTypes",type:"list",itemType:{type:"string"},optional:!0}]},{command:"getPOIDetails",args:[{name:"poiId",type:"integer",min:0}]},{command:"getAllPOIs"},{command:"getStructures"},{command:"getVenueData"},{command:"search",args:[{name:"term",type:"string",minLength:2},{name:"details",type:"boolean",optional:!0}]}];function i(s){s.bus.on("clientAPI/destroy",(async()=>s.destroy())),s.bus.on("clientAPI/getDirections",(async({from:n,to:i,accessible:a,queueTypes:o})=>{const c=await t(s,n),r=await t(s,i),l={requiresAccessibility:!!a};return o&&(l.selectedSecurityLanes={SecurityLane:o}),s.bus.get("wayfinder/getRoute",{fromEndpoint:c,toEndpoint:r,options:l}).then(e.pick(["distance","time","steps","navline","waypoints"]))})),s.bus.on("clientAPI/getDirectionsMultiple",(async({locations:n,accessible:i,queueTypes:a})=>{const o=await Promise.all(n.map((async e=>t(s,e)))),c={requiresAccessibility:!!i};a&&(c.selectedSecurityLanes={SecurityLane:a});const r=await Promise.all(e.aperture(2,o).map((async e=>s.bus.get("wayfinder/getRoute",{fromEndpoint:e[0],toEndpoint:e[1],options:c})))),l=e.map(e.pick(["distance","time","steps","navline","waypoints"]),r);return{total:{distance:e.sum(e.map((e=>e.distance),l)),time:e.sum(e.map((e=>e.time),l))},directions:l}})),s.bus.on("clientAPI/getPOIDetails",(async({poiId:e})=>s.bus.get("poi/getById",{id:e}))),s.bus.on("clientAPI/getAllPOIs",(async()=>s.bus.get("poi/getAll"))),s.bus.on("clientAPI/getStructures",(()=>n(s)));const i=e=>"function"!=typeof e;s.bus.on("clientAPI/getVenueData",(async()=>{const t=await s.bus.get("venueData/getVenueData");return e.filter(i,t)})),s.bus.on("clientAPI/search",(async({term:e,details:t})=>s.bus.get("search/queryAsync",{term:e}).then((n=>{const i=n.map((e=>e.poiId));return s.bus.send("event/search",{referrer:"prog",searchMethod:null,query:e,entities:i}),t?n:i}))))}export{i as handleHeadless,s as headlessCommands};
1
+ import*as e from"ramda";import{locationToEndpoint as t,getStructures as n}from"../../../src/utils/location.js";const s=[{command:"destroy"},{command:"getDirections",args:[{name:"from",type:"location"},{name:"to",type:"location"},{name:"accessible",type:"boolean",optional:!0},{name:"queueTypes",type:"list",itemType:{type:"string"},optional:!0}]},{command:"getDirectionsMultiple",args:[{name:"locations",type:"list",itemType:{type:"location"}},{name:"accessible",type:"boolean",optional:!0},{name:"queueTypes",type:"list",itemType:{type:"string"},optional:!0}]},{command:"getPOIDetails",args:[{name:"poiId",type:"integer",min:0}]},{command:"getAllPOIs"},{command:"getStructures"},{command:"getVenueData"},{command:"search",args:[{name:"term",type:"string",minLength:2},{name:"details",type:"boolean",optional:!0}]}];function i(s){s.bus.on("clientAPI/destroy",(async()=>s.destroy())),s.bus.on("clientAPI/getDirections",(async({from:n,to:i,accessible:a,queueTypes:o})=>{const c=await t(s,n),r=await t(s,i),l={requiresAccessibility:!!a};return o&&(l.selectedSecurityLanes={SecurityLane:o}),s.bus.get("wayfinder/getRoute",{fromEndpoint:c,toEndpoint:r,options:l}).then(e.pick(["distance","time","steps","navline","waypoints"]))})),s.bus.on("clientAPI/getDirectionsMultiple",(async({locations:n,accessible:i,queueTypes:a})=>{const o=await Promise.all(n.map((async e=>t(s,e)))),c={requiresAccessibility:!!i};a&&(c.selectedSecurityLanes={SecurityLane:a});const r=await Promise.all(e.aperture(2,o).map((async e=>s.bus.get("wayfinder/getRoute",{fromEndpoint:e[0],toEndpoint:e[1],options:c})))),l=e.map(e.pick(["distance","time","steps","navline","waypoints"]),r);return{total:{distance:e.sum(e.map((e=>e.distance),l)),time:e.sum(e.map((e=>e.time),l))},directions:l}})),s.bus.on("clientAPI/getPOIDetails",(async({poiId:e})=>s.bus.get("poi/getById",{id:e}))),s.bus.on("clientAPI/getAllPOIs",(async()=>s.bus.get("poi/getAll"))),s.bus.on("clientAPI/getStructures",(()=>n(s)));const i=e=>"function"!=typeof e;s.bus.on("clientAPI/getVenueData",(async()=>{const t=await s.bus.get("venueData/getVenueData");return e.filter(i,t)})),s.bus.on("clientAPI/search",(async({term:e,details:t})=>s.bus.get("search/queryAsync",{term:e}).then((n=>{const i=n.map((e=>e.poiId));return s.bus.send("event/search",{referrer:"prog",searchMethod:null,query:e,entities:i}),t?n:i}))))}export{i as handleHeadless,s as headlessCommands};
@@ -1 +1 @@
1
- import*as e from"ramda";import r from"zousan";import{getLocalized as a}from"../../../src/utils/configUtils.js";import{arrayPick as s}from"../../../src/utils/rand.js";import t from"./poiSearch.js";import n from"./searchTypeahead.js";function o(o,i){const c={poiSearch:null,typeahead:null,indexesCreated:new r,defaultSearchTerms:null,specialQueryTerms:{}},u=async()=>{const e=await o.bus.get("poi/getAll");c.poiSearch=t(e,o.i18n().language),c.typeahead=n(e,c.poiSearch.search,o.i18n().language),c.defaultSearchTerms=a(i,"defaultSearchTerms",o.i18n().language),c.indexesCreated.resolve()};async function d(){const r=await o.bus.get("user/getPhysicalLocation");if(!r?.floorId)return[];const a=await o.bus.get("poi/getByFloorId",{floorId:r?.floorId}),s=Object.values(e.pickBy((e=>-1===e.category.indexOf("portal")&&"element.door"!==e.category),a)),t=await o.bus.get("wayfinder/addPathTimeMultiple",{pois:s,startLocation:r});return e.sortBy(e.prop("distance"),Object.values(t)).slice(0,50)}o.bus.on("search/queryNearby",(async()=>{const e=await d();return o.bus.send("search/showNearby",{pois:e,term:"Nearby"}),e})),o.bus.on("search/queryNearbyAsync",d),o.bus.on("search/queryCategory",(async({category:e,categoryName:r,searchTerm:a})=>{const s=await c.indexesCreated.then((()=>c.poiSearch.search({query:a||e})));return o.bus.send("search/showCategory",{pois:s,category:e,categoryName:r}),s})),o.bus.on("search/query",(({term:e})=>c.indexesCreated.then((()=>{const r=c.poiSearch.search({query:e});return o.bus.send("search/showSearchResults",{results:r,term:e}),r})))),o.bus.on("search/queryAsync",(({term:e})=>c.indexesCreated.then((()=>c.poiSearch.search({query:e}))))),o.bus.on("search/queryWithSpecial",(({term:e})=>{if(c.specialQueryTerms[e]){const{event:r,params:a}=c.specialQueryTerms[e];return o.bus.send(r,a)}return o.bus.get("search/query",{term:e})})),o.bus.on("search/getDefaultSearchTerms",(async({limit:e=5}={})=>{const r=c.defaultSearchTerms,a=r&&r.length?r:await async function(e){const r=(await o.bus.send("poi/getAllCategories"))[0],a=Array.from(new Set(r));return function(e){for(let r=e.length-1;r>0;r--){const a=Math.floor(Math.random()*(r+1));[e[r],e[a]]=[e[a],e[r]]}return e}(a).slice(0,e)}(e);return o.bus.send("search/showDefaultSearchKeywords",{keywords:a}),a})),o.bus.on("search/getDefaultSearchPois",(async({limit:r=5}={})=>{const a=await o.bus.get("poi/getAll"),t=e.pickBy(((e,r)=>e.isNavigable),a);return s(Object.values(t),r)})),o.bus.on("search/registerSpecialQuery",(({term:e,event:r,params:a,addKeyword:s=!0})=>{c.indexesCreated.then((()=>{s&&c.typeahead.addKeyword(e),c.specialQueryTerms[e]={event:r,params:a}}))})),o.bus.on("search/addKeywords",(({keywords:e})=>c.indexesCreated.then((()=>e.forEach((e=>c.typeahead.addKeyword(e))))))),o.bus.on("search/typeahead",(({term:e,limit:r})=>c.indexesCreated.then((()=>{const{keywords:a,pois:s}=c.typeahead.query(e,r);return{keywords:a,pois:s,term:e}})))),o.bus.on("venueData/loadNewVenue",(()=>{c.indexesCreated=new r,u()})),o.bus.on("poi/setDynamicData",(async({plugin:e,idValuesMap:r})=>{if("grab"!==e)return;const a=Object.keys(r).map((e=>o.bus.get("poi/getById",{id:e})));return Promise.all(a).then((e=>c.indexesCreated.then((()=>c.poiSearch.updateMultiple(e)))))}));return{init:u,runTest:async(e,r)=>(await r(),c)}}export{o as create};
1
+ import*as e from"ramda";import r from"zousan";import{getLocalized as a}from"../../../src/utils/configUtils.js";import{arrayPick as s}from"../../../src/utils/rand.js";import t from"./poiSearch.js";import n from"./searchTypeahead.js";function o(o,i){const c={poiSearch:null,typeahead:null,indexesCreated:new r,defaultSearchTerms:null,specialQueryTerms:{}},u=async()=>{const e=await o.bus.get("poi/getAll");c.poiSearch=t(e,o.i18n().language),c.typeahead=n(e,c.poiSearch.search,o.i18n().language),c.defaultSearchTerms=a(i,"defaultSearchTerms",o.i18n().language),c.indexesCreated.resolve()};async function d(){const r=await o.bus.getFirst("user/getPhysicalLocation");if(!r?.floorId)return[];const a=await o.bus.get("poi/getByFloorId",{floorId:r?.floorId}),s=Object.values(e.pickBy((e=>-1===e.category.indexOf("portal")&&"element.door"!==e.category),a)),t=await o.bus.get("wayfinder/addPathTimeMultiple",{pois:s,startLocation:r});return e.sortBy(e.prop("distance"),Object.values(t)).slice(0,50)}o.bus.on("search/queryNearby",(async()=>{const e=await d();return o.bus.send("search/showNearby",{pois:e,term:"Nearby"}),e})),o.bus.on("search/queryNearbyAsync",d),o.bus.on("search/queryCategory",(async({category:e,categoryName:r,searchTerm:a})=>{const s=await c.indexesCreated.then((()=>c.poiSearch.search({query:a||e})));return o.bus.send("search/showCategory",{pois:s,category:e,categoryName:r}),s})),o.bus.on("search/query",(({term:e})=>c.indexesCreated.then((()=>{const r=c.poiSearch.search({query:e});return o.bus.send("search/showSearchResults",{results:r,term:e}),r})))),o.bus.on("search/queryAsync",(({term:e})=>c.indexesCreated.then((()=>c.poiSearch.search({query:e}))))),o.bus.on("search/queryWithSpecial",(({term:e})=>{if(c.specialQueryTerms[e]){const{event:r,params:a}=c.specialQueryTerms[e];return o.bus.send(r,a)}return o.bus.get("search/query",{term:e})})),o.bus.on("search/getDefaultSearchTerms",(async({limit:e=5}={})=>{const r=c.defaultSearchTerms,a=r&&r.length?r:await async function(e){const r=(await o.bus.send("poi/getAllCategories"))[0],a=Array.from(new Set(r));return function(e){for(let r=e.length-1;r>0;r--){const a=Math.floor(Math.random()*(r+1));[e[r],e[a]]=[e[a],e[r]]}return e}(a).slice(0,e)}(e);return o.bus.send("search/showDefaultSearchKeywords",{keywords:a}),a})),o.bus.on("search/getDefaultSearchPois",(async({limit:r=5}={})=>{const a=await o.bus.get("poi/getAll"),t=e.pickBy(((e,r)=>e.isNavigable),a);return s(Object.values(t),r)})),o.bus.on("search/registerSpecialQuery",(({term:e,event:r,params:a,addKeyword:s=!0})=>{c.indexesCreated.then((()=>{s&&c.typeahead.addKeyword(e),c.specialQueryTerms[e]={event:r,params:a}}))})),o.bus.on("search/addKeywords",(({keywords:e})=>c.indexesCreated.then((()=>e.forEach((e=>c.typeahead.addKeyword(e))))))),o.bus.on("search/typeahead",(({term:e,limit:r})=>c.indexesCreated.then((()=>{const{keywords:a,pois:s}=c.typeahead.query(e,r);return{keywords:a,pois:s,term:e}})))),o.bus.on("venueData/loadNewVenue",(()=>{c.indexesCreated=new r,u()})),o.bus.on("poi/setDynamicData",(async({plugin:e,idValuesMap:r})=>{if("grab"!==e)return;const a=Object.keys(r).map((e=>o.bus.get("poi/getById",{id:e})));return Promise.all(a).then((e=>c.indexesCreated.then((()=>c.poiSearch.updateMultiple(e)))))}));return{init:u,runTest:async(e,r)=>(await r(),c)}}export{o as create};
@@ -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.get("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("length",I.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(["securityLane","type"],n)));return{routeExists:!0,queues:a.waypoints.filter((n=>t.pathEq(["securityLane","type"],u.SECURITY,n)||t.pathEq(["securityLane","type"],u.IMMIGRATION,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=M(o,i,n),s=M(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 M(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 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("length",I.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(["securityLane","type"],n)));return{routeExists:!0,queues:a.waypoints.filter((n=>t.pathEq(["securityLane","type"],u.SECURITY,n)||t.pathEq(["securityLane","type"],u.IMMIGRATION,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 +1 @@
1
- import o from"zousan";const n=(o,n)=>o.splice(n,1)[0],t=(o,t)=>{let r=0;do{r=o.indexOf(t,r),r>=0&&n(o,r)}while(r>=0);return o};function r(n={}){const r=n.log?n.log.sublog?n.log.sublog("bustle",{color:"pink"}):n.log:console,e={},s={};function u(o,n){e[o]&&t(e[o],n)}function c(o,n){s[o]&&t(s[o],n)}function l(t,u){return n.showEvents&&("function"==typeof n.showEvents?n.showEvents(t,u)&&r.info("send with",t," and ",u):r.info("send with",t," and ",u)),new o((c=>o.soon(((t,u,c)=>()=>{const l=e[t],f=s[t],i=[];if(l)for(const t of l)try{i.push(t(u))}catch(t){n.reportAllErrors&&r.error(t),n.rejectOnError?i.push(o.reject(t)):i.push(t)}const h=o.all(i);if(f)for(const o of f)try{o(u,h)}catch(o){n.reportAllErrors&&r.error(o)}c(h)})(t,u,c))))}return{get:(n,t)=>l(n,t).then((t=>1!==t.length?o.reject(`${n} event did not return a single result, but ${t.length} results.`):t[0])),moff:c,monitor:function(o,n){return s[o]||(s[o]=[]),s[o].push(n),()=>c(o,n)},off:u,on:function(o,n){return e[o]||(e[o]=[]),e[o].push(n),()=>u(o,n)},send:l}}export{r as create};
1
+ import r from"zousan";const n=(r,n)=>null==r.responseOrder?null==n.responseOrder?0:1:null==n.responseOrder?-1:r.responseOrder-n.responseOrder,o=(r,n)=>r.splice(n,1)[0],e=(r,n)=>{let e=0;do{e=r.indexOf(n,e),e>=0&&o(r,e)}while(e>=0);return r};function t(o={}){const t=o.log?o.log.sublog?o.log.sublog("bustle",{color:"pink"}):o.log:console,s={},l={};function u(r,n){s[r]&&e(s[r],n)}function c(r,n){l[r]&&e(l[r],n)}function i(n,e){return o.showEvents&&("function"==typeof o.showEvents?o.showEvents(n,e)&&t.info("send with",n," and ",e):t.info("send with",n," and ",e)),new r((u=>r.soon(((n,e,u)=>()=>{const c=s[n],i=l[n],f=[];if(c)for(const n of c)try{f.push(n(e))}catch(n){o.reportAllErrors&&t.error(n),o.rejectOnError?f.push(r.reject(n)):f.push(n)}const h=r.all(f);if(i)for(const r of i)try{r(e,h)}catch(r){o.reportAllErrors&&t.error(r)}u(h)})(n,e,u))))}return{get:(n,o)=>i(n,o).then((o=>1!==o.length?r.reject(`${n} event did not return a single result, but ${o.length} results.`):o[0])),getFirst:(r,o)=>i(r,o).then((r=>r.length>=1?r.sort(n)[0]:void 0)),moff:c,monitor:function(r,n){return l[r]||(l[r]=[]),l[r].push(n),()=>c(r,n)},off:u,on:function(r,n){return s[r]||(s[r]=[]),s[r].push(n),()=>u(r,n)},send:i}}export{t as create};
@@ -0,0 +1 @@
1
+ import{getFloorAt as o,getFloor as t}from"./geom.js";async function n(n,r){if(r.poiId)return n.bus.get("wayfinder/getNavigationEndpoint",{ep:r.poiId});let{lat:l,lng:a,ord:d,ordinal:e,floorId:f,title:u=""}=r;if(void 0===e&&void 0!==d&&(e=d),void 0!==e&&void 0!==f)return{lat:l,lng:a,ordinal:e,floorId:f,title:u};const g=await i(n),s=void 0!==e?o(g,l,a,e):t(g,f);if(void 0!==e)return{lat:l,lng:a,ordinal:e,floorId:s?s.id:null,title:u};if(!s)throw Error("Call to locationToEndpoint with no ordinal and no floorId (or an invalid one): "+f);return{lat:l,lng:a,floorId:f,ordinal:s.ordinal,title:u}}const i=async o=>o.bus.get("venueData/getVenueData").then((o=>o.structures));export{i as getStructures,n as locationToEndpoint};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atriusmaps-node-sdk",
3
- "version": "3.3.332",
3
+ "version": "3.3.334",
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",
@@ -1,23 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var geom = require('../../../src/utils/geom.js');
6
-
7
- const getStructures = async app => app.bus.get('venueData/getVenueData').then(vd => vd.structures);
8
-
9
- async function locationToEndpoint (app, location) {
10
- if (location.poiId)
11
- return app.bus.get('wayfinder/getNavigationEndpoint', { ep: location.poiId })
12
- const { lat, lng, ord, floorId, title = '' } = location;
13
- const structures = await getStructures(app);
14
- const floor = ord !== undefined ? geom.getFloorAt(structures, lat, lng, ord) : geom.getFloor(structures, floorId);
15
- if (ord !== undefined)
16
- return { lat, lng, ordinal: ord, floorId: floor ? floor.id : null, title }
17
- if (!floor)
18
- throw Error('Call to locationToEndpoint with no ordinal and no floorId (or an invalid one): ' + floorId)
19
- return { lat, lng, floorId, ordinal: floor.ordinal, title }
20
- }
21
-
22
- exports.getStructures = getStructures;
23
- exports.locationToEndpoint = locationToEndpoint;
@@ -1 +0,0 @@
1
- import{getFloorAt as o,getFloor as t}from"../../../src/utils/geom.js";const n=async o=>o.bus.get("venueData/getVenueData").then((o=>o.structures));async function i(i,r){if(r.poiId)return i.bus.get("wayfinder/getNavigationEndpoint",{ep:r.poiId});const{lat:l,lng:a,ord:e,floorId:d,title:u=""}=r,s=await n(i),f=void 0!==e?o(s,l,a,e):t(s,d);if(void 0!==e)return{lat:l,lng:a,ordinal:e,floorId:f?f.id:null,title:u};if(!f)throw Error("Call to locationToEndpoint with no ordinal and no floorId (or an invalid one): "+d);return{lat:l,lng:a,floorId:d,ordinal:f.ordinal,title:u}}export{n as getStructures,i as locationToEndpoint};