atriusmaps-node-sdk 3.3.419 → 3.3.421
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 +1 -1
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +4 -49
- package/dist/cjs/plugins/dynamicPois/src/processors.js +14 -0
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +6 -8
- package/dist/package.json.js +1 -1
- package/dist/plugins/dynamicPois/src/dynamicPois.js +1 -1
- package/dist/plugins/dynamicPois/src/processors.js +1 -1
- package/dist/plugins/wayfinder/src/wayfinder.js +1 -1
- package/package.json +1 -1
package/dist/cjs/package.json.js
CHANGED
|
@@ -1,29 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var luxon = require('luxon');
|
|
4
|
-
var R = require('ramda');
|
|
5
3
|
var Zousan = require('zousan');
|
|
6
4
|
var processors = require('./processors.js');
|
|
7
5
|
|
|
8
|
-
function _interopNamespaceDefault(e) {
|
|
9
|
-
var n = Object.create(null);
|
|
10
|
-
if (e) {
|
|
11
|
-
Object.keys(e).forEach(function (k) {
|
|
12
|
-
if (k !== 'default') {
|
|
13
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () { return e[k]; }
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
n.default = e;
|
|
22
|
-
return Object.freeze(n);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
26
|
-
|
|
27
6
|
/*
|
|
28
7
|
This service obtains dynamic POI data from our own backend REST API service.
|
|
29
8
|
Currently it drives dynamic data for Security Wait Times and Parking Status.
|
|
@@ -59,8 +38,7 @@ const ACCOUNT_ID_HEADER = 'x-account-id';
|
|
|
59
38
|
|
|
60
39
|
function create (app, config = {}) {
|
|
61
40
|
const state = {
|
|
62
|
-
dynamicDataNotPending: new Zousan()
|
|
63
|
-
poisToAvoid: new Zousan()
|
|
41
|
+
dynamicDataNotPending: new Zousan()
|
|
64
42
|
};
|
|
65
43
|
const T = app.gt();
|
|
66
44
|
|
|
@@ -71,8 +49,6 @@ function create (app, config = {}) {
|
|
|
71
49
|
// by returning this dynamicDataLoaded promise, we hold sdkReady event until this is resolved
|
|
72
50
|
app.bus.on('system/readywhenyouare', () => state.dynamicDataNotPending);
|
|
73
51
|
|
|
74
|
-
app.bus.on('dynamicRouting/poisToAvoid', () => state.poisToAvoid);
|
|
75
|
-
|
|
76
52
|
const init = async () => {
|
|
77
53
|
const [accountId, venueId] = await Promise.all([
|
|
78
54
|
app.bus.get('venueData/getAccountId'),
|
|
@@ -147,30 +123,9 @@ function create (app, config = {}) {
|
|
|
147
123
|
app.bus.send('poi/setDynamicData', { plugin: 'open-closed-status', idValuesMap });
|
|
148
124
|
}
|
|
149
125
|
|
|
150
|
-
async function processDynamicRouting (
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (!config.dynamicRoutingEnabled) {
|
|
154
|
-
state.poisToAvoid.resolve(poiResults); // if dynamic routing is disabled, resolve to empty array
|
|
155
|
-
return
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const now = luxon.DateTime.now().toMillis();
|
|
159
|
-
|
|
160
|
-
const poiIdsToAvoid = Object.values(R__namespace.filter(
|
|
161
|
-
poi => {
|
|
162
|
-
const navGraphHidden = R__namespace.path(['dynamicData', 'dynamic-routing', 'navGraphHidden'], poi);
|
|
163
|
-
const expiration = R__namespace.path(['dynamicData', 'dynamic-routing', 'expiration'], poi);
|
|
164
|
-
return navGraphHidden === true && expiration > now
|
|
165
|
-
},
|
|
166
|
-
pois
|
|
167
|
-
));
|
|
168
|
-
|
|
169
|
-
if (poiIdsToAvoid.length > 0) {
|
|
170
|
-
const poisObj = await app.bus.get('poi/getAll');
|
|
171
|
-
poiResults = Object.values(poisObj).length > 0 ? poiIdsToAvoid.map(poi => poisObj[poi?.poiId])?.filter(Boolean) : [];
|
|
172
|
-
}
|
|
173
|
-
state.poisToAvoid.resolve(poiResults);
|
|
126
|
+
async function processDynamicRouting (poiMap) {
|
|
127
|
+
const idValuesMap = await processors.processRoutingPois(poiMap);
|
|
128
|
+
app.bus.send('poi/setDynamicRouting', { plugin: 'routing', idValuesMap });
|
|
174
129
|
}
|
|
175
130
|
|
|
176
131
|
return {
|
|
@@ -88,7 +88,21 @@ const processSecurityWaitTimes = (poiMap) => {
|
|
|
88
88
|
}), queues)
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
+
const processRoutingPois = (poiMap) => {
|
|
92
|
+
const now = Date.now();
|
|
93
|
+
|
|
94
|
+
return R__namespace.filter(
|
|
95
|
+
poi => {
|
|
96
|
+
const navGraphHidden = R__namespace.path(['dynamicData', 'dynamic-routing', 'navGraphHidden'], poi);
|
|
97
|
+
const expiration = R__namespace.path(['dynamicData', 'dynamic-routing', 'expiration'], poi);
|
|
98
|
+
return navGraphHidden === true && expiration > now
|
|
99
|
+
},
|
|
100
|
+
poiMap
|
|
101
|
+
)
|
|
102
|
+
};
|
|
103
|
+
|
|
91
104
|
exports.mutateSecurityCheckpointLabel = mutateSecurityCheckpointLabel;
|
|
92
105
|
exports.processOpenClosedPois = processOpenClosedPois;
|
|
93
106
|
exports.processParkingPOIS = processParkingPOIS;
|
|
107
|
+
exports.processRoutingPois = processRoutingPois;
|
|
94
108
|
exports.processSecurityWaitTimes = processSecurityWaitTimes;
|
|
@@ -119,17 +119,15 @@ function create (app, config) {
|
|
|
119
119
|
structureLookup.floorIdToStructureId,
|
|
120
120
|
securityLanesMap
|
|
121
121
|
);
|
|
122
|
-
const nodesToAvoid = await createNodesToAvoid(graph);
|
|
123
|
-
graph.addNodesToAvoid(nodesToAvoid);
|
|
124
122
|
graphLoadedProm.resolve(graph);
|
|
125
123
|
});
|
|
126
124
|
|
|
127
|
-
async
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
const nodesToAvoid = poisToAvoid
|
|
131
|
-
|
|
132
|
-
}
|
|
125
|
+
app.bus.on('poi/setDynamicRouting', async ({ idValuesMap }) => {
|
|
126
|
+
const graph = await graphLoadedProm;
|
|
127
|
+
const poisToAvoid = Object.values(idValuesMap);
|
|
128
|
+
const nodesToAvoid = poisToAvoid.map(poi => graph.findClosestNode(poi.position.floorId, poi.position.latitude, poi.position.longitude).id);
|
|
129
|
+
graph.addNodesToAvoid(nodesToAvoid);
|
|
130
|
+
});
|
|
133
131
|
|
|
134
132
|
const prepareSecurityLanes = async () => {
|
|
135
133
|
const securityPois = await app.bus.get('poi/getByCategoryId', { categoryId: 'security' });
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="web-engine",s="3.3.
|
|
1
|
+
var e="web-engine",s="3.3.421",o="UNLICENSED",r="module",t="src/main.js",l=["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",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:vitest":"vitest run"},i=["defaults"],n={react:"^18.3.1"},c={"@azure/event-hubs":"^5.12.2","@dnd-kit/core":"^6.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.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.5.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.6","@turf/area":"^7.2.0","@turf/bbox-clip":"^7.2.0","@turf/bbox-polygon":"^7.2.0","@turf/circle":"^7.2.0","@turf/helpers":"^7.2.0","@turf/point-to-line-distance":"^7.2.0","@vitejs/plugin-react":"^4.3.4","axe-core":"^4.10.3",browserslist:"^4.24.4","crypto-browserify":"^3.12.1","cypress-axe":"^1.6.0","cypress-multi-reporters":"^2.0.5","cypress-real-events":"^1.14.0","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^20.6.1","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"6.0.2",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^2.9.2","mocha-junit-reporter":"^2.2.1",mochawesome:"^7.1.3","node-polyfill-webpack-plugin":"^4.1.0","path-browserify":"^1.0.1",polished:"^4.3.1","prop-types":"^15.8.1","query-string":"^9.1.1",ramda:"^0.30.1",react:"^18.3.1","react-compound-slider":"^3.4.0","react-dom":"^18.3.1","react-json-editor-ajrm":"^2.5.14","react-qr-svg":"^2.4.0","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","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-cypress":"^3.51.0","@babel/core":"^7.26.10","@babel/eslint-parser":"^7.26.10","@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.26.3","@babel/plugin-transform-runtime":"^7.26.10","@babel/preset-env":"^7.26.9","@babel/preset-react":"^7.26.3","@testing-library/jest-dom":"^6.6.3","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","babel-jest":"^29.7.0","babel-loader":"^10.0.0","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^5.0.2","babel-plugin-styled-components":"^2.1.4","babel-polyfill":"^6.26.0","chai-colors":"^1.0.1","css-loader":"^7.1.2",cypress:"^14.2.0","cypress-browser-permissions":"^1.1.0","cypress-wait-until":"^3.0.2",eslint:"^8.57.1","eslint-config-standard":"^17.1.0","eslint-import-resolver-typescript":"^3.9.1","eslint-plugin-cypress":"^2.15.2","eslint-plugin-import":"^2.31.0","eslint-plugin-jest":"^28.11.0","eslint-plugin-n":"^17.16.2","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.2.0","eslint-plugin-react":"^7.37.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.5.1",glob:"^11.0.1",husky:"^9.1.7",jest:"29.7.0","jest-environment-jsdom":"^29.7.0","lint-staged":"^15.5.0","node-fetch":"^2.7.0","null-loader":"^4.0.1",nx:"19.8.14","nx-remotecache-azure":"^19.0.0","os-browserify":"^0.3.0","start-server-and-test":"^2.0.11",typescript:"^5.8.2",vite:"^4.3.9",vitest:"^2.1.9","webpack-merge":"^6.0.1"},d="yarn@4.7.0",m={node:"22.x"},u={},b={name:e,version:s,private:!0,license:o,type:r,main:t,workspaces:l,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,r as type,s as version,l as workspaces};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import n from"zousan";import{processParkingPOIS as e,processOpenClosedPois as t,processSecurityWaitTimes as a,mutateSecurityCheckpointLabel as s,processRoutingPois as o}from"./processors.js";let c=3e4;const i="x-account-id";function u(u,r={}){const d={dynamicDataNotPending:new n},l=u.gt();r._overrideRefreshFrequency&&(c=r._overrideRefreshFrequency),u.bus.on("system/readywhenyouare",(()=>d.dynamicDataNotPending));const p=async n=>{const e={};for(const t of n){const n=await u.bus.get("poi/getById",{id:t});n&&(e[t]=n.name)}return e};return{init:async()=>{const[n,r]=await Promise.all([u.bus.get("venueData/getAccountId"),u.bus.get("venueData/getVenueId")]),y=`https://marketplace.locuslabs.com/venueId/${r}/dynamic-poi`;let m,f=0,g=0;const D=async()=>{const c=await fetch(y,{headers:{[i]:n}});if(c.ok)return c.json().then((({data:n})=>async function(n){(function(n){const t=e(n);u.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:t})})(n),function(n){const e=t(n);u.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:e})}(n),async function(n){const e=a(n);u.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:e});const t=await p(Object.keys(e));u.bus.send("map/mutateFeature",{functor:s(l,e,t)})}(n),async function(n){const e=await o(n);u.bus.send("poi/setDynamicRouting",{plugin:"routing",idValuesMap:e})}(n)}(n))).then((()=>{g++})).catch(console.error);console.warn("dynamicPois: fetch response status not ok",c),f++,f>=3&&f>g&&clearInterval(m)};return D().then((()=>{m=setInterval(D,c)})).finally((()=>d.dynamicDataNotPending.resolve(!0)))}}}export{u as create};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as t from"ramda";const e=(t,e,a)=>i=>{const r=i.properties.id,o=e[r],n=a[r];if(o){const{queueTime:e,isTemporarilyClosed:a}=o,r=a?t("ui:Closed"):t("ui:_xx_ minute wait",{count:e});i.properties.text=`${n}\n${r}`}return i},a=e=>t.pipe(t.filter((t=>"parking"===t.category)),t.map((e=>{const a=e.dynamicAttributes;if(!a)throw Error(`No dynamicAttributes defined for parking POI ${e.poiId}`);return{...(Date.now()-e.timestamp)/1e3<a["parking.timeToLive"]?t.pick(["lotStatus","rateDay","rateHour","timeIsReal","timeToTerminal1","timeToTerminal2"],e):{lotStatus:a["parking.default"],rateDay:"$ -",rateHour:"$ -",timeIsReal:!1},lastUpdated:e.timestamp,lotName:e.lotName}})))(e),i=e=>{const a=["dynamicData","openClosed"],i=t.filter(t.hasPath(a),e),r=t.map(t.path(a),i);if(t.all(t.both(t.has("isOpen"),t.has("expiration")),t.values(r))){const e=t.pipe(t.prop("expiration"),t.lt(Date.now()));return t.filter(e,r)}throw Error("Open Closed poi status is malformed.")},r=e=>{const a=["dynamicData","queue"],i=t.filter(t.hasPath(a),e),r=t.map(t.path(a),i);return t.map((t=>({isTemporarilyClosed:t.isTemporarilyClosed,queueTime:t.queueTime,timeIsReal:!t.isQueueTimeDefault&&t.expiration>Date.now(),lastUpdated:Date.now()})),r)},o=e=>{const a=Date.now();return t.filter((e=>{const i=t.path(["dynamicData","dynamic-routing","navGraphHidden"],e),r=t.path(["dynamicData","dynamic-routing","expiration"],e);return!0===i&&r>a}),e)};export{e as mutateSecurityCheckpointLabel,i as processOpenClosedPois,a as processParkingPOIS,o as processRoutingPois,r as processSecurityWaitTimes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"ramda";import n from"zousan";import{buildStructuresLookup as o}from"../../../src/utils/buildStructureLookup.js";import{distance as i}from"../../../src/utils/geodesy.js";import{findRoute as e}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 i=o(n),e=await y(),a=r(t,i.floorIdToOrdinal,i.floorIdToStructureId,e),
|
|
1
|
+
import*as t from"ramda";import n from"zousan";import{buildStructuresLookup as o}from"../../../src/utils/buildStructureLookup.js";import{distance as i}from"../../../src/utils/geodesy.js";import{findRoute as e}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 i=o(n),e=await y(),a=r(t,i.floorIdToOrdinal,i.floorIdToStructureId,e);f.resolve(a)})),l.bus.on("poi/setDynamicRouting",(async({idValuesMap:t})=>{const n=await f,o=Object.values(t).map((t=>n.findClosestNode(t.position.floorId,t.position.latitude,t.position.longitude).id));n.addNodesToAvoid(o)}));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 i=await b({fromEndpoint:t,toEndpoint:n,options:o});if(i){const{segments:t}=i;o.primary&&l.bus.send("map/resetNavlineFeatures"),l.bus.send("map/showNavlineFeatures",{segments:t,category:o.primary?"primary":"alternative"})}return i}(await l.bus.getFirst("user/getPhysicalLocation"),t,{selectedSecurityLanes:n,requiresAccessibility:o,primary:!0})));const I=(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"],h=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 i=await l.bus.get("poi/getAll")||{},r=Array.isArray(i)?i[0]:i,a=Object.values(r).filter((t=>t.category&&t.category.startsWith("security")));return f.then((async i=>{o.compareFindPaths=d.compareFindPaths;const r=e(i,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:I}=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)),h=Math.round(r.waypoints.reduce(((t,{distance:n})=>t+n),0));return{...r,segments:I,steps:m,time:g,distance:h}}))}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 I(t,n.floorIdToOrdinal);if("string"==typeof t){if(t.match(/^\d+$/))return I(parseInt(t),n.floorIdToOrdinal);if(t.indexOf(",")>0){let[o,i,e,r]=t.split(",");if(!n.floorIdToStructureId(e))throw Error("Unknown floorId in endpoint: "+e);return r||(r="Starting Point"),{lat:parseFloat(o),lng:parseFloat(i),ordinal:n.floorIdToOrdinal(e),floorId:e,title:r}}}if(h(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:i={}})=>f.then((r=>{i.compareFindPaths=d.compareFindPaths;const a=e(r,n,o,i);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,i,e){let r=t.clone(n);return r=O(r,i,e),o&&o.length?{...r,transitTime:E(o,"transitTime"),distance:E(o,"distance")}:(r.distance="start"===e?S(r,i):S(i,r),r.transitTime=L(r.distance),r)}function E(n,o){return t.aperture(2,n).map((([n,o])=>{return(i=o.id,n=>t.find((t=>t.dst===i),n.edges))(n);var i})).map(t.prop(o)).reduce(((t,n)=>t+n),0)}function O(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 S(t,n){return i(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 P(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?E(t,"transitTime"):L(n)}function q(t,n,o){return t&&t.length?E(t,"distance"):S(o,n)}return l.bus.on("wayfinder/addPathTimeMultiple",(async({pois:n,startLocation:o,options:i={}})=>o?f.then((e=>function(n,o,i,e){try{const r=t.clone(i),a=r.map((t=>w(t,n.floorIdToOrdinal))),s=n.findAllShortestPaths(e,a,o);return P(r.map(((t,n)=>v(t,s[n],e,"start"))))}catch(t){return p.error(t),i}}(e,i,n,o))):n)),l.bus.on("wayfinder/multipointAddPathTimeMultiple",(async({pois:n,startLocation:o,endLocation:i,currentLocation:e,options:r={}})=>o||i||e?f.then((a=>function(n,o,i,e,r,a){try{const s=e?w(e,n.floorIdToOrdinal):a,u=r?w(r,n.floorIdToOrdinal):null,l=t.clone(i),d=l.map((t=>w(t,n.floorIdToOrdinal)));let p,c,f;return s&&(p=n.findAllShortestPaths(s,d,o)),u&&(c=function(t,n,o,i){const e=[];for(const r of n)e.push(t.findShortestPath(r,o,i));return e}(n,d,u,o)),f=s&&u?l.map(((n,o)=>function(n,o,i,e,r){const a=q(o,e,n),s=q(i,n,r);if(!a||!s)return null;const u=N(o,a),l=N(i,s);let d=t.clone(n);return d=O(d,e,"start"),d=O(d,r,"end"),{...d,transitTime:u+l,distance:a+s,startInformation:{...d.startInformation,transitTime:u,distance:a},endInformation:{...d.endInformation,transitTime:l,distance:s}}}(n,p[o],c[o],s,u))):s?l.map(((t,n)=>v(t,p[n],s,"start"))):l.map(((t,n)=>v(t,c[n],u,"end"))),P(f)}catch(t){return p.error(t),i}}(a,r,n,o,i,e))):n)),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