atriusmaps-node-sdk 3.2.10 → 3.2.21
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/README.md +10 -2
- package/config/rollup.config.cjs.js +31 -0
- package/dist/cjs/_virtual/_empty_module_placeholder.js +5 -0
- package/dist/cjs/deploy/nodeEntry.js +15 -0
- package/dist/cjs/deploy/prepareSDKConfig.js +9 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/package.json.js +11 -0
- package/dist/cjs/plugins/clientAPI/src/clientAPI.js +9 -0
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +33 -0
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +36 -0
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +31 -0
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +13 -0
- package/dist/cjs/plugins/sdkServer/src/util.js +10 -0
- package/dist/cjs/plugins/searchService/src/poiSearch.js +28 -0
- package/dist/cjs/plugins/searchService/src/searchService.js +37 -0
- package/dist/cjs/plugins/searchService/src/searchTypeahead.js +8 -0
- package/dist/cjs/plugins/searchService/src/utils.js +13 -0
- package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +36 -0
- package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +33 -0
- package/dist/cjs/plugins/wayfinder/src/findRoute.js +30 -0
- package/dist/cjs/plugins/wayfinder/src/minPriorityQueue.js +5 -0
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +13 -0
- package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +30 -0
- package/dist/cjs/plugins/wayfinder/src/segmentBadges.js +5 -0
- package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +32 -0
- package/dist/cjs/plugins/wayfinder/src/segmentCategories.js +5 -0
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +10 -0
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +40 -0
- package/dist/cjs/src/app.js +44 -0
- package/dist/cjs/src/auth/Auth.js +23 -0
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +9 -0
- package/dist/cjs/src/configs/postproc-stateTracking.js +31 -0
- package/dist/cjs/src/configs/sdkHeadless.json.js +47 -0
- package/dist/cjs/src/controller.js +14 -0
- package/dist/cjs/src/debugTools.js +30 -0
- package/dist/cjs/src/env.js +7 -0
- package/dist/cjs/src/extModules/bustle.js +13 -0
- package/dist/cjs/src/extModules/flexapi/src/help.js +9 -0
- package/dist/cjs/src/extModules/flexapi/src/index.js +13 -0
- package/dist/cjs/src/extModules/flexapi/src/validate.js +10 -0
- package/dist/cjs/src/extModules/geohasher.js +8 -0
- package/dist/cjs/src/extModules/log.js +7 -0
- package/dist/cjs/src/historyManager.js +7 -0
- package/dist/cjs/src/utils/bounds.js +10 -0
- package/dist/cjs/src/utils/buildStructureLookup.js +29 -0
- package/dist/cjs/src/utils/configUtils.js +8 -0
- package/dist/cjs/src/utils/dom.js +10 -0
- package/dist/cjs/src/utils/funcs.js +15 -0
- package/dist/cjs/src/utils/geodesy.js +8 -0
- package/dist/cjs/src/utils/geom.js +35 -0
- package/dist/cjs/src/utils/i18n.js +14 -0
- package/dist/cjs/src/utils/observable.js +5 -0
- package/dist/cjs/src/utils/rand.js +8 -0
- package/lib/deploy/nodeEntry.js +1 -1
- package/lib/deploy/prepareSDKConfig.js +1 -1
- package/lib/package.json.js +1 -1
- package/lib/plugins/dynamicPois/src/dynamicPois.js +1 -1
- package/lib/plugins/poiDataManager/src/poiDataManager.js +1 -1
- package/lib/plugins/sdkServer/src/sdkHeadless.js +1 -1
- package/lib/plugins/sdkServer/src/sdkServer.js +1 -1
- package/lib/plugins/sdkServer/src/util.js +1 -1
- package/lib/plugins/venueDataLoader/src/venueDataLoader.js +1 -1
- package/lib/plugins/venueDataLoader/src/venueLoadingUtils.js +1 -1
- package/lib/plugins/wayfinder/src/navGraph.js +1 -1
- package/lib/plugins/wayfinder/src/segmentBuilder.js +1 -1
- package/lib/plugins/wayfinder/src/stepBuilder.js +1 -1
- package/lib/plugins/wayfinder/src/wayfinder.js +1 -1
- package/lib/src/app.js +1 -1
- package/package.json +21 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setDeepLinksForParms as e}from"../src/configs/postproc-mol-url-parms.js";import{setStateFromStateString as t}from"../src/configs/postproc-stateTracking.js";import{filterOb as o}from"../src/utils/funcs.js";function i(i){const{name:n,debug:r,headless:
|
|
1
|
+
import{setDeepLinksForParms as e}from"../src/configs/postproc-mol-url-parms.js";import{setStateFromStateString as t}from"../src/configs/postproc-stateTracking.js";import{filterOb as o}from"../src/utils/funcs.js";function i(i){const{name:n,debug:r,headless:a,theme:c,defaultSearchTerms:p,venueId:d,accountId:l,poiCategories:u,preserveStateInURL:h,supportURLDeepLinks:g,initState:m,deepLinkParms:f,uiHide:k,renderDiv:v,parentConfig:S,desktopViewMinWidth:P,forceDesktop:A,hostAppId:V,hostAppVersion:b,hostAppProperties:I,logFilter:L,searchPlaceholder:j}=i,w=S?[S]:a?["sdkHeadless"]:["sdkVisual"],y=(e,t)=>e&&e.length>t?e.substring(0,t):e,D={name:n,extends:w,debug:r,logFilter:L,theme:c,uiHide:k,renderDiv:v,configPostProc:[],plugins:{venueDataLoader:{venueId:d,accountId:l},sdkServer:{headless:a},analytics2:{hostAppId:(e=>e?y(e.toString(),128):void 0)(V),hostAppVersion:(e=>e?y(e.toString(),128):void 0)(b),hostAppProperties:(e=>{if(!e||"object"!=typeof e)return;const t={},o=Object.keys(e);return o.length>10&&(o.length=10),o.forEach((o=>{let i=y(o.toString().replaceAll(/[^a-zA-Z0-9_]/g,""),128);i.match(/^[a-zA-Z]+/)||(i="X"+i);let s=e[o];null==s&&(s=""),s=y(s.toString(),128),t[i]=s})),t})(I)}},uuid:"undefined"!=typeof document&&document&&document.location?document.location.host:"unknown"};return a||(D.plugins["online/headerOnline"]={searchPlaceholder:j}),D.plugins.searchService=p?{defaultSearchTerms:p}:{},s(i,"defaultSearchTerms",D.plugins.searchService),w.includes("sdkVisual")&&(D.plugins["online/homeView"]=u?{poiCategories:u}:{},s(i,"poiCategories",D.plugins["online/homeView"])),h&&(D.configPostProc.push("stateTracking"),D.plugins.deepLinking={trackURL:!0}),g&&D.configPostProc.push("mol-url-parms"),m&&t(D,atob(m),!0),f&&e(D,f,!0),void 0!==P&&(D.desktopViewMinWidth=P),A&&(D.desktopViewMinWidth=0),o(((e,t)=>void 0!==t),D)}function s(e,t,o){Object.keys(e).filter((e=>e.startsWith(t+"-"))).forEach((t=>o[t]=e[t]))}export default i;
|
package/lib/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="web-engine",s="3.2.
|
|
1
|
+
var e="web-engine",s="3.2.21",o="src/main.js",l="module",a={demo:"cd demo/ && yarn start",e2eTest:"percy exec -- cypress run --browser chrome",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh",mod:"demo/startMod.sh",mol:"demo/startMol.sh",mos:"demo/startMos.sh",prepare:"husky install",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch"},t={"@aws-amplify/auth":"^4.1.2","@azure/event-hubs":"^5.6.0","@john-osullivan/react-window-dynamic-fork":"^1.9.0-alpha.1","@locus-labs/mod-badge":"^0.1.11","@locus-labs/mod-default-theme":"^0.0.27","@locus-labs/mod-footer":"^0.0.25","@locus-labs/mod-header":"^0.0.19","@locus-labs/mod-location-marker":"^0.0.18","@locus-labs/mod-map-legend":"^0.0.18","@locus-labs/mod-offscreen-indicator":"^0.0.18","@locus-labs/mod-pin":"^0.0.18","@locus-labs/mod-qr-code-card":"^0.0.18","@locus-labs/mod-qr-code-window":"^0.0.19","@locus-labs/mod-walk-time-matrix":"^0.0.17","@locus-labs/mol-desktop-building-level-selector":"^0.1.15","@locus-labs/mol-desktop-compass":"^0.1.29","@locus-labs/mol-desktop-default-theme":"^0.2.13","@locus-labs/mol-desktop-icon":"^0.1.45","@locus-labs/mol-desktop-logo":"^0.1.10","@locus-labs/mol-desktop-map-nav-button":"^0.1.39","@locus-labs/mol-desktop-submenu":"^0.1.30","@locus-labs/mol-desktop-tooltip":"^0.3.11","@locus-labs/mol-desktop-zoom-control":"^0.1.37","@locus-labs/mol-mobile-floating-action-button":"^0.0.20","@locus-labs/mol-mobile-toast":"^0.1.11","@turf/circle":"^6.5.0",IObject:"^0.6.2","crypto-browserify":"^3.12.0","file-loader":"^6.2.0",flexsearch:"0.6.32",i18next:"^20.3.4","i18next-browser-languagedetector":"^6.1.1",jsonschema:"^1.2.6",luxon:"^2.0.1","mapbox-gl":"^1.12.0","mini-css-extract-plugin":"^1.6.0",msal:"1.4.11","node-polyfill-webpack-plugin":"^1.1.4","path-browserify":"^1.0.1",polished:"^4.0.2","prop-types":"^15.7.2","query-string":"7.0.1",ramda:"^0.27.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":"^11.2.5","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"},r={"@babel/core":"^7.14.8","@babel/plugin-proposal-class-properties":"^7.8.3","@babel/plugin-syntax-dynamic-import":"^7.8.3","@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","babel-eslint":"^10.0.1","babel-jest":"^27.0.6","babel-loader":"^8.2.2","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^4.0.0","babel-polyfill":"^6.26.0","chai-colors":"^1.0.1","css-loader":"^5.2.4",cypress:"^7.4.0","cypress-wait-until":"^1.7.1",eslint:"^7.4.0","eslint-config-standard":"^16.0.3","eslint-plugin-cypress":"^2.11.1","eslint-plugin-import":"^2.16.0","eslint-plugin-jest":"^24.3.6","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",husky:"^6.0.0",jest:"^26.0.0","jest-transform-css":"^2.0.0","lint-staged":"^11.0.1","node-fetch":"^2.6.0","null-loader":"^4.0.1",webpack:"^5.45.1","webpack-merge":"^5.8.0"},c="UNLICENSED",n=["demo","deploy","pageSrc","src/extModules/flexapi"],i={name:"web-engine",version:"3.2.21",main:"src/main.js",type:"module",scripts:a,dependencies:t,devDependencies:r,"lint-staged":{"*.js":["eslint --fix"]},license:"UNLICENSED",workspaces:n,private:!0};export default i;export{t as dependencies,r as devDependencies,c as license,o as main,e as name,a as scripts,l as type,s as version,n as workspaces};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"ramda";import t from"zousan";function a(a,n){let i=new t;function
|
|
1
|
+
import*as e from"ramda";import t from"zousan";function a(a,n){let s=new t;const i=new t;function o(t,n){const s=e.pipe(e.filter((e=>"parking"===e.category)),e.map((a=>{const n=a.dynamicAttributes;if(!n)throw Error(`No dynamicAttributes defined for parking POI ${a.poiId}`);return{...(t-a.timestamp)/1e3<n["parking.timeToLive"]?e.pick(["lotStatus","rateDay","rateHour","timeIsReal","timeToTerminal1","timeToTerminal2"],a):{lotStatus:n["parking.default"],rateDay:"$ -",rateHour:"$ -",timeIsReal:!1},lastUpdated:a.timestamp,lotName:a.lotName}})))(n);a.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:s})}function r(t,n){const s=e.pipe(e.map((e=>[e.poiId,u(t,e)])),e.fromPairs)(n);a.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:s})}const u=(e,t)=>({queueTime:t.queueTime,isTemporarilyClosed:t.isTemporarilyClosed,timeIsReal:!t.isQueueTimeDefault&&t.expiration>e,lastUpdated:e});return a.bus.on("venueData/venueDataLoaded",(({venueData:e})=>{s.v?s=t.resolve(e):s.resolve(e)})),a.bus.on("sdk/readyWhenYouAre",(()=>i)),{init:async()=>{const e=n.urlBase||"https://rest.locuslabs.com/v3",t=n.urlBase||"https://rest.locuslabs.com/v1",u=a.config.plugins.venueDataLoader.accountId;async function c(){return s.then((e=>{let a=`${t}/venue/${e.id}/account/${u}/get-all-dynamic-pois/`;return(t.startsWith("./")||t.endsWith(".json"))&&(a=t),a}))}const l=async()=>s.then((t=>e.startsWith("./")||e.endsWith(".json")?e:`${e}/venueId/${t.id}/accountId/${u}/get-dynamic-queue-times/`)),m=async()=>{Promise.all([c().then(fetch).then((e=>e.json())).then((e=>o(Date.now(),e))),l().then(fetch).then((e=>e.json())).then((e=>r(Date.now(),e)))]).then((()=>i.resolve(!0))).catch((e=>{console.error(e),i.resolve(!0)}))},p=await a.bus.get("venueData/getQueueTypes");p.SecurityLane&&p.SecurityLane.length?s.then(m).then((()=>setInterval(m,3e4))):i.resolve(!0)},internal:{processSecurityWaitTimes:r,processParkingPOIS:o}}}export{a as create};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as o from"ramda";import e from"zousan";import{buildStructuresLookup as t}from"../../../src/utils/buildStructureLookup.js";import{debugIsTrue as i}from"../../../src/utils/configUtils.js";import{toLang as a}from"../../../src/utils/i18n.js";async function n(a,n){const s=()=>{a.bus.send("venueData/loadPoiData")};let
|
|
1
|
+
import*as o from"ramda";import e from"zousan";import{buildStructuresLookup as t}from"../../../src/utils/buildStructureLookup.js";import{debugIsTrue as i}from"../../../src/utils/configUtils.js";import{toLang as a}from"../../../src/utils/i18n.js";async function n(a,n){const s=a.log.sublog("poiDataManager"),u=()=>{a.bus.send("venueData/loadPoiData")};let p=new e;const d=(o,e)=>{const{position:t}=o,i=e.floorIdToStructure(t.floorId);if(!i)return s.error(`No structure found for floorId: ${t.floorId} for POI ${o.poiId}`),{...o};const a=e.floorIdToFloor(t.floorId),n={...t,structureName:i.name,buildingId:i.id,floorName:a.name,floorOrdinal:a.ordinal};return{...o,position:n}},c=(o,e)=>{o.roomInfo||(o.roomInfo=[]),o.roomInfo.push(e)},l=o.pipe(o.propOr([],"externalIds"),o.find(o.propEq("type","roomId")),o.prop("id"),o.unless(o.isNil,o.tail));a.bus.on("venueData/poiDataLoaded",(({pois:e,structures:n})=>{if(e=((e,t)=>o.pipe(o.values,o.map((o=>{o.distance=null,o.isNavigable=void 0===o.isNavigable||!0===o.isNavigable,o.capacity&&c(o,{name:`Seats ${o.capacity.join("-")}`,svgId:"number-of-seats"}),o.category.startsWith("meeting")&&c(o,{name:a.gt()("poiView:Conference Room"),svgId:"conference-room"});const e=l(o);return e&&(o.roomId=e),[o.poiId,d(o,t)]})),o.fromPairs)(e))(e,t(n)),i(a,"pseudoTransPois"))for(const o in e)e[o]=r(e[o],a.i18n().language);(async function(o){for(const e of Object.values(o))await y(e)})(e=function(o){const e=[];return Object.values(o).forEach((o=>{try{const t=o.position;t?["buildingId","structureName","floorId","floorName","floorOrdinal","latitude","longitude"].forEach((i=>{null!==t[i]&&void 0!==t[i]||e.push({id:o.poiId,e:`invalid position property: ${i}: ${t[i]}`})})):e.push({poi:o,e:"No position information"})}catch(t){s.error(t),e.push({id:o.poiId,e:t.message})}})),e.length&&(s.warn("badPois:",e),e.forEach((e=>{delete o[e.id]}))),o}(e)),p.resolve(e),a.config.debug&&a.env.isBrowser&&(window._pois=e),a.config.debug&&async function(o){const e=Date.now(),t=[],i=await a.bus.get("wayfinder/_getNavGraph");Object.values(o).forEach((o=>{try{const e=o.position;i.findClosestNode(e.floorId,e.latitude,e.longitude)||t.push({id:o.poiId,e:"No closest Navgraph Node"})}catch(e){s.error(e),t.push({id:o.poiId,e:e.message})}})),t.length&&s.warn("badPois:",t),s(`Total time for navgraph POI check: ${Date.now()-e}ms`)}(e)})),a.bus.on("poi/getById",(async({id:o})=>p.then((e=>e[o])))),a.bus.on("poi/getByFloorId",(async({floorId:e})=>p.then(o.pickBy(o.pathEq(["position","floorId"],e))))),a.bus.on("poi/getByCategoryId",(async({categoryId:e})=>p.then(o.pickBy((o=>o.category===e||o.category.startsWith(e+".")))))),a.bus.on("poi/getAll",(async()=>p));const m=["queue","primaryQueueId"],f=(e,t,i)=>{const a=o.path(["queue","queueType"],t);if(!a)return null;const n=e[a],r=o.path(m,t);return i.filter(o.pathEq(m,r)).filter((o=>o.poiId!==t.poiId)).map((e=>{const t=o.path(["queue","queueSubtype"],e),i=g(t)(n);return{poiId:e.poiId,...i}}))},g=e=>o.pipe(o.find(o.propEq("id",e)),o.pick(["displayText","imageId"]));async function y(t){if(t)return o.length(t.images)?t.images[0].startsWith("https:")||(t.images=await e.all(t.images.map((o=>a.bus.get("venueData/getPoiImageUrl",{imageName:o,size:"480x320"}))))):t.images=[],t}a.bus.on("poi/addOtherSecurityLanes",(({poi:e})=>(async e=>{if(!o.path(m,e))return e;const t=await a.bus.get("venueData/getQueueTypes"),i=await a.bus.get("poi/getByCategoryId",{categoryId:"security"}),n=Object.values(i);return e.queue.otherQueues=f(t,e,n),e})(e)));const I=o.memoizeWith(o.identity,o.pipe(o.pluck("category"),o.values,o.uniq));a.bus.on("poi/getAllCategories",(async()=>p.then(I))),a.bus.on("venueData/loadNewVenue",(()=>{p=new e,u()})),a.bus.on("poi/setDynamicData",(({plugin:e,idValuesMap:t})=>{p.then((i=>{for(const a in t){const n=i[a].dynamicData||{};n[e]={...t[a]};const r=o.mergeRight(i[a],{dynamicData:n});i[a]=r}}))}));return{init:u,runTest:async o=>(await o(),p),internal:{addImages:y,pseudoTransPoi:r}}}function r(o,e){return["description","nearbyLandmark","name","phone","operationHours"].forEach((t=>{o[t]&&(o[t]=a(o[t],e))})),o.keywords&&(o.keywords=o.keywords.map((o=>(o.name=a(o.name,e),o)))),o.position.floorName&&(o.position.floorName=a(o.position.floorName,e)),o.position.structureName&&(o.position.structureName=a(o.position.structureName,e)),o}export{n as create};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"ramda";import{locationToEndpoint as t,getStructures as n}from"./util.js";const
|
|
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:"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 a(s){s.bus.on("clientAPI/destroy",(async()=>s.destroy())),s.bus.on("clientAPI/getDirections",(async({from:n,to:a,accessible:o,queueTypes:i})=>{const r=await t(s,n),c=await t(s,a),u={requiresAccessibility:!!o};return i&&(u.selectedSecurityLanes={SecurityLane:i}),s.bus.get("wayfinder/getRoute",{fromEndpoint:r,toEndpoint:c,options:u}).then(e.pick(["distance","time","steps","navline"]))})),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 a=e=>"function"!=typeof e;s.bus.on("clientAPI/getVenueData",(async()=>{const t=await s.bus.get("venueData/getVenueData");return e.filter(a,t)})),s.bus.on("clientAPI/search",(async({term:e,details:t})=>s.bus.get("search/queryAsync",{term:e}).then((n=>{const a=n.map((e=>e.poiId));return s.bus.send("event/search",{referrer:"prog",searchMethod:null,query:e,entities:a}),t?n:a}))))}export{a as handleHeadless,s as headlessCommands};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getBuildingAndFloorAtPoint as e}from"../../../src/utils/geom.js";import t from"../../../src/utils/observable.js";import{headlessCommands as o,handleHeadless as n}from"./sdkHeadless.js";let a
|
|
1
|
+
import{getBuildingAndFloorAtPoint as e}from"../../../src/utils/geom.js";import t from"../../../src/utils/observable.js";import{headlessCommands as o,handleHeadless as n}from"./sdkHeadless.js";let a=null;function s(e){const t=(e,t)=>{const o={payload:e,type:"LL-server"};t&&(o.clientMsgId=t);try{window.postMessage(o,"*")}catch(e){window.postMessage((e=>JSON.parse(JSON.stringify(e)))(o),"*")}};function o(o){const n=o.data;n&&"LL-client"===n.type&&e.bus.get("clientAPI/execute",n.payload).then((e=>t(e,n.msgId))).catch((t=>{e.config.debug&&console.error(t),((e,t)=>{const o={error:!0,payload:e,type:"LL-server"};t&&(o.clientMsgId=t),window.postMessage(o,"*")})(t.message,n.msgId)}))}return a&&a(),window.addEventListener("message",o),a=()=>window.removeEventListener("message",o),(e,t)=>{const o={event:e,payload:t,type:"LL-server"};window.postMessage(o,"*")}}async function r(a,r){const i=a.env.isBrowser?s(a):function(e){const o=t();return e.eventListener=o,(e,t)=>o.fire(e,t)}(a);return function(t,o){t.bus.monitor("map/userMoveStart",(async({pitch:e,zoom:n,bearing:a})=>{const{lat:s,lng:r,floorId:i,ordinal:l,structureId:d}=await t.bus.get("map/getMapCenter");o("userMoveStart",{lat:s,lng:r,floorId:i,ord:l,structureId:d,pitch:e,zoom:n,bearing:a})})),t.bus.monitor("map/userMoving",(async({pitch:e,zoom:n,bearing:a})=>{const{lat:s,lng:r,floorId:i,ordinal:l,structureId:d}=await t.bus.get("map/getMapCenter");o("userMoving",{lat:s,lng:r,floorId:i,ord:l,structureId:d,pitch:e,zoom:n,bearing:a})})),t.bus.monitor("map/moveEnd",(async({pitch:e,zoom:n,bearing:a})=>{const{lat:s,lng:r,floorId:i,ordinal:l,structureId:d}=await t.bus.get("map/getMapCenter");o("moveEnd",{lat:s,lng:r,floorId:i,ord:l,structureId:d,pitch:e,zoom:n,bearing:a})})),t.bus.monitor("map/floorChanged",(({structure:e,floor:t})=>o("levelChange",{floorId:t?t.id:null,floorName:t?t.name:null,ord:t?t.ordinal:null,structureId:e?e.id:null,structureName:e?e.name:null}))),t.bus.monitor("map/poiClicked",(({poi:e})=>o("poiSelected",e))),t.bus.monitor("map/click",(async({lat:n,lng:a,ord:s})=>{const r=await t.bus.get("venueData/getStructures"),{building:i,floor:l}=e(r,n,a,s,!0);o("mapClicked",{lat:n,lng:a,ord:s,building:i,floor:l})}))}(a,i),{init:async()=>{!function(e){e.bus.send("clientAPI/registerCustomType",{name:"latLngOrdLocation",spec:{type:"object",props:[{name:"lat",type:"float"},{name:"lng",type:"float"},{name:"ord",type:"integer"}]}}),e.bus.send("clientAPI/registerCustomType",{name:"latLngFloorLocation",spec:{type:"object",props:[{name:"lat",type:"float"},{name:"lng",type:"float"},{name:"floorId",type:"string"}]}}),e.bus.send("clientAPI/registerCustomType",{name:"poiIdLocation",spec:{type:"object",props:[{name:"poiId",type:"integer",min:0}]}}),e.bus.send("clientAPI/registerCustomType",{name:"location",spec:{type:"multi",types:[{type:"poiIdLocation"},{type:"latLngOrdLocation"},{type:"latLngFloorLocation"}]}}),e.bus.send("clientAPI/registerCustomType",{name:"viewSettings",spec:{type:"object",props:[{name:"zoom",type:"float",optional:!0},{name:"pitch",type:"float",optional:!0},{name:"bearing",type:"float",optional:!0}]}})}(a),o.forEach((e=>a.bus.send("clientAPI/registerCommand",e))),n(a),r.headless||await import("../../../_virtual/_empty_module_placeholder").then((e=>{e.visualCommands.forEach((e=>a.bus.send("clientAPI/registerCommand",e))),e.handleVisual(a)}));const e=async()=>{await a.bus.send("sdk/readyWhenYouAre"),a.bus.get("clientAPI/execute",{command:"getCommandJSON"}).then((e=>i("ready",{commandJSON:e}))),!r.headless&&a.config.uiHide&&a.config.uiHide.sidebar&&a.env.isDesktop()&&a.bus.send("map/changePadding",{padding:{left:55,right:55,top:72,bottom:22}})};r.headless?Promise.all([new Promise((e=>a.bus.monitor("venueData/navGraphLoaded",e))),new Promise((e=>a.bus.monitor("venueData/poiDataLoaded",e)))]).then(e):a.bus.on("map/mapReadyToShow",e)}}}export{r as create};
|
|
@@ -1 +1 @@
|
|
|
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(),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};
|
|
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"ramda";import a from"zousan";import t from"../../../src/auth/Auth.js";import{delay as n}from"../../../src/utils/funcs.js";import{getVenueDataFromUrls as s,buildStructures as u,createFetchJson as o,createFetchText as r}from"./venueLoadingUtils.js";async function i(i,l){const d=i.log.sublog("venueDataLoader");let c=new a,p=new a;const g=a=>a.defaultStructureId||e.path(["structureOrder",0],a)||e.path(["selectorOrder",0],a)||e.pipe(e.prop("structures"),Object.values,e.path([0,"id"]))(a);const v=e=>{const a=l.availableLanguages.find((a=>a.langCode===e));return a||{langCode:e,assetSuffix:""}};async function f(a){a.assetStage&&"prod"!==a.assetStage&&location.hostname;const l=a.auth?await async function(e){const a=await t(e,i);let s=null,u=0;for(;!s&&u<6;)s=await a.getToken(),u++,s||await n(500)();return s?(i.bus.send("login/userLoggedIn",{token:s}),i.bus.on("app/logout",a.logout),s):i.bus.get("login/showLogin",{auth:a})}(a.auth):null,p=o(l),f=r(l),b=await s(a,p),{accountId:m,venueId:h}=a;b.assetStage=a.assetStage,b.defaultOrdinal=b.defaultOrdinal||function(a){const t=g(a),n=Object.values(a.structures).find(e.propEq("id",t));return n.levels[n.defaultLevelId].ordinal}(b),b.structures=u(b);const
|
|
1
|
+
import*as e from"ramda";import a from"zousan";import t from"../../../src/auth/Auth.js";import{delay as n}from"../../../src/utils/funcs.js";import{getVenueDataFromUrls as s,buildStructures as u,createFetchJson as o,createFetchText as r}from"./venueLoadingUtils.js";async function i(i,l){const d=i.log.sublog("venueDataLoader");let c=new a,p=new a;const g=a=>a.defaultStructureId||e.path(["structureOrder",0],a)||e.path(["selectorOrder",0],a)||e.pipe(e.prop("structures"),Object.values,e.path([0,"id"]))(a);const v=e=>{const a=l.availableLanguages.find((a=>a.langCode===e));return a||{langCode:e,assetSuffix:""}};async function f(a){a.assetStage&&"prod"!==a.assetStage&&location.hostname;const l=a.auth?await async function(e){const a=await t(e,i);let s=null,u=0;for(;!s&&u<6;)s=await a.getToken(),u++,s||await n(500)();return s?(i.bus.send("login/userLoggedIn",{token:s}),i.bus.on("app/logout",a.logout),s):i.bus.get("login/showLogin",{auth:a})}(a.auth):null,p=o(l),f=r(l),b=await s(a,p),{accountId:m,venueId:h}=a;b.assetStage=a.assetStage,b.defaultOrdinal=b.defaultOrdinal||function(a){const t=g(a),n=Object.values(a.structures).find(e.propEq("id",t));return n.levels[n.defaultLevelId].ordinal}(b),b.structures=u(b);const y=i.i18n().language,D=v(y);return b.bareVenueId=h.slice(0,h.length-D.assetSuffix.length),b.getTranslatedContentPath=e=>`https://content.locuslabs.com/${b.category}/${e}/${h}/${m}`,b.fetchJson=p,b.fetchText=f,d.info("venueData ",b,D,y),i.config.debug&&i.env.isBrowser&&(window._venueData=b),b.queueTypes&&(b.securityQueueTypes=(()=>{const e=b.queueTypes.find((e=>"SecurityLane"===e.id));return e?e.subtypes.map((e=>e.id)):[]})()),i.bus.send("venueData/venueDataLoaded",{venueData:b}),c.resolve(b),c}function b(e){const a={id:"venueDataLoader"};e.id!==l.venueId&&(a.vid=e.id);const t=i.config.defaultLanguage||"en";return i.i18n().language!==t&&(a.lang=i.i18n().language),"prod"!==e.assetStage&&(a.stage=e.assetStage),i.bus.send("deepLinking/notifyState",a),e}i.bus.on("debugTools/fileDrop",(async({file:e,content:a})=>{if("application/json"===e.type){const e=JSON.parse(a);if(e.basemap&&e["basemap.venue"])return n=JSON.parse(a),void i.bus.send("map/replaceTheme",{theme:n});if(e.metadata&&e.metadata["mapbox:type"])return t=a,void i.bus.send("map/replaceStyle",{styleSrc:t})}var t,n}));async function m(e){const a={...e},t=await i.bus.get("poi/getAll");return Object.values(a).forEach((e=>e.filter((e=>"poi"===e.properties.aiLayer&&"Point"===e.geometry.type)).forEach((e=>{const a=t[e.properties.id];a?a.mapLabel?e.properties.text=a.mapLabel:!1!==l.copyPOINamesToMap&&(e.properties.text=function(e){let a=e.name;return l.poiMapNameXForm?(Object.keys(l.poiMapNameXForm).filter((a=>((e,a)=>e===a||0===e.indexOf(a+"."))(e.category,a))).forEach((e=>{l.poiMapNameXForm[e].forEach((e=>a=a.replace(new RegExp(e.replace),e.with)))})),a):a}(a)):d.warn(`Unknown poi in style: ${e.properties.id}`)})))),a}const h=(a,t,n,s)=>{const u=a.replace(/-[^-]*$/,""),o=u===n?"landscape-background":`ordinal: ${s.find(e.hasPath(["levels",a])).levels[a].ordinal}`;return t.map((t=>{var s,r,i;return s="properties",r={venueId:n,structureId:u,ordinalId:o,levelId:a},i=t,t=e.over(e.lensProp(s),(a=>e.mergeRight(a||{},r)),i),t=e.assoc("id",t.properties.subid,t)}))};i.bus.on("venueData/loadMap",(async()=>{c.then((async a=>{const t=await a.fetchText(a.files.style),n=await a.fetchJson(a.files.theme),s=a.files.spritesheet,u=a.files.glyphs,{id:o,bounds:r,structures:d,venueCenter:c,venueRadius:g,defaultOrdinal:v}=a,f={mapFeatures:await async function(a){return e.pipe(e.prop("structures"),e.map(e.prop("levels")),e.chain(e.keys),e.prepend(a.id),e.map((e=>a.files.geoJson.replace("${geoJsonId}",e))),e.map(a.fetchJson),e.map(e.andThen((e=>[e.id,h(e.id,e.features,a.id,a.structures)]))),(e=>Promise.all(e)),e.andThen(e.fromPairs))(a)}(a).then(m),mapStyleSource:t,mapTheme:n,badgesSpriteUrl:s,mapGlyphsUrl:u,structures:d,defaultOrdinal:v,venueBounds:{n:r.ne.lat,s:r.sw.lat,e:r.ne.lng,w:r.sw.lng},venueId:o,venueCenter:c,venueRadius:g,accountId:l.accountId,secure:void 0!==l.auth};p.resolve(f),i.bus.send("venueData/mapDataLoaded",f)}))}));const y=e=>null==e.shouldDisplay||e.shouldDisplay;i.bus.on("venueData/loadBuildingSelectorData",(()=>c.then((async a=>{const t={buildings:a.structures.filter(y).map(e.evolve({levels:e.pipe(e.values,e.sortWith([e.descend(e.prop("ordinal"))]))})),structureOrder:a.structureOrder,selectorOrder:a.selectorOrder};return i.bus.send("venueData/buildingSelectorDataLoaded",t),t})))),i.bus.on("venueData/loadNavGraph",(async()=>c.then((async e=>{const a=await e.fetchJson(e.files.nav);i.bus.send("venueData/navGraphLoaded",{navGraphData:a,structures:e.structures})})))),i.bus.on("venueData/loadPoiData",(async()=>c.then((async e=>{const a=l.useOldDataModel?e.files.poisOld||e.files.pois:e.files.pois||e.files.poisOld,t=await e.fetchJson(a);i.bus.send("venueData/poiDataLoaded",{pois:t,structures:e.structures})})))),i.bus.on("venueData/getVenueCenter",(async()=>c.then((async e=>({lat:e.venueCenter[0],lng:e.venueCenter[1],ordinal:0}))))),i.bus.on("venueData/getContentUrl",(({type:e,name:a=""})=>c.then((t=>t.files[e]+a)))),i.bus.on("venueData/getFloorIdToNameMap",(()=>c.then(e.pipe(e.prop("structures"),e.map(e.prop("levels")),e.chain(e.values),e.map(e.props(["id","name"])),e.fromPairs)))),i.bus.on("venueData/getFloorIdName",(({floorId:a})=>c.then((async t=>{const n=e.pipe(e.values,e.find(e.hasPath(["levels",a])))(t.structures);return n?{structureId:n.id,structureName:n.name,floorName:n.levels[a].name}:null}))));const D=(a,t)=>()=>c.then(e.pipe(e.prop(a),e.defaultTo(t)));i.bus.on("venueData/getVenueData",(()=>c)),i.bus.on("venueData/getVenueName",D("name")),i.bus.on("venueData/getVenueCategory",D("category")),i.bus.on("venueData/getVenueTimezone",D("tz")),i.bus.on("venueData/getAccountId",(()=>l.accountId)),i.bus.on("venueData/getVenueId",D("id")),i.bus.on("venueData/getPositioningSupported",D("positioningSupported")),i.bus.on("venueData/getStructures",D("structures")),i.bus.on("venueData/loadNewVenue",(async({venueId:e,accountId:t,assetStage:n=l.assetStage})=>{c.reject(new Error("loadNewVenue called - previous loading ignored")),p.reject(new Error("loadNewVenue called - previous loading ignored")),c=new a,p=new a,f({...l,venueId:e,accountId:t,assetStage:n}).then(b)})),i.bus.on("venueData/changeVenueLanguage",(async({lang:e})=>c.then((async a=>{const t=v(e),n=`${a.bareVenueId}${t.assetSuffix}`;i.bus.send("venueData/loadNewVenue",{accountId:l.accountId,venueId:n})})))),i.bus.on("venueData/getPoiImageUrl",(({imageName:e,size:a})=>`https://img.locuslabs.com/resize/${l.accountId}/${a}cc/poi/${e}`)),i.bus.on("venueData/getDistributionId",(()=>c.then((e=>`${e.bareVenueId}-${l.accountId}`)))),i.bus.on("venueData/getCustomKeywords",(()=>c.then((e=>{const a=l.useOldDataModel&&e.files.searchOld||e.files.search;return e.fetchJson(a)})))),i.bus.on("venueData/isGrabEnabled",D("enableGrab")),i.bus.on("venueData/getGrabPoiIds",D("grabPoiIds",[])),i.bus.on("venueData/getAssetsTimestamp",D("version")),i.bus.on("venueData/getTranslatedFloorId",(async({floorId:e})=>c.then((a=>{const t=i.i18n().language,n=v(t);return`${a.bareVenueId}${n.assetSuffix}-${e.split("-").slice(1).join("-")}`})))),i.bus.on("venueData/getQueueTypes",(()=>c.then((e=>{const a=["tsapre","clear","globalEntry"];return e.queueTypes?e.queueTypes.reduce(((e,t)=>{const{id:n,subtypes:s}=t,u=s.map((e=>{const t=a.includes(e.id)&&`security-logo-${e.id.toLowerCase()}`;return{...e,imageId:t}}));return e[n]=u,e}),{}):{}}))));return{init:async()=>{const e=l.deepLinkProps||{},a=e.vid||l.venueId,t=l.useDynamicUrlParams&&e.stage?e.stage:l.assetStage,n="alpha"===t?"A1VPTJKREFJWX5":l.accountId;f({...l,venueId:a,accountId:n,assetStage:t}).then(b)},runTest:async({testRoutine:e,reset:t=!1,venueData:n=null})=>{let s,u;return(t||n)&&(c=new a,p=new a),n&&(c=a.resolve(n)),await e(),c.v&&(s=await c),p.v&&(u=await p),{venueDataObj:s,mapDataObj:u}},internal:{getDefaultStructureId:g}}}export{i as create};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"ramda";import{findBoundsOfCoordinates as
|
|
1
|
+
import*as t from"ramda";import{findBoundsOfCoordinates as e}from"../../../src/utils/bounds.js";const s=async(t,e)=>t?fetch(e,{headers:{Authorization:t}}):fetch(e),o=t=>e=>s(t,e).then((t=>t.json())),a=t=>e=>s(t,e).then((t=>t.text())),n=t=>`https://api.content.locuslabs.com/${t}`,c=(e,s,o,a,c)=>t.mapObjIndexed(((t,s)=>((t,e,s,o,a,c)=>"theme"===c||"style"===c?`${n(s)}/${e}/${c}/${a}/${o}/${c}.json`:t.replace(/https:\/\/content.locuslabs.com/gi,n(s)))(t,e,o,a,c,s)),s),r=async(t,e)=>{const s={alpha:"alpha-a.locuslabs.com",beta:"beta-a.locuslabs.com",gamma:"gamma-a.locuslabs.com",prod:"a.locuslabs.com"},{assetStage:o,venueId:a,accountId:n,formatVersion:r}=t,u=`https://${s[o]||s.prod}/accounts/${n}`,l=r||"v5",i=await e(`${u}/${l}.json`);if(!i[a])throw Error(`Attempt to access venue ${a} which is not within venue list: ${Object.keys(i)}`);const p=i[a].files,m=(await e(p.venueData))[a];m.venueList=i;const h=(t=>{const e=t.deepLinkProps?t.deepLinkProps.contentStage:null;return"alpha"===e||"beta"===e||"prod"===e?e:null})(t);return m.files=h?c(m.category,p,h,n,a):p,m},u=t=>{const{structureOrder:s,structures:o}=t;return s.map((t=>{const s=o[t],a=e(s.boundsPolygon);return{...s,bounds:a}}))};export{u as buildStructures,o as createFetchJson,a as createFetchText,r as getVenueDataFromUrls};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pick as t,isNil as o,map as e,omit as n,path as
|
|
1
|
+
import{pick as t,isNil as o,map as e,omit as n,path as r}from"ramda";import{encode as s,calculateAdjacent as i}from"../../../src/extModules/geohasher.js";import{distance as l}from"../../../src/utils/geodesy.js";import u from"./minPriorityQueue.js";function d(r,i,l,u){const d={},c={};let a={};return r.nodes.forEach((o=>{const e=i(o.floorId),n=l(o.floorId);!function(t){const o=t.floorId+":"+s(t.lat,t.lng).substr(0,7),e=t.floorId+":"+s(t.lat,t.lng).substr(0,8);c[o]||(c[o]=[]);c[o].push(t),c[e]||(c[e]=[]);c[e].push(t),d[t.id]=t}({...t(["id","lat","lng","floorId"],o),edges:[],ordinal:e,structureId:n})})),r.edges.forEach((t=>d[t.s].edges.push(function(t,e){const n=function(t){return t.x?"Security Checkpoint":""===t.t?"Ground":t.t}(t),r="escalator"!==n.toLowerCase()&&"stairs"!==n.toLowerCase(),s=f(t.s,t.d,e),i=t.l||s/60,l=t=>t.map((t=>({start:{lat:t.s[0],lng:t.s[1]},out:{lat:t.o[0],lng:t.o[1]},in:{lat:t.i[0],lng:t.i[1]},end:{lat:t.e[0],lng:t.e[1]}}))),u=t.p?l(t.p):null;return{distance:s,dst:t.d,o:t.o,isAccessible:r,isDriveway:!o(t.h)&&!t.h,src:t.s,transitTime:i,type:n,path:u,weight:i}}(t,d)))),{_nodes:d,_geoDb:c,findClosestNode:(t,o,e)=>w(t,o,e,c,d),findShortestPath:(t,o,e)=>function(t,o,e,n={}){return I(w(t.floorId,t.lat,t.lng,c,e),w(o.floorId,o.lat,o.lng,c,e),e,a,u,n)}(t,o,d,e),findAllShortestPaths:function(t,o,e){if(!t.floorId)throw Error("attempt to find a shortest path with null floorId");const n=t.lat||t.latitude,r=t.lng||t.longitude,s=w(t.floorId,n,r,c,d),i=o.map((t=>w(t.floorId,t.lat,t.lng,c,d)));return s&&i.length?function(t,o,e,n={},r={},s={}){return o.map((o=>{try{return I(t,o,e,n,r,s)}catch(t){return null}}))}(s,i,d,a,u,e):[]},floorIdToOrdinal:i,floorIdToStructureId:l,updateWithSecurityWaitTime:function(t){a=e(n(["lastUpdated"]),t),y()},clearCache:y}}function f(t,o,e){const n=e[t],r=e[o];return l(n.lat,n.lng,r.lat,r.lng)}let c,a,h,g,p,m;const y=()=>{c={},a={},h={},g=new u,p=null,m={}};function I(t,o,e,n={},s={},i={}){for(t.id===p&&m===JSON.stringify(i)||(y(),g.offerWithPriority(t.id,0),c[t.id]=0,h[t.id]=!0,p=t.id,m=JSON.stringify(i));!g.isEmpty()&&!h[o.id];){const t=e[g.poll()],o=c[t.id];for(let e=0;e<t.edges.length;e++){const l=t.edges[e];if(h[l.dst])continue;if(i.requiresAccessibility&&!l.isAccessible)continue;let u=l.weight;if(l.o&&n[l.o]){const t=n[l.o];t.queueTime&&(u=t.queueTime),t.isTemporarilyClosed&&(u=9999),l.securityWaitTimes=t}if(l.o&&s[l.o]){l.securityLane=s[l.o];const{type:t,id:o}=s[l.o],e=r(["selectedSecurityLanes",t],i);if(e&&!e.includes(o))continue}void 0===c[l.dst]?(a[l.dst]=t,c[l.dst]=o+u,g.offerWithPriority(l.dst,o+u)):c[l.dst]>o+u&&(c[l.dst]=o+u,a[l.dst]=t,g.raisePriority(l.dst,o+u))}h[t.id]=!0}if(!h[o.id])return null;const l=[];let u=o;for(;u;)l.push(u),u=a[u.id];return l.reverse()}function b(t,o,e,n){const r=o.substr(0,n),s=[];s.push(t+":"+i(i(r,"top"),"left")),s.push(t+":"+i(r,"top")),s.push(t+":"+i(i(r,"top"),"right")),s.push(t+":"+i(r,"left")),s.push(t+":"+r),s.push(t+":"+i(r,"right")),s.push(t+":"+i(i(r,"bottom"),"left")),s.push(t+":"+i(r,"bottom")),s.push(t+":"+i(i(r,"bottom"),"right"));const l=[];for(let t=0;t<s.length;t++){const o=e[s[t]];if(o)for(let t=0;t<o.length;t++)l.push(o[t])}return l}function w(t,o,e,n,r){const i=function(t,o,e,n){let r=b(t,o,e,8);return r.length>0?r:(r=b(t,o,e,7),r.length>0?r:null)}(t,s(o,e),n)||function(t,o,e,n){const r=Object.values(n).filter((o=>o.floorId===t)).map((t=>[t,l([t.lat,t.lng],[o,e])]));if(!r.length)throw Error(`findClosestNode2 found no nodes on floor ${t}`);return function(t){let o=t[0];for(let e=1;e<t.length;e++)t[e][1]<o[1]&&(o=t[e]);return o[0]}(r)}(t,o,e,r),u=[];for(let t=0;t<i.length;t++){const n=l(o,e,i[t].lat,i[t].lng);u.push([i[t],n])}u.sort((function(t,o){return t[1]-o[1]}));const d=[];for(let t=0;t<u.length;t++)d.push(u[t][0]);return d[0]}export{d as createNavGraph,I as findShortestPath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"ramda";import{bezierCurveTo as t}from"../../../src/utils/geom.js";import
|
|
1
|
+
import*as e from"ramda";import{bezierCurveTo as t}from"../../../src/utils/geom.js";import o from"./segmentCategories.js";import a from"./stepBuilder.js";const n=e.map(e.converge(e.assoc("coordinates"),[e=>e.waypoints.flatMap(((e,o)=>o>0&&e.curvedPathForward&&e.curvedPathForward.length>0?e.curvedPathForward.flatMap((e=>t(e.start.lng,e.start.lat,e.in.lng,e.in.lat,e.out.lng,e.out.lat,e.end.lng,e.end.lat))).map((e=>[e.x,e.y])):[[e.position.lng,e.position.lat]])),e.identity])),r=t=>{const a=[];let n={segmentCategory:void 0,waypoints:[]},r=null,s=[];return n.waypoints=[t[0]],n.type=t[0].isPortal?t[0].portalType:"Walk",a.push(n),n={segmentCategory:void 0,waypoints:[]},t.forEach((e=>{s.push(e),r?(r.isPortal===e.isPortal&&r.isSecurityCheckpoint===e.isSecurityCheckpoint||(n.waypoints=s,e.isPortal||r.isPortal?(s.length>1&&s.pop(),s=!e.isPortal||"train"!==e.portalType.toLowerCase()&&"bus"!==e.portalType.toLowerCase()?[e]:[s[s.length-1],e]):s=[],r.poiId&&(n.poiId=r.poiId),a.push(n),n={segmentCategory:void 0,waypoints:[]},n.type=e.isPortal?e.portalType:"Walk"),n.levelDifference=e.levelDifference,r=e):(n.type=e.isPortal?e.portalType:"Walk",r=e)})),n.waypoints=s,0===s.length&&(n.waypoints=[r]),a.push(n),(e=>{e.forEach(((t,a)=>{0===a?t.segmentCategory=o.START:t.waypoints[t.waypoints.length-1].isDestination?t.segmentCategory=o.WALKING_TO_END:"Security Checkpoint"===t.type?t.segmentCategory=o.SECURITY_CHECKPOINT:"Bus"===t.type?t.segmentCategory=o.BUS:"Train"===t.type?t.segmentCategory=o.TRAIN:"Stairs"===t.type?t.levelDifference>0?t.segmentCategory=o.STAIRS_UP:t.levelDifference<0?t.segmentCategory=o.STAIRS_DOWN:t.segmentCategory=o.STAIRS:"Elevator"===t.type?t.levelDifference>0?t.segmentCategory=o.ELEVATOR_UP:t.levelDifference<0?t.segmentCategory=o.ELEVATOR_DOWN:t.segmentCategory=o.ELEVATOR:"Escalator"===t.type?t.levelDifference>0?t.segmentCategory=o.ESCALATOR_UP:t.levelDifference<0?t.segmentCategory=o.ESCALATOR_DOWN:t.segmentCategory=o.ESCALATOR:"Ramp"===t.type?t.levelDifference>0?t.segmentCategory=o.RAMP_UP:t.levelDifference<0?t.segmentCategory=o.RAMP_DOWN:t.segmentCategory=o.RAMP:"Security Checkpoint"===e[a+1].type?t.segmentCategory=o.WALKING_TO_SECURITY_CHECKPOINT:"Walk"!==e[a+1].type&&(t.segmentCategory=o.WALKING_TO_PORTAL)}))})(a),((e,t)=>{if(1===e.length){const a={segmentCategory:void 0,waypoints:[]};a.segmentCategory=o.WALKING_TO_END,a.type="Walk",a.waypoints=[t],e.push(a)}})(a,r),(t=>{t.forEach(((o,a)=>{if(a>1&&0===e.head(o.waypoints).levelDifference){const n=e.last(t[a-1].waypoints);o.waypoints=e.prepend(n,o.waypoints)}}))})(a),a},s=(t,s,i,p,l,g)=>{let y=r(t);y=n(y),s&&y[0].coordinates.unshift([s.lng,s.lat]),i&&e.last(y).coordinates.push([i.lng,i.lat]);return{segments:y.map(((t,a)=>{const n=e.last(t.waypoints),r=t.coordinates,s=!(t.levelDifference&&t.waypoints.every(e.prop("isPortal"))),i={levelId:n.position.structureId,ordinalId:`ordinal: ${n.position.ordinal}`,coordinates:r,shouldDrawSegment:s},p=[];if(o.WALKING_TO_PORTAL===t.segmentCategory){const t=y[a+1];p.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)})}else o.START!==t.segmentCategory&&p.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)});return i.badges=p,i.segmentType=(e=>"Train"===e.type?"nav.train":"Bus"===e.type?"nav.transit":"Security Checkpoint"===e.type?"nav.secure":"nav.primary")(t),t.poiId&&(i.poiId=t.poiId),i})),steps:a(y,e.prop("title",s),e.prop("title",i),p,l,g)}};export{s as buildSegments};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{compose as e,not as t,includes as r,__ as a,toLower as n,prop as s,find as c,drop as u,last as
|
|
1
|
+
import{compose as e,not as t,includes as r,__ as a,toLower as n,prop as s,find as c,drop as u,last as i,propEq as T}from"ramda";import{findBoundsOfWaypoints as o}from"../../../src/utils/bounds.js";import A from"./segmentBadges.js";import _ from"./segmentCategories.js";function R(e,t="",r="",a,n,c={}){return e.map(((u,T)=>{const R=N("securityWaitTimes")(u.waypoints),L=R&&!R.isTemporarilyClosed?R.queueTime:Math.round(1===(W=u.waypoints).length?W[0].eta:W.map(s("eta")).slice(1).reduce(((e,t)=>e+t),0));var W;const y=Math.round(function(e){return 1===e.length?e[0].distance:e.map((e=>e.distance)).slice(1).reduce(((e,t)=>e+t),0)}(u.waypoints)),I=function(e){switch(e){case _.START:return A.START;case _.WALKING_TO_END:return A.END;case _.ELEVATOR:return A.ELEVATOR;case _.ELEVATOR_UP:return A.ELEVATOR_UP;case _.ELEVATOR_DOWN:return A.ELEVATOR_DOWN;case _.STAIRS:return A.STAIRS;case _.STAIRS_UP:return A.STAIRS_UP;case _.STAIRS_DOWN:return A.STAIRS_DOWN;case _.ESCALATOR:return A.ESCALATOR;case _.ESCALATOR_UP:return A.ESCALATOR_UP;case _.ESCALATOR_DOWN:return A.ESCALATOR_DOWN;case _.WALKING_TO_PORTAL:case _.WALK:case _.WALK_DOWN:case _.WALK_UP:return A.WALK;case _.TRAIN:return A.TRAIN;case _.TRAIN_UP:return A.TRAIN_UP;case _.TRAIN_DOWN:return A.TRAIN_DOWN;case _.BUS:return A.BUS;case _.BUS_UP:return A.BUS_UP;case _.BUS_DOWN:return A.BUS_DOWN;case _.SECURITY_CHECKPOINT:return A.SECURITY_CHECKPOINT;case _.RAMP:return A.RAMP;case _.RAMP_UP:return A.RAMP_UP;case _.RAMP_DOWN:return A.RAMP_DOWN;default:return A.WALK}}(u.segmentCategory),m=function(e,t){let r;switch(e){case _.START:r=0;break;case _.WALKING_TO_END:r=t.length-1;break;case _.WALKING_TO_PORTAL:r=Math.min(t.length-1,Math.ceil(t.length/2));break;default:r=t.length-1}return t[r].position}(u.segmentCategory,u.waypoints),p={primaryText:function(e,t,r,a,n,s){const c=e[t];switch(c.segmentCategory){case _.START:return O(c.waypoints[0].position,r);case _.WALKING_TO_END:return O(c.waypoints[c.waypoints.length-1].position,a);case _.WALKING_TO_SECURITY_CHECKPOINT:case _.WALKING_TO_PORTAL:return s(`wayfinder:${e[t+1].type}`);case _.SECURITY_CHECKPOINT:case _.ELEVATOR:case _.ELEVATOR_DOWN:case _.ELEVATOR_UP:case _.ESCALATOR:case _.ESCALATOR_DOWN:case _.ESCALATOR_UP:case _.STAIRS:case _.STAIRS_DOWN:case _.STAIRS_UP:return function(e,t){return t[i(e.waypoints).position.floorId]}(c,n);default:return s(`wayfinder:${c.type}`)}}(e,T,t,r,a,n),secondaryText:function(e,t,r,a){const n=S(t,a);switch(e.segmentCategory){case _.START:return a("wayfinder:Begin route at");case _.ELEVATOR:return a("wayfinder:Take elevator to");case _.ELEVATOR_UP:return a("wayfinder:Take elevator up to");case _.ELEVATOR_DOWN:return a("wayfinder:Take elevator down to");case _.STAIRS:return a("wayfinder:Take stairs to");case _.STAIRS_UP:return a("wayfinder:Take stairs up to");case _.STAIRS_DOWN:return a("wayfinder:Take stairs down to");case _.ESCALATOR:return a("wayfinder:Take escalator to");case _.ESCALATOR_UP:return a("wayfinder:Take escalator up to");case _.ESCALATOR_DOWN:return a("wayfinder:Take escalator down to");case _.WALK:case _.WALKING_TO_SECURITY_CHECKPOINT:case _.WALKING_TO_PORTAL:case _.WALKING_TO_END:return n("Walk <1 minute to","Walk xx minute to");case _.WALK_DOWN:return n("Walk <1 minute down to","Walk xx minute down to");case _.WALK_UP:return n("Walk <1 minute up to","Walk xx minute up to");case _.TRAIN:return n("Take train <1 minute","Take train xx minute");case _.BUS:return n("Take bus <1 minute","Take bus xx minute");case _.SECURITY_CHECKPOINT:return r?a("wayfinder:Through _security_ to",{name:r}):a("wayfinder:Through security to");case _.RAMP:return a("wayfinder:Take ramp to");case _.RAMP_UP:return a("wayfinder:Take ramp up to");case _.RAMP_DOWN:return a("wayfinder:Take ramp down to");default:return""}}(u,L,d(c,u.waypoints),n),icon:I,animationAnchor:m,eta:L,distance:y,bounds:o(u.waypoints),isAccessible:E(u),securityWaitTimes:R};return u.poiId&&(p.poiId=u.poiId),p}))}function O(e,t){return e.name?e.name:t}const S=(e,t)=>(r,a)=>0===e?t("wayfinder:"+r):t("wayfinder:"+a,{count:e}),E=e(t,r(a,["escalator","stairs"]),n,s("type")),d=(e,t)=>{const r=N("securityLane")(t);if(!r)return;const a=s(r.type,e),n=c(T("id",r.id),a);return s("displayText",n)},N=t=>e(s(t),c(s(t)),u(1));export default R;
|
|
@@ -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,p){const l=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 b({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,alternative:!o.primary})}return e}(await d.bus.get("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 I=["lat","lng","floorId","ordinal"],h=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 b({fromEndpoint:t,toEndpoint:n,options:o={}}){return f.then((async e=>{o.compareFindPaths=p.compareFindPaths;const r=i(e,t,n,o);if(!r)return null;v(t,n,r);const a=await d.bus.get("venueData/getFloorIdToNameMap"),u=await d.bus.get("venueData/getQueueTypes"),c=d.gt(),{steps:f,segments:y}=s(r.waypoints,t,n,a,c,u);l.info("route",r);const m=Math.round(r.waypoints.reduce(((t,{eta:n})=>t+n),0)),g=Math.round(r.waypoints.reduce(((t,{distance:n})=>t+n),0));return{...r,segments:y,steps:f,time:m,distance:g}}))}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){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(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))),d.bus.on("wayfinder/checkIfPathHasSecurity",(({fromEndpoint:n,toEndpoint:o,options:e={}})=>f.then((r=>{e.compareFindPaths=p.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",b);const v=(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 T(t){return S(t,"transitTime")}function E(t){return S(t,"distance")}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 L(t,n){return t.distance=e(n.lat,n.lng,t.position.latitude,t.position.longitude),t}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);if(!r)return(o=L(o,e)).transitTime=o.distance/60,o;return Object.assign(o,{transitTime:T(r),distance:E(r)})}(e,o,t,n))):t)),d.bus.on("wayfinder/addPathTimeMultiple",(async({pois:t,startLocation:n,options:o={}})=>n?f.then((e=>function(t,n,o,e){const i=o.map((n=>w(n,t.floorIdToOrdinal))),r=t.findAllShortestPaths(e,i,n);return o.map(((t,n)=>function(t,n,o){n&&n.length?t=Object.assign(t,{transitTime:T(n),distance:E(n)}):(t=L(t,o)).transitTime=t.distance/60;return t}(t,r[n],e)))}(e,o,t,n))):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,p){const l=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 b({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,alternative:!o.primary})}return e}(await d.bus.get("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 I=["lat","lng","floorId","ordinal"],h=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 b({fromEndpoint:t,toEndpoint:n,options:o={}}){return f.then((async e=>{o.compareFindPaths=p.compareFindPaths;const r=i(e,t,n,o);if(!r)return null;v(t,n,r);const a=await d.bus.get("venueData/getFloorIdToNameMap"),u=await d.bus.get("venueData/getQueueTypes"),c=d.gt(),{steps:f,segments:y}=s(r.waypoints,t,n,a,c,u);l.info("route",r);const m=Math.round(r.waypoints.reduce(((t,{eta:n})=>t+n),0)),g=Math.round(r.waypoints.reduce(((t,{distance:n})=>t+n),0));return{...r,segments:y,steps:f,time:m,distance:g}}))}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){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(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))),d.bus.on("wayfinder/checkIfPathHasSecurity",(({fromEndpoint:n,toEndpoint:o,options:e={}})=>f.then((r=>{e.compareFindPaths=p.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",b);const v=(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 T(t){return S(t,"transitTime")}function E(t){return S(t,"distance")}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 L(t,n){return t.distance=e(n.lat,n.lng,t.position.latitude,t.position.longitude),t}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);if(!r)return(o=L(o,e)).transitTime=o.distance/60,o;return Object.assign(o,{transitTime:T(r),distance:E(r)})}(e,o,t,n))):t)),d.bus.on("wayfinder/addPathTimeMultiple",(async({pois:t,startLocation:n,options:o={}})=>n?f.then((e=>function(t,n,o,e){try{const i=o.map((n=>w(n,t.floorIdToOrdinal))),r=t.findAllShortestPaths(e,i,n);return o.map(((t,n)=>function(t,n,o){n&&n.length?t=Object.assign(t,{transitTime:T(n),distance:E(n)}):(t=L(t,o)).transitTime=t.distance/60;return t}(t,r[n],e)))}catch(t){return l.error(t),o}}(e,o,t,n))):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};
|
package/lib/src/app.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"IObject";import t from"query-string";import{map as n,mergeDeepRight as o}from"ramda";import i from"zousan-plus";import r from"../package.json.js";import a from"./debugTools.js";import{buildEnv as s}from"./env.js";import{create as l}from"./extModules/bustle.js";import{initLog as u}from"./extModules/log.js";import g from"./utils/i18n.js";async function c(e,t,n){let o=t;if(o.includes("/")){const e=o.split("/");o=e[e.length-1]}return void 0!==n.active&&!1===n.active?(e.log.info(`Plugin ${t} explicitly deativated`),null):import(`../plugins/${t}/src/${o}.js`).then((o=>(e.log.info(`Creating plugin ${t}`),o.create(e,n))))}async function p(e,t){let n={};const i=await Promise.all(t.map((e=>import(`./configs/${e}.json`))));for(const e of i){let t=e.default;t=t.extends?await p(t,t.extends):t,n=o(n,t)}return n=o(n,e),n}const
|
|
1
|
+
import e from"IObject";import t from"query-string";import{map as n,mergeDeepRight as o}from"ramda";import i from"zousan-plus";import r from"../package.json.js";import a from"./debugTools.js";import{buildEnv as s}from"./env.js";import{create as l}from"./extModules/bustle.js";import{initLog as u}from"./extModules/log.js";import g from"./utils/i18n.js";async function c(e,t,n){let o=t;if(o.includes("/")){const e=o.split("/");o=e[e.length-1]}return void 0!==n.active&&!1===n.active?(e.log.info(`Plugin ${t} explicitly deativated`),null):import(`../plugins/${t}/src/${o}.js`).then((o=>(e.log.info(`Creating plugin ${t}`),o.create(e,n))))}async function p(e,t){let n={};const i=await Promise.all(t.map((e=>import(`./configs/${e}.json`))));for(const e of i){let t=e.default;t=t.extends?await p(t,t.extends):t,n=o(n,t)}return n=o(n,e),n}const d=e=>t=>import(`./configs/postproc-${e}.js`).then((e=>e.process(t)));async function m(o){const m=Object.create(null);let f=o.extends?await p(o,o.extends):o;f.plugins.monitoring&&import("../_virtual/_empty_module_placeholder").then((e=>e.activate(f))),f=await(async e=>e.configPostProc?i.series(e,...e.configPostProc.map(d)):e)(f);const w=(e=>{const n=e.supportedLanguages||["ar","en","es","fr","ja","ko","zh-Hans","zh-Hant"];if("undefined"!=typeof window){let e=t.parse(location.search).lang||navigator.language;for(;e;){if(e&&n.includes(e))return e;e=e.substring(0,e.lastIndexOf("-"))}}return e.defaultLanguage||"en"})(f),y=await g(w,f.debug);m.i18n=()=>y,m.gt=()=>y.t.bind(y),m.config=f,m.plugins=new e;const h="undefined"!=typeof window,b=u("web-engine",{enabled:!!f.debug,isBrowser:h,color:"cyan",logFilter:f.logFilter,truncateObjects:!h});if(m.log=b.sublog(f.name),m.bus=l({trace:!1,showEvents:!0,reportAllErrors:!0,log:b}),m.info={wePkg:r},"undefined"!=typeof window&&(f.debug?(m.debug=n((e=>e.bind(m)),a),a.dndGo.call(m)):m.debug={},window._app=m,window.document&&window.document.title&&f.setWindowTitle&&(document.title=f.name)),m.env=s(m),f.theme?await i.evaluate({name:"ThemeManagerModule",value:import("../_virtual/_empty_module_placeholder")},{name:"HistoryManager",value:import("./historyManager.js")},{name:"LayerManager",value:import("../_virtual/_empty_module_placeholder")}).then((async({LayerManager:e,HistoryManager:t,ThemeManagerModule:n})=>{const o=n.initThemeManager(m);m.themePack=await o.buildTheme(f.theme,f.defaultTheme),e.initLayerManager(m),t.initHistoryManager(m),m.destroy=()=>e.destroy(m)})):m.destroy=()=>{},f.plugins){for(const e in f.plugins)try{const t=f.plugins[e];if(m.plugins[e])throw Error(`Duplicate plugin name "${e}"`);const n=await c(m,e,t);n&&(m.plugins=m.plugins.set(e,n))}catch(t){b.error("Error instantiating plugin "+e),b.error(t)}for(const e in m.plugins)m.plugins[e].init()}return m}export{m as create};
|
package/package.json
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atriusmaps-node-sdk",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.21",
|
|
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
|
-
"module": "lib/deploy/nodeEntry.js",
|
|
6
|
-
"main": "lib/deploy/nodeEntry.js",
|
|
7
|
-
"license": "UNLICENSED",
|
|
8
|
-
"type": "module",
|
|
9
5
|
"keywords": [
|
|
10
6
|
"map",
|
|
11
7
|
"mapping",
|
|
@@ -19,7 +15,23 @@
|
|
|
19
15
|
"acuitybrands"
|
|
20
16
|
],
|
|
21
17
|
"repository": "https://gitlab.com/locuslabspublic/node-sdk",
|
|
18
|
+
"license": "UNLICENSED",
|
|
22
19
|
"author": "Glenn Crownover <crownover@locuslabs.com>",
|
|
20
|
+
"type": "module",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./lib/deploy/nodeEntry.js",
|
|
24
|
+
"require": "./dist/cjs/deploy/nodeEntry.js",
|
|
25
|
+
"default": "./dist/cjs/deploy/nodeEntry.js"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"main": "./dist/cjs/deploy/nodeEntry.js",
|
|
30
|
+
"module": "./lib/deploy/nodeEntry.js",
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "yarn build:CJS",
|
|
33
|
+
"build:CJS": "rollup -c config/rollup.config.cjs.js"
|
|
34
|
+
},
|
|
23
35
|
"dependencies": {
|
|
24
36
|
"IObject": "^0.6.2",
|
|
25
37
|
"flexsearch": "0.6.32",
|
|
@@ -28,5 +40,9 @@
|
|
|
28
40
|
"query-string": "^7.0.1",
|
|
29
41
|
"ramda": "^0.27.1",
|
|
30
42
|
"zousan-plus": "^4.0.1"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
46
|
+
"rollup": "^2.59.0"
|
|
31
47
|
}
|
|
32
48
|
}
|