atriusmaps-node-sdk 3.3.891 → 3.3.893
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/package.json.js +5 -12
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +2 -1
- package/dist/cjs/src/utils/isInitialState.js +0 -1
- package/dist/cjs/src/utils/location.js +2 -1
- package/dist/package.json.js +1 -1
- package/dist/plugins/wayfinder/src/wayfinder.js +1 -1
- package/dist/src/utils/location.js +1 -1
- package/package.json +1 -1
package/dist/cjs/package.json.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var name = "web-engine";
|
|
6
|
-
var version = "3.3.
|
|
6
|
+
var version = "3.3.893";
|
|
7
7
|
var license = "UNLICENSED";
|
|
8
8
|
var type = "module";
|
|
9
|
-
var main = "src/main.
|
|
9
|
+
var main = "src/main.ts";
|
|
10
10
|
var workspaces = [
|
|
11
11
|
"demo",
|
|
12
12
|
"deploy",
|
|
@@ -17,7 +17,7 @@ var workspaces = [
|
|
|
17
17
|
];
|
|
18
18
|
var scripts = {
|
|
19
19
|
"build-storybook": "storybook build",
|
|
20
|
-
colors: "cat utils/colors1.txt && node utils/processColors.
|
|
20
|
+
colors: "cat utils/colors1.txt && node --experimental-strip-types utils/processColors.ts | pbcopy && cat utils/colors2.txt",
|
|
21
21
|
demo: "cd demo/ && yarn start",
|
|
22
22
|
dev: "yarn mol e2e",
|
|
23
23
|
"format:check": "yarn prettier . --check",
|
|
@@ -128,25 +128,18 @@ var devDependencies = {
|
|
|
128
128
|
"@vitest/browser": "4.1.6",
|
|
129
129
|
"@vitest/browser-playwright": "4.1.6",
|
|
130
130
|
"@vitest/ui": "4.1.6",
|
|
131
|
-
"chai-colors": "^1.0.1",
|
|
132
131
|
"css-loader": "^7.1.2",
|
|
133
132
|
eslint: "^8.57.1",
|
|
134
133
|
"eslint-config-prettier": "^10.1.8",
|
|
135
|
-
"eslint-config-standard": "^17.1.0",
|
|
136
134
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
137
|
-
"eslint-plugin-n": "^17.16.2",
|
|
138
|
-
"eslint-plugin-node": "^11.1.0",
|
|
139
135
|
"eslint-plugin-playwright": "^2.2.2",
|
|
140
|
-
"eslint-plugin-promise": "^5.2.0",
|
|
141
136
|
"eslint-plugin-react": "^7.37.4",
|
|
142
|
-
"eslint-plugin-standard": "^5.0.0",
|
|
143
137
|
"eslint-plugin-vitest": "^0.5.4",
|
|
144
138
|
"fetch-mock": "^12.6.0",
|
|
145
139
|
glob: "^11.0.1",
|
|
146
140
|
husky: "^9.1.7",
|
|
147
141
|
"lint-staged": "^16.4.0",
|
|
148
142
|
"node-fetch": "^2.7.0",
|
|
149
|
-
"null-loader": "^4.0.1",
|
|
150
143
|
nx: "19.8.14",
|
|
151
144
|
"nx-remotecache-azure": "^19.0.0",
|
|
152
145
|
"os-browserify": "^0.3.0",
|
|
@@ -174,7 +167,7 @@ var pkg = {
|
|
|
174
167
|
workspaces: workspaces,
|
|
175
168
|
scripts: scripts,
|
|
176
169
|
"lint-staged": {
|
|
177
|
-
"*.js": [
|
|
170
|
+
"*.{js,ts,tsx}": [
|
|
178
171
|
"eslint --fix",
|
|
179
172
|
"prettier --check"
|
|
180
173
|
],
|
|
@@ -182,7 +175,7 @@ var pkg = {
|
|
|
182
175
|
"prettier --check"
|
|
183
176
|
],
|
|
184
177
|
"src/i18n/**/*.json": [
|
|
185
|
-
"node utils/sort-json.
|
|
178
|
+
"node --experimental-strip-types utils/sort-json.ts",
|
|
186
179
|
"prettier --write"
|
|
187
180
|
]
|
|
188
181
|
},
|
|
@@ -219,10 +219,11 @@ function create(app, config) {
|
|
|
219
219
|
|
|
220
220
|
if (p.indexOf(',') > 0) {
|
|
221
221
|
// lat,lng,floorId,desc format
|
|
222
|
-
|
|
222
|
+
const [lat, lng, floorId, initialTitle] = p.split(',');
|
|
223
223
|
if (!graph.floorIdToStructureId(floorId)) {
|
|
224
224
|
throw Error('Unknown floorId in endpoint: ' + floorId);
|
|
225
225
|
}
|
|
226
|
+
let title = initialTitle;
|
|
226
227
|
if (!title) {
|
|
227
228
|
title = 'Starting Point';
|
|
228
229
|
}
|
|
@@ -18,7 +18,8 @@ async function locationToEndpoint(app, location) {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
const { lat, lng, ord, title = '' } = location;
|
|
22
|
+
let { ordinal, floorId, structureId } = location;
|
|
22
23
|
|
|
23
24
|
if (lat == null || lng == null) {
|
|
24
25
|
throw Error('To obtain a location, you must provide a lat,lng or a poiId');
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t="web-engine",e="3.3.
|
|
1
|
+
var t="web-engine",e="3.3.893",s="UNLICENSED",r="module",o="src/main.ts",i=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],a={"build-storybook":"storybook build",colors:"cat utils/colors1.txt && node --experimental-strip-types utils/processColors.ts | pbcopy && cat utils/colors2.txt",demo:"cd demo/ && yarn start",dev:"yarn mol e2e","format:check":"yarn prettier . --check","format:fix":"yarn prettier . --write",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh","icons:convert":"node scripts/convertSvgToJsx.mjs",lint:"eslint . --ext .js,.jsx,.ts,.tsx",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol","playwright:ci":"yarn playwright test --grep-invert sdk","playwright:ci:failed":"yarn playwright test --last-failed --grep-invert sdk","playwright:sdk":"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./test/sdk && npx http-server' 8080 'yarn playwright test sdk --ui'","playwright:ui":"yarn playwright test --ui --grep-invert sdk",prepare:"husky",storybook:"storybook dev -p 6006",test:"vitest run --project unit","test-watch":"vitest --watch","test:comp":"vitest run --project browser","test:comp:ci":"vitest run --project browser --reporter=dot","test:comp:ui":"VITE_COMP_UI=1 vitest --project browser --ui --browser.headless=false","test:all":"yarn lint && yarn format:check && yarn test && yarn playwright:ci","test:mod":"playwright test --config=playwright.mod.config.ts",typecheck:"tsc -p tsconfig.checkjs.json"},l=["defaults"],n={"@azure/event-hubs":"^5.12.2","@csstools/normalize.css":"^11.0.1","@dnd-kit/core":"^6.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@mapbox/mapbox-gl-draw":"^1.5.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.6","@styled-system/prop-types":"^5.1.5","@turf/area":"^7.2.0","@turf/bbox-clip":"^7.2.0","@turf/bbox-polygon":"^7.2.0","@turf/bearing":"^7.2.0","@turf/circle":"^7.2.0","@turf/helpers":"^7.2.0","@turf/point-to-line-distance":"^7.2.0","@vitejs/plugin-react":"^5.2.0","@zumer/snapdom":"^2.9.0","axe-core":"^4.10.3",browserslist:"^4.27.0","crypto-browserify":"^3.12.1",dompurify:"^3.3.3","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^26.0.0","i18next-browser-languagedetector":"^6.1.1",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^2.9.2","node-polyfill-webpack-plugin":"^4.1.0","path-browserify":"^1.0.1",pmtiles:"^4.4.0","prop-types":"^15.8.1","qrcode.react":"^4.2.0",ramda:"^0.30.1",react:"^19.2.4","react-compound-slider":"^3.4.0","react-dom":"^19.2.4","react-json-editor-ajrm":"^2.5.14","react-svg":"^16.3.0","react-virtualized-auto-sizer":"^1.0.25","react-window":"^1.8.11","smoothscroll-polyfill":"^0.4.4","styled-components":"^6.1.15","styled-normalize":"^8.1.1","styled-system":"^5.1.5","styled-tools":"^1.7.2","throttle-debounce":"^5.0.2",trackjs:"^3.10.4","ua-parser-js":"^0.7.40",uuid:"^11.1.0",zousan:"^3.0.1","zousan-plus":"^4.0.1"},p={"@applitools/eyes-playwright":"^1.46.8","@axe-core/playwright":"^4.10.2","@azure/identity":"^4.13.0","@azure/playwright":"^1.0.0","@playwright/test":"~1.59.1","@storybook/addon-essentials":"^8.6.15","@storybook/blocks":"^8.6.15","@storybook/react":"^8.6.15","@storybook/react-vite":"^8.6.15","@testing-library/dom":"^10.4.1","@testing-library/jest-dom":"^6.6.3","@testing-library/react":"^16.3.0","@testing-library/user-event":"^14.5.2","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","@vitest/browser":"4.1.6","@vitest/browser-playwright":"4.1.6","@vitest/ui":"4.1.6","css-loader":"^7.1.2",eslint:"^8.57.1","eslint-config-prettier":"^10.1.8","eslint-import-resolver-alias":"^1.1.2","eslint-plugin-playwright":"^2.2.2","eslint-plugin-react":"^7.37.4","eslint-plugin-vitest":"^0.5.4","fetch-mock":"^12.6.0",glob:"^11.0.1",husky:"^9.1.7","lint-staged":"^16.4.0","node-fetch":"^2.7.0",nx:"19.8.14","nx-remotecache-azure":"^19.0.0","os-browserify":"^0.3.0",prettier:"^3.8.3","start-server-and-test":"^2.0.11",storybook:"^8.6.15",typescript:"^5.8.2",vite:"^7.3.2",vitest:"^4.1.8","webpack-merge":"^6.0.1"},c="yarn@4.13.0",d={node:"24.x"},y={},u={name:t,version:e,private:!0,license:s,type:r,main:o,workspaces:i,scripts:a,"lint-staged":{"*.{js,ts,tsx}":["eslint --fix","prettier --check"],"*.{json,md,css,ts,tsx,jsx}":["prettier --check"],"src/i18n/**/*.json":["node --experimental-strip-types utils/sort-json.ts","prettier --write"]},browserslist:l,dependencies:n,devDependencies:p,packageManager:c,engines:d,nx:y};export{l as browserslist,u as default,n as dependencies,p as devDependencies,d as engines,s as license,o as main,t as name,y as nx,c as packageManager,a as scripts,r as type,e as version,i as workspaces};
|
|
@@ -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 m(),a=r(t,e.floorIdToOrdinal,e.floorIdToStructureId,i);f.resolve(a)}),d.bus.on("poi/setDynamicRouting",async({idValuesMap:t})=>{const n=await f,o=Object.values(t).filter(t=>t.position&&void 0!==t.position.floorId&&t.position.latitude&&t.position.longitude).map(t=>n.findClosestNode(t.position.floorId,t.position.latitude,t.position.longitude).id);n.addNodesToAvoid(o)});const m=async()=>{const n=await d.bus.get("poi/getByCategoryId",{categoryId:"security"});return t.pipe(t.map(y),t.filter(t.identity))(n)},y=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 g=(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 h=["lat","lng","floorId","ordinal"],I=t.pipe(t.pick(h),t.keys,t.propEq(h.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={}}){const e=await d.bus.get("poi/getAll")||{},r=Array.isArray(e)?e[0]:e,a=Object.values(r).filter(t=>t.category&&t.category.startsWith("security")),u=await d.bus.getFirst("directions/getPreferredUnits")||"meters";return f.then(async e=>{o.compareFindPaths=l.compareFindPaths;const r=i(e,t,n,o);if(!r)return null;const c=await d.bus.get("venueData/getFloorIdToNameMap"),f=await d.bus.get("venueData/getQueueTypes"),m=d.gt(),y=o.requiresAccessibility,{steps:g,segments:h}=s(r.waypoints,t,n,c,m,f,y,a,u);p.info("route",r);const I=Math.round(r.waypoints.reduce((t,{eta:n})=>t+n,0)),w=Math.round(r.waypoints.reduce((t,{distance:n})=>t+n,0));return{...r,segments:h,steps:g,time:I,distance:w}})}function b(n,o,e,i){let r=t.clone(n);return r=E(r,e,i),o&&o.length?{...r,transitTime:v(o,"transitTime"),distance:v(o,"distance")}:(r.distance="start"===i?O(r,e):O(e,r),r.transitTime=S(r.distance),r)}function v(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 O(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 S(t){return t/60}function L(n){const o=n.filter(t=>null!==t);return t.sortBy(t.propOr(1/0,"transitTime"),o)}function N(t,n){return t&&t.length?v(t,"transitTime"):S(n)}function P(t,n,o){return t&&t.length?v(t,"distance"):O(o,n)}return 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 g(t,n.floorIdToOrdinal);if("string"==typeof t){if(t.match(/^\d+$/))return g(parseInt(t),n.floorIdToOrdinal);if(t.indexOf(",")>0){
|
|
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 m(),a=r(t,e.floorIdToOrdinal,e.floorIdToStructureId,i);f.resolve(a)}),d.bus.on("poi/setDynamicRouting",async({idValuesMap:t})=>{const n=await f,o=Object.values(t).filter(t=>t.position&&void 0!==t.position.floorId&&t.position.latitude&&t.position.longitude).map(t=>n.findClosestNode(t.position.floorId,t.position.latitude,t.position.longitude).id);n.addNodesToAvoid(o)});const m=async()=>{const n=await d.bus.get("poi/getByCategoryId",{categoryId:"security"});return t.pipe(t.map(y),t.filter(t.identity))(n)},y=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 g=(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 h=["lat","lng","floorId","ordinal"],I=t.pipe(t.pick(h),t.keys,t.propEq(h.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={}}){const e=await d.bus.get("poi/getAll")||{},r=Array.isArray(e)?e[0]:e,a=Object.values(r).filter(t=>t.category&&t.category.startsWith("security")),u=await d.bus.getFirst("directions/getPreferredUnits")||"meters";return f.then(async e=>{o.compareFindPaths=l.compareFindPaths;const r=i(e,t,n,o);if(!r)return null;const c=await d.bus.get("venueData/getFloorIdToNameMap"),f=await d.bus.get("venueData/getQueueTypes"),m=d.gt(),y=o.requiresAccessibility,{steps:g,segments:h}=s(r.waypoints,t,n,c,m,f,y,a,u);p.info("route",r);const I=Math.round(r.waypoints.reduce((t,{eta:n})=>t+n,0)),w=Math.round(r.waypoints.reduce((t,{distance:n})=>t+n,0));return{...r,segments:h,steps:g,time:I,distance:w}})}function b(n,o,e,i){let r=t.clone(n);return r=E(r,e,i),o&&o.length?{...r,transitTime:v(o,"transitTime"),distance:v(o,"distance")}:(r.distance="start"===i?O(r,e):O(e,r),r.transitTime=S(r.distance),r)}function v(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 O(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 S(t){return t/60}function L(n){const o=n.filter(t=>null!==t);return t.sortBy(t.propOr(1/0,"transitTime"),o)}function N(t,n){return t&&t.length?v(t,"transitTime"):S(n)}function P(t,n,o){return t&&t.length?v(t,"distance"):O(o,n)}return 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 g(t,n.floorIdToOrdinal);if("string"==typeof t){if(t.match(/^\d+$/))return g(parseInt(t),n.floorIdToOrdinal);if(t.indexOf(",")>0){const[o,e,i,r]=t.split(",");if(!n.floorIdToStructureId(i))throw Error("Unknown floorId in endpoint: "+i);let a=r;return a||(a="Starting Point"),{lat:parseFloat(o),lng:parseFloat(e),ordinal:n.floorIdToOrdinal(i),floorId:i,title:a}}}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)),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),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 L(r.map((t,n)=>b(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,currentLocation:i,options:r={}})=>o||e||i?f.then(a=>function(n,o,e,i,r,a){try{const s=i?w(i,n.floorIdToOrdinal):a,u=r?w(r,n.floorIdToOrdinal):null,d=t.clone(e),l=d.map(t=>w(t,n.floorIdToOrdinal));let p,c,f;return s&&(p=n.findAllShortestPaths(s,l,o)),u&&(c=function(t,n,o,e){const i=[];for(const r of n)i.push(t.findShortestPath(r,o,e));return i}(n,l,u,o)),f=s&&u?d.map((n,o)=>function(n,o,e,i,r){const a=P(o,i,n),s=P(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}}}(n,p[o],c[o],s,u)):s?d.map((t,n)=>b(t,p[n],s,"start")):d.map((t,n)=>b(t,c[n],u,"end")),L(f)}catch(t){return p.error(t),e}}(a,r,n,o,e,i)):n),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:m}}}export{u as SecurityLaneType,d as create};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getFloor as o,getStructureAndFloorAtPoint as t,getStructureForFloorId as n}from"./geom.js";async function r(r,l){if(l.poiId)return r.bus.get("wayfinder/getNavigationEndpoint",{ep:l.poiId});
|
|
1
|
+
import{getFloor as o,getStructureAndFloorAtPoint as t,getStructureForFloorId as n}from"./geom.js";async function r(r,l){if(l.poiId)return r.bus.get("wayfinder/getNavigationEndpoint",{ep:l.poiId});const{lat:a,lng:e,ord:u,title:d=""}=l;let{ordinal:s,floorId:f,structureId:c}=l;if(null==a||null==e)throw Error("To obtain a location, you must provide a lat,lng or a poiId");void 0===s&&void 0!==u&&(s=u);const g=await i(r);if(null==s){if(null==f)throw Error("Call to locationToEndpoint with no ordinal and no floorId");{const t=o(g,f);if(!t)throw Error(`floor with id ${f} not found.`);s=t.ordinal}}else if(null==f){const o=await r.bus.get("map/getViewBBox"),{structure:n,floor:i}=t(g,a,e,s,o,!0);f=i?.id,c=n?.id}return null!=f&&null==c&&(c=n(g,f)?.id),{lat:a,lng:e,floorId:f,ordinal:s,title:d,structureId:c}}const i=async o=>o.bus.get("venueData/getVenueData").then(o=>o.structures);export{i as getStructures,r as locationToEndpoint};
|
package/package.json
CHANGED