atriusmaps-node-sdk 3.3.338 → 3.3.340
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/deploy/prepareSDKConfig.js +2 -2
- package/dist/cjs/package.json.js +2 -1
- package/dist/cjs/src/utils/geom.js +13 -6
- package/dist/cjs/src/utils/location.js +28 -15
- package/dist/deploy/prepareSDKConfig.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/utils/geom.js +1 -1
- package/dist/src/utils/location.js +1 -1
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ function prepareSDKConfig (sc) {
|
|
|
12
12
|
forceDesktop, hostAppId, hostAppVersion, hostAppProperties, logFilter,
|
|
13
13
|
searchPlaceholder, dataFetch, engineName, dynamicPoisUrlBaseV1, plugins,
|
|
14
14
|
anaytics2ActiveFlag, enablePoiSelection, minZoom, maxZoom, noLangOptions,
|
|
15
|
-
pinnedLocation
|
|
15
|
+
pinnedLocation, pinnedLocationZoom, pinnedLocationFocusAtStart
|
|
16
16
|
} = sc;
|
|
17
17
|
|
|
18
18
|
const extendsConfig = parentConfig ? [parentConfig] : (headless ? ['sdkHeadless'] : ['sdkVisual']);
|
|
@@ -91,7 +91,7 @@ function prepareSDKConfig (sc) {
|
|
|
91
91
|
};
|
|
92
92
|
config.plugins.userMenu = { noLangOptions };
|
|
93
93
|
if (pinnedLocation)
|
|
94
|
-
config.plugins['online/pinnedLocation'] = { location: pinnedLocation };
|
|
94
|
+
config.plugins['online/pinnedLocation'] = { location: pinnedLocation, zoom: pinnedLocationZoom, focusAtStart: pinnedLocationFocusAtStart };
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
config.plugins.searchService = defaultSearchTerms
|
package/dist/cjs/package.json.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var name = "web-engine";
|
|
6
|
-
var version = "3.3.
|
|
6
|
+
var version = "3.3.340";
|
|
7
7
|
var license = "UNLICENSED";
|
|
8
8
|
var type = "module";
|
|
9
9
|
var main = "src/main.js";
|
|
@@ -82,6 +82,7 @@ var dependencies = {
|
|
|
82
82
|
"@vitejs/plugin-react": "^4.0.1",
|
|
83
83
|
IObject: "^0.7.2",
|
|
84
84
|
"axe-core": "^4.9.0",
|
|
85
|
+
browserslist: "^4.24.2",
|
|
85
86
|
"crypto-browserify": "^3.12.0",
|
|
86
87
|
"cypress-axe": "^1.5.0",
|
|
87
88
|
"cypress-multi-reporters": "^1.6.4",
|
|
@@ -150,16 +150,14 @@ const findBuildingWithMinArea = ba => ba.reduce(less(calcBuildingArea)); // retu
|
|
|
150
150
|
* given a building and ord, return the floor (or undefined if doesn't exist)
|
|
151
151
|
*/
|
|
152
152
|
const ordToFloor = (building, ord) =>
|
|
153
|
-
Object.values(building.levels).
|
|
154
|
-
floor.ordinal === ord ? floor : matchedFloor, undefined);
|
|
153
|
+
Object.values(building.levels).find(floor => floor.ordinal === ord);
|
|
155
154
|
|
|
156
155
|
/**
|
|
157
156
|
* Return the floor based on its ID (pass in buildings array and floorId)
|
|
158
157
|
*/
|
|
159
158
|
const getFloor = (buildings, selectedLevelId) =>
|
|
160
159
|
buildings.reduce((fmatch, building) =>
|
|
161
|
-
Object.values(building.levels).
|
|
162
|
-
floor.id === selectedLevelId ? floor : fmatch, null) || fmatch, undefined);
|
|
160
|
+
Object.values(building.levels).find(floor => floor.id === selectedLevelId) || fmatch, undefined);
|
|
163
161
|
|
|
164
162
|
function getBuildingAndFloorAtPoint (buildings, lat, lng, ord, preciseFlag) {
|
|
165
163
|
const building = getStructureAtPoint(buildings, lat, lng, preciseFlag);
|
|
@@ -169,7 +167,16 @@ function getBuildingAndFloorAtPoint (buildings, lat, lng, ord, preciseFlag) {
|
|
|
169
167
|
return { building, floor }
|
|
170
168
|
}
|
|
171
169
|
|
|
172
|
-
|
|
170
|
+
// pass in the structures array and a floorId and this will return the structure
|
|
171
|
+
// that contains the floorId.
|
|
172
|
+
const getStructureForFloorId = (buildings, floorId) =>
|
|
173
|
+
buildings.reduce((sMatch, building) =>
|
|
174
|
+
buildContainsFloorWithId(building, floorId) ? building : sMatch, null);
|
|
175
|
+
|
|
176
|
+
// returns true if the building specified contains the floorId specified
|
|
177
|
+
const buildContainsFloorWithId = (building, floorId) =>
|
|
178
|
+
Object.values(building.levels).reduce((fmatch, floor) =>
|
|
179
|
+
floor.id === floorId ? true : fmatch, false);
|
|
173
180
|
|
|
174
181
|
/**
|
|
175
182
|
* Calculate the points for a bezier cubic curve
|
|
@@ -216,7 +223,7 @@ function bezierCurveTo (fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY) {
|
|
|
216
223
|
exports.bezierCurveTo = bezierCurveTo;
|
|
217
224
|
exports.getBuildingAndFloorAtPoint = getBuildingAndFloorAtPoint;
|
|
218
225
|
exports.getFloor = getFloor;
|
|
219
|
-
exports.getFloorAt = getFloorAt;
|
|
220
226
|
exports.getStructureAtPoint = getStructureAtPoint;
|
|
227
|
+
exports.getStructureForFloorId = getStructureForFloorId;
|
|
221
228
|
exports.ordToFloor = ordToFloor;
|
|
222
229
|
exports.pointInPolygon = pointInPolygon;
|
|
@@ -16,26 +16,39 @@ var geom = require('./geom.js');
|
|
|
16
16
|
async function locationToEndpoint (app, location) {
|
|
17
17
|
if (location.poiId)
|
|
18
18
|
return app.bus.get('wayfinder/getNavigationEndpoint', { ep: location.poiId })
|
|
19
|
-
let { lat, lng, ord, ordinal, floorId, title = '' } = location;
|
|
20
|
-
if (ordinal === undefined && ord !== undefined)
|
|
21
|
-
ordinal = ord; // normalize on "ordinal"
|
|
22
|
-
if (ordinal !== undefined && floorId !== undefined) // we are good to go
|
|
23
|
-
return { lat, lng, ordinal, floorId, title }
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
const structures = await getStructures(app);
|
|
20
|
+
let { lat, lng, ord, ordinal, floorId, title = '', structureId } = location;
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
if (lat == null || lng == null)
|
|
23
|
+
throw Error('To obtain a location, you must provide a lat,lng or a poiId')
|
|
30
24
|
|
|
31
|
-
if (ordinal !== undefined)
|
|
32
|
-
|
|
25
|
+
if (ordinal === undefined && ord !== undefined)
|
|
26
|
+
ordinal = ord; // normalize on "ordinal"
|
|
33
27
|
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
throw Error('Call to locationToEndpoint with no ordinal and no floorId (or an invalid one): ' + floorId)
|
|
28
|
+
// Now lets normalize the return structure - determine ordinal, floorId and structureId
|
|
29
|
+
const structures = await getStructures(app);
|
|
37
30
|
|
|
38
|
-
|
|
31
|
+
if (ordinal == null) {
|
|
32
|
+
if (floorId == null) // if neither ordinal nor floorId is defined bad dog!
|
|
33
|
+
throw Error('Call to locationToEndpoint with no ordinal and no floorId')
|
|
34
|
+
else {
|
|
35
|
+
const floor = geom.getFloor(structures, floorId);
|
|
36
|
+
if (!floor)
|
|
37
|
+
throw Error(`floor with id ${floorId} not found.`)
|
|
38
|
+
ordinal = floor.ordinal;
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
if (floorId == null) {
|
|
42
|
+
const { building, floor } = geom.getBuildingAndFloorAtPoint(structures, lat, lng, ordinal, true);
|
|
43
|
+
floorId = floor?.id;
|
|
44
|
+
structureId = building?.id;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (floorId != null && structureId == null)
|
|
49
|
+
structureId = geom.getStructureForFloorId(structures, floorId)?.id;
|
|
50
|
+
|
|
51
|
+
return { lat, lng, floorId, ordinal, title, structureId }
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
const getStructures = async app => app.bus.get('venueData/getVenueData').then(vd => vd.structures);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setDeepLinksForParms as e}from"../src/configs/postproc-mol-url-parms.js";import{setStateFromStateString as i}from"../src/configs/postproc-stateTracking.js";import{filterOb as
|
|
1
|
+
import{setDeepLinksForParms as e}from"../src/configs/postproc-mol-url-parms.js";import{setStateFromStateString as i}from"../src/configs/postproc-stateTracking.js";import{filterOb as t}from"../src/utils/funcs.js";function n(n){const{name:s,debug:a,headless:r,theme:l,defaultSearchTerms:c,venueId:p,accountId:u,poiCategories:d,preserveStateInURL:g,supportURLDeepLinks:h,initState:m,deepLinkParms:f,uiHide:S,renderDiv:v,parentConfig:k,desktopViewMinWidth:P,forceDesktop:L,hostAppId:A,hostAppVersion:V,hostAppProperties:w,logFilter:b,searchPlaceholder:y,dataFetch:D,engineName:I,dynamicPoisUrlBaseV1:Z,plugins:j,anaytics2ActiveFlag:F,enablePoiSelection:O,minZoom:T,maxZoom:x,noLangOptions:C,pinnedLocation:M,pinnedLocationZoom:R,pinnedLocationFocusAtStart:U}=n,W=k?[k]:r?["sdkHeadless"]:["sdkVisual"],z=(e,i)=>e&&e.length>i?e.substring(0,i):e,H={name:s,engineName:I,extends:W,debug:a,logFilter:b,theme:l,uiHide:S,renderDiv:v,configPostProc:[],plugins:{venueDataLoader:{dataFetch:D,venueId:p,accountId:u},sdkServer:{headless:r},analytics2:{hostAppId:(e=>e?z(e.toString(),128):void 0)(A),hostAppVersion:(e=>e?z(e.toString(),128):void 0)(V),hostAppProperties:(e=>{if(!e||"object"!=typeof e)return;const i={},t=Object.keys(e);return t.length>10&&(t.length=10),t.forEach((t=>{let n=z(t.toString().replaceAll(/[^a-zA-Z0-9_]/g,""),128);n.match(/^[a-zA-Z]+/)||(n="X"+n);let o=e[t];null==o&&(o=""),o=z(o.toString(),128),i[n]=o})),i})(w)}},uuid:"undefined"!=typeof document&&document&&document.location?document.location.host:"unknown"};void 0!==F&&(H.plugins.analytics2.active=F);const B=(e,i)=>void 0!==i?{[e]:i}:{};return r||(H.plugins["online/headerOnline"]={searchPlaceholder:y},H.plugins.mapRenderer={...B("enablePoiSelection",O),viewLimits:{...B("maxZoom",x),...B("minZoom",T)}},H.plugins.userMenu={noLangOptions:C},M&&(H.plugins["online/pinnedLocation"]={location:M,zoom:R,focusAtStart:U})),H.plugins.searchService=c?{defaultSearchTerms:c}:{},o(n,"defaultSearchTerms",H.plugins.searchService),W.includes("sdkVisual")&&(H.plugins["online/homeView"]=d?{poiCategories:d}:{},o(n,"poiCategories",H.plugins["online/homeView"])),j&&(j.draw&&(H.plugins.draw=j.draw),j.flightStatus&&(H.plugins.flightStatus=j.flightStatus,H.plugins["online/flightDetails"]={},H.plugins["online/flightDetailsSearch"]={})),g&&(H.configPostProc.push("stateTracking"),H.plugins.deepLinking={trackURL:!0}),h&&H.configPostProc.push("mol-url-parms"),m&&i(H,atob(m),!0),f&&e(H,f,!0),void 0!==P&&(H.desktopViewMinWidth=P),L&&(H.desktopViewMinWidth=0),Z&&(H.plugins.dynamicPois={urlBaseV1:Z}),t(((e,i)=>void 0!==i),H)}function o(e,i,t){Object.keys(e).filter((e=>e.startsWith(i+"-"))).forEach((i=>t[i]=e[i]))}export{n as default};
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="web-engine",s="3.3.
|
|
1
|
+
var e="web-engine",s="3.3.340",o="UNLICENSED",r="module",l="src/main.js",t=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],a={colors:"cat utils/colors1.txt && node utils/processColors.js | pbcopy && cat utils/colors2.txt","cypress:a11y":"APPLITOOLS_IS_DISABLED=true && cypress open --browser chrome --env INPUT_MODALITY='keyboard'","cypress:comp":"APPLITOOLS_IS_DISABLED=true && cypress open --component --browser chrome","cypress:e2e":"APPLITOOLS_IS_DISABLED=true && cypress open --e2e --browser chrome",e2eSDKTest:"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./cypress/e2e/sdk && npx http-server' 8080 'yarn cypress run --spec cypress/e2e/sdk/**'",demo:"cd demo/ && yarn start","e2e:comp":"cypress run --component","e2e:record":"yarn cypress run --env RECORD_MODE=true",e2eTest:"percy exec -- cypress run --browser chrome",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh",i18nOverrides:"yarn node utils/i18nOverrideCli src/i18n src/i18n-overrides",lint:"eslint .",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol",prepare:"husky install","test:vitest":"vitest",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:e2e:video":"cypress run"},i=["defaults"],n={"@azure/event-hubs":"^5.6.0","@dnd-kit/core":"^6.0.8","@dnd-kit/modifiers":"^7.0.0","@dnd-kit/sortable":"^7.0.2","@dnd-kit/utilities":"^3.2.1","@john-osullivan/react-window-dynamic-fork":"^1.9.0-alpha.1","@locus-labs/mod-badge":"^0.1.102","@locus-labs/mod-default-theme":"^0.0.113","@locus-labs/mod-footer":"^0.0.111","@locus-labs/mod-header":"^0.0.105","@locus-labs/mod-location-marker":"^0.0.104","@locus-labs/mod-map-legend":"^0.0.104","@locus-labs/mod-offscreen-indicator":"^0.0.104","@locus-labs/mod-pin":"^0.0.104","@locus-labs/mod-qr-code-card":"^0.0.104","@locus-labs/mod-qr-code-window":"^0.0.105","@locus-labs/mod-walk-time-matrix":"^0.0.103","@locus-labs/mol-desktop-building-level-selector":"^0.1.119","@locus-labs/mol-desktop-compass":"^0.1.120","@locus-labs/mol-desktop-default-theme":"^0.2.105","@locus-labs/mol-desktop-icon":"^0.1.131","@locus-labs/mol-desktop-logo":"^0.1.101","@locus-labs/mol-desktop-map-nav-button":"^0.1.130","@locus-labs/mol-desktop-tooltip":"^0.3.102","@locus-labs/mol-desktop-zoom-control":"^0.1.141","@locus-labs/mol-mobile-box":"^0.1.115","@locus-labs/mol-mobile-floating-action-button":"^0.0.117","@locus-labs/mol-mobile-icon":"^0.1.118","@locus-labs/mol-mobile-text":"^0.1.116","@locus-labs/mol-mobile-toast":"^0.1.102","@mapbox/mapbox-gl-draw":"^1.3.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.1.2","@turf/circle":"^6.5.0","@turf/helpers":"^6.5.0","@turf/point-to-line-distance":"^6.5.0","@vitejs/plugin-react":"^4.0.1",IObject:"^0.7.2","axe-core":"^4.9.0",browserslist:"^4.24.2","crypto-browserify":"^3.12.0","cypress-axe":"^1.5.0","cypress-multi-reporters":"^1.6.4","file-loader":"^6.2.0",flexsearch:"^0.7.31","h3-js":"^4.1.0",i18next:"^20.3.4","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"4.0.1",jsdom:"^25.0.0",jsonschema:"^1.2.6",luxon:"^3.3.0","maplibre-gl":"~2.1.9","mini-css-extract-plugin":"^1.6.0","mocha-junit-reporter":"^2.2.1",mochawesome:"^7.1.3","node-polyfill-webpack-plugin":"^1.1.4","path-browserify":"^1.0.1",polished:"^4.0.2","prop-types":"^15.7.2","query-string":"^8.1.0",ramda:"^0.28.0",react:"^17.0.2","react-compound-slider":"^3.3.1","react-dom":"^17.0.2","react-json-editor-ajrm":"^2.5.13","react-qr-svg":"^2.2.1","react-svg":"^16.1.29","react-tageditor":"^0.2.3","react-virtualized-auto-sizer":"^1.0.2","smoothscroll-polyfill":"^0.4.4","styled-components":"5.1.0","styled-normalize":"^8.0.6","throttle-debounce":"^3.0.1",trackjs:"^3.7.4","ua-parser-js":"^0.7.23",uuid:"3.3.2",zousan:"^3.0.1","zousan-plus":"^4.0.1"},c={"@applitools/eyes-cypress":"^3.44.0","@babel/core":"^7.14.8","@babel/eslint-parser":"^7.24.7","@babel/plugin-proposal-class-properties":"^7.8.3","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-syntax-import-assertions":"^7.20.0","@babel/plugin-transform-modules-commonjs":"^7.8.3","@babel/plugin-transform-runtime":"^7.8.3","@babel/preset-env":"^7.14.8","@babel/preset-react":"^7.8.3","@percy/cli":"^1.0.0-beta.60","@percy/cypress":"^3.1.0","@testing-library/jest-dom":"^6.5.0","@typescript-eslint/eslint-plugin":"^7.13.0","@typescript-eslint/parser":"^7.13.0","babel-jest":"^27.0.6","babel-loader":"^8.2.2","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^5.0.0","babel-polyfill":"^6.26.0","chai-colors":"^1.0.1","css-loader":"^5.2.4",cypress:"^12.17.2","cypress-browser-permissions":"^1.1.0","cypress-real-events":"^1.11.0","cypress-wait-until":"^1.7.1",eslint:"^8.57.0","eslint-config-standard":"^16.0.3","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-cypress":"^2.11.1","eslint-plugin-import":"^2.16.0","eslint-plugin-jest":"^28.6.0","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.1.0","eslint-plugin-react":"^7.12.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.3.0",glob:"^10.3.3",husky:"^6.0.0",jest:"27.5.1","lint-staged":"^11.0.1","node-fetch":"^2.6.0","null-loader":"^4.0.1",nx:"19.4.2","nx-remotecache-azure":"^19.0.0","start-server-and-test":"^2.0.0",typescript:"^5.4.5",vite:"^4.3.9",vitest:"^2.0.5",webpack:"^5.84.1","webpack-merge":"^5.8.0"},p="yarn@4.3.1",d={node:">=20"},m={},u={name:e,version:s,private:!0,license:o,type:r,main:l,workspaces:t,scripts:a,"lint-staged":{"*.js":["eslint --fix"]},browserslist:i,dependencies:n,devDependencies:c,packageManager:p,engines:d,nx:m};export{i as browserslist,u as default,n as dependencies,c as devDependencies,d as engines,o as license,l as main,e as name,m as nx,p as packageManager,a as scripts,r as type,s as version,t as workspaces};
|
package/dist/src/utils/geom.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{point as n,lineString as
|
|
1
|
+
import{point as n,lineString as e}from"@turf/helpers";import t from"@turf/point-to-line-distance";import*as r from"ramda";const l=(n,e)=>{const t=n[0],r=n[1];let l=!1;for(let n=0,u=e.length-1;n<e.length;u=n++){const o=e[n][0],s=e[n][1],i=e[u][0],d=e[u][1];s>r!=d>r&&t<(i-o)*(r-s)/(d-s)+o&&(l=!l)}return l},u=n=>{const{n:e,s:t,e:r,w:l}=n.bounds;return[[e,r],[e,l],[t,l],[t,r],[e,r]]};function o(n,e,t,o){if(!r.length(n))return null;const s=(n=n.filter((n=>null==n.shouldDisplay||!0===n.shouldDisplay))).filter((n=>l([e,t],u(n))));if(0===s.length)return null;if(1===s.length&&!o)return r.head(s);const i=s.filter((n=>l([e,t],n.boundsPolygon)));if(1===i.length)return r.head(i);if(i.length)return h(s);if(o)return null;const f=s.map((n=>d(e,t,n))),c=Math.min.apply(null,f);return s[f.indexOf(c)]}const s=n=>e(n.boundsPolygon.map((n=>c(n)))),i={},d=(n,e,t)=>{for(let r=0;r<99;r++)f(n,e,t);return f(n,e,t)},f=(e,r,l)=>{const u=n([r,e]),o=(n=>{let e=i[n.id];return e||(e=s(n),i[n.id]=e),e})(l);return t(u,o)},c=n=>[n[1],n[0]],a=n=>{if(!n.bounds)return 0;const{n:e,s:t,e:r,w:l}=n.bounds;return Math.abs((e-t)*(r-l))},h=n=>{return n.reduce((e=a,(n,t)=>e(n)<e(t)?n:t));var e},p=(n,e)=>Object.values(n.levels).find((n=>n.ordinal===e)),b=(n,e)=>n.reduce(((n,t)=>Object.values(t.levels).find((n=>n.id===e))||n),void 0);function g(n,e,t,r,l){const u=o(n,e,t,l);return{building:u,floor:u?p(u,r):null}}const m=(n,e)=>n.reduce(((n,t)=>v(t,e)?t:n),null),v=(n,e)=>Object.values(n.levels).reduce(((n,t)=>t.id===e||n),!1);function y(n,e,t,r,l,u,o,s){let i=0,d=0,f=0,c=0,a=0;const h=[{x:n,y:e}];for(let p=1,b=0;p<=20;++p)b=p/20,i=1-b,d=i*i,f=d*i,c=b*b,a=c*b,h.push({x:f*n+3*d*b*t+3*i*c*l+a*o,y:f*e+3*d*b*r+3*i*c*u+a*s});return h}export{y as bezierCurveTo,g as getBuildingAndFloorAtPoint,b as getFloor,o as getStructureAtPoint,m as getStructureForFloorId,p as ordToFloor,l as pointInPolygon};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getFloor as o,getBuildingAndFloorAtPoint as t,getStructureForFloorId as n}from"./geom.js";async function l(l,i){if(i.poiId)return l.bus.get("wayfinder/getNavigationEndpoint",{ep:i.poiId});let{lat:a,lng:d,ord:e,ordinal:u,floorId:f,title:s="",structureId:c}=i;if(null==a||null==d)throw Error("To obtain a location, you must provide a lat,lng or a poiId");void 0===u&&void 0!==e&&(u=e);const g=await r(l);if(null==u){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.`);u=t.ordinal}}else if(null==f){const{building:o,floor:n}=t(g,a,d,u,!0);f=n?.id,c=o?.id}return null!=f&&null==c&&(c=n(g,f)?.id),{lat:a,lng:d,floorId:f,ordinal:u,title:s,structureId:c}}const r=async o=>o.bus.get("venueData/getVenueData").then((o=>o.structures));export{r as getStructures,l as locationToEndpoint};
|
package/package.json
CHANGED