atriusmaps-node-sdk 3.3.31 → 3.3.225
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 +19 -1
- package/dist/cjs/_virtual/_empty_module_placeholder.js +2 -2
- package/dist/cjs/deploy/prepareSDKConfig.js +152 -2
- package/dist/cjs/nodesdk/nodeEntry.js +109 -0
- package/dist/cjs/package.json.js +190 -7
- package/dist/cjs/plugins/clientAPI/src/clientAPI.js +11 -2
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +218 -21
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +292 -21
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +99 -20
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +219 -2
- package/dist/cjs/plugins/sdkServer/src/util.js +16 -3
- package/dist/cjs/plugins/searchService/src/poiSearch.js +57 -19
- package/dist/cjs/plugins/searchService/src/searchService.js +246 -21
- package/dist/cjs/plugins/searchService/src/searchTypeahead.js +60 -3
- package/dist/cjs/plugins/searchService/src/utils.js +23 -4
- package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +472 -23
- package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +191 -23
- package/dist/cjs/plugins/wayfinder/src/findRoute.js +147 -19
- package/dist/cjs/plugins/wayfinder/src/minPriorityQueue.js +88 -2
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +393 -5
- package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +110 -20
- package/dist/cjs/plugins/wayfinder/src/segmentBadges.js +28 -2
- package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +257 -19
- package/dist/cjs/plugins/wayfinder/src/segmentCategories.js +29 -2
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +238 -3
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +597 -22
- package/dist/cjs/src/app.js +191 -25
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +58 -2
- package/dist/cjs/src/configs/postproc-stateTracking.js +53 -19
- package/dist/cjs/src/controller.js +43 -4
- package/dist/cjs/src/debugTools.js +128 -23
- package/dist/cjs/src/env.js +17 -2
- package/dist/cjs/src/extModules/bustle.js +128 -4
- package/dist/cjs/src/extModules/flexapi/src/help.js +23 -4
- package/dist/cjs/src/extModules/flexapi/src/index.js +65 -4
- package/dist/cjs/src/extModules/flexapi/src/validate.js +133 -5
- package/dist/cjs/src/extModules/geohasher.js +90 -3
- package/dist/cjs/src/extModules/log.js +69 -2
- package/dist/cjs/src/historyManager.js +29 -2
- package/dist/cjs/src/utils/bounds.js +22 -4
- package/dist/cjs/src/utils/buildStructureLookup.js +31 -19
- package/dist/cjs/src/utils/configUtils.js +71 -3
- package/dist/cjs/src/utils/dom.js +48 -5
- package/dist/cjs/src/utils/funcs.js +30 -7
- package/dist/cjs/src/utils/geodesy.js +35 -3
- package/dist/cjs/src/utils/geom.js +212 -25
- package/dist/cjs/src/utils/i18n.js +69 -5
- package/dist/cjs/src/utils/observable.js +73 -2
- package/dist/cjs/src/utils/rand.js +82 -3
- package/dist/nodesdk/nodeEntry.js +1 -0
- package/dist/package.json.js +1 -0
- package/dist/plugins/dynamicPois/src/dynamicPois.js +1 -0
- package/dist/plugins/sdkServer/src/sdkHeadless.js +1 -0
- package/{lib → dist}/plugins/sdkServer/src/sdkServer.js +1 -1
- package/dist/plugins/searchService/src/poiSearch.js +1 -0
- package/dist/plugins/searchService/src/searchService.js +1 -0
- package/dist/plugins/venueDataLoader/src/venueDataLoader.js +1 -0
- package/dist/plugins/venueDataLoader/src/venueLoadingUtils.js +1 -0
- package/dist/plugins/wayfinder/src/navGraph.js +1 -0
- package/{lib → dist}/plugins/wayfinder/src/segmentBuilder.js +1 -1
- package/dist/plugins/wayfinder/src/stepBuilder.js +1 -0
- package/dist/plugins/wayfinder/src/wayfinder.js +1 -0
- package/dist/src/app.js +1 -0
- package/dist/src/configs/postproc-mol-url-parms.js +1 -0
- package/{lib → dist}/src/configs/sdkHeadless.json.js +1 -1
- package/dist/src/extModules/bustle.js +1 -0
- package/dist/src/extModules/log.js +1 -0
- package/dist/src/utils/funcs.js +1 -0
- package/dist/src/utils/geom.js +1 -0
- package/dist/src/utils/i18n.js +1 -0
- package/package.json +17 -9
- package/config/rollup.config.cjs.js +0 -31
- package/dist/cjs/deploy/nodeEntry.js +0 -15
- package/dist/cjs/src/auth/Auth.js +0 -23
- package/lib/deploy/nodeEntry.js +0 -1
- package/lib/package.json.js +0 -1
- package/lib/plugins/dynamicPois/src/dynamicPois.js +0 -1
- package/lib/plugins/sdkServer/src/sdkHeadless.js +0 -1
- package/lib/plugins/searchService/src/poiSearch.js +0 -1
- package/lib/plugins/searchService/src/searchService.js +0 -1
- package/lib/plugins/venueDataLoader/src/venueDataLoader.js +0 -1
- package/lib/plugins/venueDataLoader/src/venueLoadingUtils.js +0 -1
- package/lib/plugins/wayfinder/src/navGraph.js +0 -1
- package/lib/plugins/wayfinder/src/stepBuilder.js +0 -1
- package/lib/plugins/wayfinder/src/wayfinder.js +0 -1
- package/lib/src/app.js +0 -1
- package/lib/src/auth/Auth.js +0 -1
- package/lib/src/configs/postproc-mol-url-parms.js +0 -1
- package/lib/src/configs/sdkHeadless.json +0 -28
- package/lib/src/extModules/bustle.js +0 -1
- package/lib/src/extModules/log.js +0 -1
- package/lib/src/utils/funcs.js +0 -1
- package/lib/src/utils/geom.js +0 -1
- package/lib/src/utils/i18n.js +0 -1
- /package/{lib → dist}/_virtual/_empty_module_placeholder.js +0 -0
- /package/{lib → dist}/deploy/prepareSDKConfig.js +0 -0
- /package/{lib → dist}/plugins/clientAPI/src/clientAPI.js +0 -0
- /package/{lib → dist}/plugins/poiDataManager/src/poiDataManager.js +0 -0
- /package/{lib → dist}/plugins/sdkServer/src/util.js +0 -0
- /package/{lib → dist}/plugins/searchService/src/searchTypeahead.js +0 -0
- /package/{lib → dist}/plugins/searchService/src/utils.js +0 -0
- /package/{lib → dist}/plugins/wayfinder/src/findRoute.js +0 -0
- /package/{lib → dist}/plugins/wayfinder/src/minPriorityQueue.js +0 -0
- /package/{lib → dist}/plugins/wayfinder/src/navGraphDebug.js +0 -0
- /package/{lib → dist}/plugins/wayfinder/src/segmentBadges.js +0 -0
- /package/{lib → dist}/plugins/wayfinder/src/segmentCategories.js +0 -0
- /package/{lib → dist}/src/configs/postproc-stateTracking.js +0 -0
- /package/{lib → dist}/src/controller.js +0 -0
- /package/{lib → dist}/src/debugTools.js +0 -0
- /package/{lib → dist}/src/env.js +0 -0
- /package/{lib → dist}/src/extModules/flexapi/src/help.js +0 -0
- /package/{lib → dist}/src/extModules/flexapi/src/index.js +0 -0
- /package/{lib → dist}/src/extModules/flexapi/src/validate.js +0 -0
- /package/{lib → dist}/src/extModules/geohasher.js +0 -0
- /package/{lib → dist}/src/historyManager.js +0 -0
- /package/{lib → dist}/src/utils/bounds.js +0 -0
- /package/{lib → dist}/src/utils/buildStructureLookup.js +0 -0
- /package/{lib → dist}/src/utils/configUtils.js +0 -0
- /package/{lib → dist}/src/utils/dom.js +0 -0
- /package/{lib → dist}/src/utils/geodesy.js +0 -0
- /package/{lib → dist}/src/utils/observable.js +0 -0
- /package/{lib → dist}/src/utils/rand.js +0 -0
|
@@ -1,5 +1,76 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function
|
|
3
|
+
function fire () {
|
|
4
|
+
const ob = this._observers;
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
if (!ob)
|
|
7
|
+
return undefined
|
|
8
|
+
|
|
9
|
+
for (let x = 0; x < ob.length; x++)
|
|
10
|
+
try { ob[x].apply(this, arguments); } catch (err) { console.error(err); }
|
|
11
|
+
|
|
12
|
+
return this
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function observe (cb) {
|
|
16
|
+
if (!this._observers)
|
|
17
|
+
this._observers = [];
|
|
18
|
+
|
|
19
|
+
this._observers.push(cb);
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
detach: detach.bind(this, cb),
|
|
23
|
+
ob: this
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function detach (cb) {
|
|
28
|
+
this._observers.splice(this._observers.indexOf(cb), 1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Returns a new derivitive observer that fires events when the observed object fires iff
|
|
32
|
+
// the event passes the predicate function specified here.
|
|
33
|
+
function filter (fn) {
|
|
34
|
+
const o2 = create();
|
|
35
|
+
|
|
36
|
+
this.observe(function () {
|
|
37
|
+
if (fn.apply(this, arguments))
|
|
38
|
+
o2.fire.apply(o2, arguments);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return o2
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// When first argument denotes an event name, this is a convenience
|
|
45
|
+
// method to filter by that name
|
|
46
|
+
function filterByName (eventName) {
|
|
47
|
+
return filter.call(this, function (name) {
|
|
48
|
+
return eventName === name
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Filters on equivilence of first argument (often the event name) and observes
|
|
53
|
+
// the result - calling the callback function when triggered
|
|
54
|
+
function on (value, cb) {
|
|
55
|
+
return filterByName.call(this, value).observe(cb)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const observable = { detach, filter, fire, observe, on };
|
|
59
|
+
|
|
60
|
+
// extend `to` argument with properties from `from`
|
|
61
|
+
// [short version]
|
|
62
|
+
function extend (to, from) {
|
|
63
|
+
for (const prop in from)
|
|
64
|
+
to[prop] = from[prop];
|
|
65
|
+
|
|
66
|
+
return to
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function create (ob) {
|
|
70
|
+
if (ob)
|
|
71
|
+
return extend(ob, observable)
|
|
72
|
+
|
|
73
|
+
return Object.create(observable)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
module.exports = create;
|
|
@@ -2,7 +2,86 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const jsRandom = () => ({
|
|
6
|
+
nextInt: max => Math.floor(Math.random() * max)
|
|
7
|
+
});
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
const defaultRandom = jsRandom();
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Returns a random list of length size of numbers from 0 to max-1, which represents a set of
|
|
13
|
+
* those numbers. i.e. no number will repeat. (size is forced to not be bigger than max)
|
|
14
|
+
*
|
|
15
|
+
* Can be used to choose a random selection from a list of selections. Or if
|
|
16
|
+
* size = max, it becomes a random ordering of a List.
|
|
17
|
+
*
|
|
18
|
+
* NOTE: if the setSize is 0, max will set to 0 and you get an empty List object
|
|
19
|
+
*
|
|
20
|
+
* ForExample:
|
|
21
|
+
* randomSet(3, 5) = [3, 2, 0]
|
|
22
|
+
* randomSet(3, 5) = [1, 0, 3]
|
|
23
|
+
* randomSet(3, 5) = [1, 4, 2]
|
|
24
|
+
*
|
|
25
|
+
* @param size the number of values to return
|
|
26
|
+
* @param max a positive integer
|
|
27
|
+
* @param r an optional Random instance (else one is generated)
|
|
28
|
+
* @return a List of random values from 0 to max-1 with no number repeating
|
|
29
|
+
*/
|
|
30
|
+
function randomSet (size, max, r) {
|
|
31
|
+
r = r || defaultRandom;
|
|
32
|
+
|
|
33
|
+
let i;
|
|
34
|
+
|
|
35
|
+
if (!max)
|
|
36
|
+
max = size;
|
|
37
|
+
|
|
38
|
+
if (size > max)
|
|
39
|
+
size = max;
|
|
40
|
+
|
|
41
|
+
const list = [];
|
|
42
|
+
|
|
43
|
+
if (((max / size) >= 2.0) || (max < 40)) {
|
|
44
|
+
// if the set we are choosing from is considerably bigger than the number we are selecting
|
|
45
|
+
// then let's just grab random values and check to see if they are in our new list yet.
|
|
46
|
+
while (list.length < size) {
|
|
47
|
+
i = r.nextInt(max);
|
|
48
|
+
if (list.indexOf(i) < 0)
|
|
49
|
+
list.push(i);
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
// if the list is to be nearly same size as what we are choosing from, let's build a source
|
|
53
|
+
// list of the numbers and grab from them one at a time.
|
|
54
|
+
const source = [];
|
|
55
|
+
for (i = 0; i < max; i++)
|
|
56
|
+
source.push(i);
|
|
57
|
+
|
|
58
|
+
for (i = 0; i < size; i++) {
|
|
59
|
+
const index = r.nextInt(source.length);
|
|
60
|
+
list.push(source[index]);
|
|
61
|
+
source.splice(index, 1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return list
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Pass in a source array and a map array of indices, and this returns a new
|
|
69
|
+
// array of the members of the first based on the indices of the second. Useful when
|
|
70
|
+
// used along with randomset above.
|
|
71
|
+
// i.e.
|
|
72
|
+
// a1 = [ "a", "b", "c", "d", "e", "f" ]
|
|
73
|
+
// a2 = [ 2, 3, 5, 4, 0, 1]
|
|
74
|
+
// a3 = getMappedArray(a1, a2) = [ "c", "d", "f", "e", "a", "b" ]
|
|
75
|
+
const getMappedArray = (array, map) => map.map(i => array[i]);
|
|
76
|
+
|
|
77
|
+
// Randomly pick a number of items from an array and return them in an array
|
|
78
|
+
// leaving the original array untouched. If no number is specified, a length
|
|
79
|
+
// of 1 is returned.
|
|
80
|
+
const arrayPick = (array, num) => {
|
|
81
|
+
num = num || 1;
|
|
82
|
+
const map = randomSet(num, array.length);
|
|
83
|
+
return getMappedArray(array, map)
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
exports.arrayPick = arrayPick;
|
|
87
|
+
exports.randomSet = randomSet;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"node:http";import t from"node:https";import{HttpsProxyAgent as n}from"https-proxy-agent";import o from"node-fetch";import r from"../deploy/prepareSDKConfig.js";import s from"../package.json.js";import{create as c}from"../src/controller.js";import i from"../src/utils/observable.js";const a=s.version;let g=!1;const m=e=>e.toString().length<2?"0"+e:e,p=()=>`AtriusMaps Node SDK (${(()=>{const e=new Date;return`${e.getHours()}:${m(e.getMinutes())}:${m(e.getSeconds())}.${e.getMilliseconds()}`})()}): `,l=function(){if(g){let e=p()+Array.from(arguments).map((e=>"object"==typeof e?JSON.stringify(e):e)).join(" ");const t=e.split("\n");t.length>1?e=t[0]+`… (+ ${t.length-1} lines)`:e.length>256&&(e=e.substring(0,255)+`… (length: ${e.length} chars)`),console.log(e)}};async function f(s){return new Promise(((a,g)=>{s.headless=!0,function(r){const s=new e.Agent({keepAlive:!0}),c=new t.Agent({keepAlive:!0}),i=r.proxy?new n(`http://${r.proxy.host}:${r.proxy.port}`):null,a=r.agent||i||(e=>"http:"===e.protocol?s:c);global.fetch=async(e,t)=>o(e,{...t,agent:a})}(s);const m=r(s);c(m).then((e=>{const t=(t,n)=>("string"==typeof t&&(t={...n,command:t}),l("Sending command object: ",t),e.bus.get("clientAPI/execute",t).then((e=>(l("Received Message: ",e),e))).catch((e=>{throw l("Error: ",e.message),e})));i(t),e.eventListener.observe((function(){t.fire.apply(t,arguments)})),t.on("ready",((e,n)=>{const{commands:o}=n.commandJSON;!function(e,t){t.forEach((t=>{e[t.command]=function(){const n={command:t.command};for(let e=0;e<arguments.length;e++)n[t.args[e].name]=arguments[e];return e(n)}}))}(t,o),a(t),l("map ready")}))}))}))}const h={getVersion:()=>a,newMap:e=>f(e),setLogging:e=>{g=e,e&&l(`Atrius Maps JS SDK Client v${a} Logging enabled.`)}};export{h as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e="web-engine",s="3.3.225",o="UNLICENSED",l="module",t="src/main.js",r=["demo","deploy","nodesdk","pagesSrc","src/extModules/flexapi"],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: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",lint:"eslint . --max-warnings=0",mod:"demo/startMod.sh",mol:"demo/startMol.sh",molProd:"cd deploy && yarn buildAndRunMol",mos:"demo/startMos.sh",prepare:"husky install",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:e2e:video":"cypress run"},n=["defaults"],c={"@azure/event-hubs":"^5.6.0","@dnd-kit/core":"^6.0.8","@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.108","@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-submenu":"^0.1.121","@locus-labs/mol-desktop-tooltip":"^0.3.102","@locus-labs/mol-desktop-zoom-control":"^0.1.134","@locus-labs/mol-mobile-floating-action-button":"^0.0.106","@locus-labs/mol-mobile-toast":"^0.1.102","@mapbox/mapbox-gl-draw":"^1.3.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.1.2","@turf/circle":"^6.5.0","@turf/helpers":"^6.5.0","@turf/point-to-line-distance":"^6.5.0","@vitejs/plugin-react":"^4.0.1",IObject:"^0.7.2","axe-core":"^4.9.0","crypto-browserify":"^3.12.0","cypress-axe":"^1.5.0","file-loader":"^6.2.0",flexsearch:"^0.7.31","h3-js":"^4.1.0",i18next:"^20.3.4","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"4.0.1",jsonschema:"^1.2.6",luxon:"^3.3.0","maplibre-gl":"~2.1.9","mini-css-extract-plugin":"^1.6.0","node-polyfill-webpack-plugin":"^1.1.4","path-browserify":"^1.0.1",polished:"^4.0.2","prop-types":"^15.7.2","query-string":"^8.1.0",ramda:"^0.28.0",react:"^17.0.2","react-compound-slider":"^3.3.1","react-dom":"^17.0.2","react-json-editor-ajrm":"^2.5.13","react-qr-svg":"^2.2.1","react-svg":"^16.1.29","react-tageditor":"^0.2.3","react-virtualized-auto-sizer":"^1.0.2","smoothscroll-polyfill":"^0.4.4","styled-components":"5.1.0","styled-normalize":"^8.0.6","throttle-debounce":"^3.0.1",trackjs:"^3.7.4","ua-parser-js":"^0.7.23",uuid:"3.3.2",zousan:"^3.0.1","zousan-plus":"^4.0.1"},i={"@applitools/eyes-cypress":"^3.44.0","@babel/core":"^7.14.8","@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","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":"^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:"^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",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","start-server-and-test":"^2.0.0",vite:"^4.3.9",webpack:"^5.84.1","webpack-merge":"^5.8.0"},p="yarn@4.0.2",d={node:">=20"},m={name:e,version:s,private:!0,license:o,type:l,main:t,workspaces:r,scripts:a,"lint-staged":{"*.js":["eslint --fix"]},browserslist:n,dependencies:c,devDependencies:i,packageManager:p,engines:d};export{n as browserslist,m as default,c as dependencies,i as devDependencies,d as engines,o as license,t as main,e as name,p as packageManager,a as scripts,l as type,s as version,r as workspaces};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"ramda";import t from"zousan";function a(a,s){let n=new t;const i=new t;function o(...e){r(...e),m(...e)}function r(t,s){const n=e.pipe(e.filter((e=>"parking"===e.category)),e.map((a=>{const s=a.dynamicAttributes;if(!s)throw Error(`No dynamicAttributes defined for parking POI ${a.poiId}`);return{...(t-a.timestamp)/1e3<s["parking.timeToLive"]?e.pick(["lotStatus","rateDay","rateHour","timeIsReal","timeToTerminal1","timeToTerminal2"],a):{lotStatus:s["parking.default"],rateDay:"$ -",rateHour:"$ -",timeIsReal:!1},lastUpdated:a.timestamp,lotName:a.lotName}})))(s);a.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:n})}const u=async e=>{const t={};for(const s of e){const e=await a.bus.get("poi/getById",{id:s});e&&(t[s]=e.name)}return t},c=(e,t)=>a=>{const s=a.properties.id,n=e[s],i=t[s];if(n){const{queueTime:e,isTemporarilyClosed:t}=n,s=t?"(closed)":`(${e} minute wait)`;a.properties.text=`${i}\n${s}`}return a};async function p(t,s){const n=e.pipe(e.map((e=>[e.poiId,l(t,e)])),e.fromPairs)(s);a.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:n});const i=await u(Object.keys(n));a.bus.send("map/mutateFeature",{functor:c(n,i)})}const l=(e,t)=>({queueTime:t.queueTime,isTemporarilyClosed:t.isTemporarilyClosed,timeIsReal:!t.isQueueTimeDefault&&t.expiration>e,lastUpdated:e});function m(t,s){const n=["dynamicData","openClosed"],i=e.filter(e.hasPath(n),s),o=e.map(e.path(n),i);if(!e.all(e.both(e.has("isOpen"),e.has("expiration")),e.values(o)))throw Error("Open Closed poi status is malformed.");{const s=e.pipe(e.prop("expiration"),e.lt(t)),n=e.filter(s,o);a.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:n})}}return a.bus.on("venueData/venueDataLoaded",(({venueData:e})=>{n.v?n=t.resolve(e):n.resolve(e)})),a.bus.on("system/readywhenyouare",(()=>i)),{init:async()=>{const e=s.urlBase||"https://rest.locuslabs.com/v3",t=s.urlBaseV1||s.urlBase||"https://rest.locuslabs.com/v1",r=a.config.plugins.venueDataLoader.accountId;async function u(){return n.then((e=>{let a=`${t}/venue/${e.id}/account/${r}/get-all-dynamic-pois/`;return(t.startsWith("./")||t.endsWith(".json"))&&(a=t),a}))}const c=async()=>n.then((t=>e.startsWith("./")||e.endsWith(".json")?e:`${e}/venueId/${t.id}/accountId/${r}/get-dynamic-queue-times/`)),l=async()=>{Promise.all([u().then(fetch).then((e=>e.json())).then((e=>o(Date.now(),e))),c().then(fetch).then((e=>e.json())).then((e=>p(Date.now(),e)))]).then((()=>i.resolve(!0))).catch((e=>{console.error(e),i.resolve(!0)}))},m=await a.bus.get("venueData/getQueueTypes");m.SecurityLane&&m.SecurityLane.length?n.then(l).then((()=>setInterval(l,3e4))):i.resolve(!0)},internal:{mutateSecurityCheckpointLabel:c,processSecurityWaitTimes:p,processParkingPOIS:r,processOpenClosedPois:m,processDynamicPois:o}}}export{a as create};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"ramda";import{locationToEndpoint as t,getStructures as n}from"./util.js";const s=[{command:"destroy"},{command:"getDirections",args:[{name:"from",type:"location"},{name:"to",type:"location"},{name:"accessible",type:"boolean",optional:!0},{name:"queueTypes",type:"list",itemType:{type:"string"},optional:!0}]},{command:"getDirectionsMultiple",args:[{name:"locations",type:"list",itemType:{type:"location"}},{name:"accessible",type:"boolean",optional:!0},{name:"queueTypes",type:"list",itemType:{type:"string"},optional:!0}]},{command:"getPOIDetails",args:[{name:"poiId",type:"integer",min:0}]},{command:"getAllPOIs"},{command:"getStructures"},{command:"getVenueData"},{command:"search",args:[{name:"term",type:"string",minLength:2},{name:"details",type:"boolean",optional:!0}]}];function i(s){s.bus.on("clientAPI/destroy",(async()=>s.destroy())),s.bus.on("clientAPI/getDirections",(async({from:n,to:i,accessible:a,queueTypes:o})=>{const c=await t(s,n),r=await t(s,i),l={requiresAccessibility:!!a};return o&&(l.selectedSecurityLanes={SecurityLane:o}),s.bus.get("wayfinder/getRoute",{fromEndpoint:c,toEndpoint:r,options:l}).then(e.pick(["distance","time","steps","navline","waypoints"]))})),s.bus.on("clientAPI/getDirectionsMultiple",(async({locations:n,accessible:i,queueTypes:a})=>{const o=await Promise.all(n.map((async e=>t(s,e)))),c={requiresAccessibility:!!i};a&&(c.selectedSecurityLanes={SecurityLane:a});const r=await Promise.all(e.aperture(2,o).map((async e=>s.bus.get("wayfinder/getRoute",{fromEndpoint:e[0],toEndpoint:e[1],options:c})))),l=e.map(e.pick(["distance","time","steps","navline","waypoints"]),r);return{total:{distance:e.sum(e.map((e=>e.distance),l)),time:e.sum(e.map((e=>e.time),l))},directions:l}})),s.bus.on("clientAPI/getPOIDetails",(async({poiId:e})=>s.bus.get("poi/getById",{id:e}))),s.bus.on("clientAPI/getAllPOIs",(async()=>s.bus.get("poi/getAll"))),s.bus.on("clientAPI/getStructures",(()=>n(s)));const i=e=>"function"!=typeof e;s.bus.on("clientAPI/getVenueData",(async()=>{const t=await s.bus.get("venueData/getVenueData");return e.filter(i,t)})),s.bus.on("clientAPI/search",(async({term:e,details:t})=>s.bus.get("search/queryAsync",{term:e}).then((n=>{const i=n.map((e=>e.poiId));return s.bus.send("event/search",{referrer:"prog",searchMethod:null,query:e,entities:i}),t?n:i}))))}export{i as handleHeadless,s as headlessCommands};
|
|
@@ -1 +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=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("poiDetails/showPoi",(({poi:e})=>o("poiShown",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.js").then((e=>{e.visualCommands.forEach((e=>a.bus.send("clientAPI/registerCommand",e))),e.handleVisual(a,i)}));const e=async()=>{await a.bus.send("
|
|
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("poiDetails/showPoi",(({poi:e})=>o("poiShown",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.js").then((e=>{e.visualCommands.forEach((e=>a.bus.send("clientAPI/registerCommand",e))),e.handleVisual(a,i)}));const e=async()=>{await a.bus.send("system/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),a.bus.on("sdkServer/sendEvent",(({eventName:e,...t})=>i(e,t)))}}}export{r as create};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from"ramda";import{getFlexSearchInstance as a}from"./utils.js";function r(r,e){const o=a({lang:e});function n(a){return Object.values(a).map((a=>{const{poiId:r,category:e="",name:o,keywords:n=[],roomId:i=""}=a,c=t.path(["dynamicData","grab","tags"],a)||[],s=n.filter(t.prop("isUserSearchable")).map(t.prop("name")),p=`${o} ${e.split(".").join(" ")} ${i} ${s.join(" ")} ${c.join(" ")}`;return[Number(r),p]}))}return n(r).forEach((([t,a])=>o.add(t,a))),{search:function(a){const e={...a};e.limit||(e.limit=5e3);const n=o.search(e);return Object.values(t.pick(n,r))},updateMultiple:function(t){n(t).forEach((([t,a])=>o.update(t,a)))}}}export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"ramda";import r from"zousan";import{getLocalized as a}from"../../../src/utils/configUtils.js";import{arrayPick as s}from"../../../src/utils/rand.js";import t from"./poiSearch.js";import n from"./searchTypeahead.js";function o(o,i){const c={poiSearch:null,typeahead:null,indexesCreated:new r,defaultSearchTerms:null,specialQueryTerms:{}},u=async()=>{const e=await o.bus.get("poi/getAll");c.poiSearch=t(e,o.i18n().language),c.typeahead=n(e,c.poiSearch.search,o.i18n().language),c.defaultSearchTerms=a(i,"defaultSearchTerms",o.i18n().language),c.indexesCreated.resolve()};async function d(){const r=await o.bus.get("user/getPhysicalLocation");if(!r?.floorId)return[];const a=await o.bus.get("poi/getByFloorId",{floorId:r?.floorId}),s=Object.values(e.pickBy((e=>-1===e.category.indexOf("portal")&&"element.door"!==e.category),a)),t=await o.bus.get("wayfinder/addPathTimeMultiple",{pois:s,startLocation:r});return e.sortBy(e.prop("distance"),Object.values(t)).slice(0,50)}o.bus.on("search/queryNearby",(async()=>{const e=await d();return o.bus.send("search/showNearby",{pois:e,term:"Nearby"}),e})),o.bus.on("search/queryNearbyAsync",d),o.bus.on("search/queryCategory",(async({category:e,categoryName:r,searchTerm:a})=>{const s=await c.indexesCreated.then((()=>c.poiSearch.search({query:a||e})));return o.bus.send("search/showCategory",{pois:s,category:e,categoryName:r}),s})),o.bus.on("search/query",(({term:e})=>c.indexesCreated.then((()=>{const r=c.poiSearch.search({query:e});return o.bus.send("search/showSearchResults",{results:r,term:e}),r})))),o.bus.on("search/queryAsync",(({term:e})=>c.indexesCreated.then((()=>c.poiSearch.search({query:e}))))),o.bus.on("search/queryWithSpecial",(({term:e})=>{if(c.specialQueryTerms[e]){const{event:r,params:a}=c.specialQueryTerms[e];return o.bus.send(r,a)}return o.bus.get("search/query",{term:e})})),o.bus.on("search/getDefaultSearchTerms",(async({limit:e=5}={})=>{const r=c.defaultSearchTerms,a=r&&r.length?r:await async function(e){const r=(await o.bus.send("poi/getAllCategories"))[0],a=Array.from(new Set(r));return function(e){for(let r=e.length-1;r>0;r--){const a=Math.floor(Math.random()*(r+1));[e[r],e[a]]=[e[a],e[r]]}return e}(a).slice(0,e)}(e);return o.bus.send("search/showDefaultSearchKeywords",{keywords:a}),a})),o.bus.on("search/getDefaultSearchPois",(async({limit:r=5}={})=>{const a=await o.bus.get("poi/getAll"),t=e.pickBy(((e,r)=>e.isNavigable),a);return s(Object.values(t),r)})),o.bus.on("search/registerSpecialQuery",(({term:e,event:r,params:a,addKeyword:s=!0})=>{c.indexesCreated.then((()=>{s&&c.typeahead.addKeyword(e),c.specialQueryTerms[e]={event:r,params:a}}))})),o.bus.on("search/addKeywords",(({keywords:e})=>c.indexesCreated.then((()=>e.forEach((e=>c.typeahead.addKeyword(e))))))),o.bus.on("search/typeahead",(({term:e,limit:r})=>c.indexesCreated.then((()=>{const{keywords:a,pois:s}=c.typeahead.query(e,r);return{keywords:a,pois:s,term:e}})))),o.bus.on("venueData/loadNewVenue",(()=>{c.indexesCreated=new r,u()})),o.bus.on("poi/setDynamicData",(async({plugin:e,idValuesMap:r})=>{if("grab"!==e)return;const a=Object.keys(r).map((e=>o.bus.get("poi/getById",{id:e})));return Promise.all(a).then((e=>c.indexesCreated.then((()=>c.poiSearch.updateMultiple(e)))))}));return{init:u,runTest:async(e,r)=>(await r(),c)}}export{o as create};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"ramda";import a from"zousan";import{normalizeCoords as t,getVenueDataFromUrls as n,buildStructures as s,createFetchJson as u,createFetchText as o}from"./venueLoadingUtils.js";async function r(r,i){const d=r.log.sublog("venueDataLoader");let l=new a,c=new a;const p=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),v=e=>{const a=i.availableLanguages.find((a=>a.langCode===e));return a||{langCode:e,assetSuffix:""}};async function g(a,t){a.assetStage&&"prod"!==a.assetStage&&location.hostname;const i=u(),c=o(),g=await n(a,i,t),{accountId:f,venueId:b}=a;g.assetStage=a.assetStage,g.defaultOrdinal=g.defaultOrdinal||function(a){const t=p(a),n=Object.values(a.structures).find(e.propEq("id",t));return n.levels[n.defaultLevelId].ordinal}(g),g.structures=s(g);const m=r.i18n().language,h=v(m);return g.bareVenueId=b.slice(0,b.length-h.assetSuffix.length),g.getTranslatedContentPath=e=>`https://content.locuslabs.com/${g.category}/${e}/${b}/${f}`,g.fetchJson=i,g.fetchText=c,d.info("venueData ",g,h,m),r.config.debug&&r.env.isBrowser&&(window._venueData=g),g.queueTypes&&(g.securityQueueTypes=(()=>{const e=g.queueTypes.find((e=>"SecurityLane"===e.id));return e?e.subtypes.map((e=>e.id)):[]})()),r.bus.send("venueData/venueDataLoaded",{venueData:g}),l.resolve(g),l}function f(e){const a={id:"venueDataLoader"};return e.id!==i.venueId&&(a.vid=e.id),a.lang=r.i18n().language,"prod"!==e.assetStage&&(a.stage=e.assetStage),r.bus.send("deepLinking/notifyState",a),e}r.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 r.bus.send("map/replaceTheme",{theme:n});if(e.metadata&&e.metadata["mapbox:type"])return t=a,void r.bus.send("map/replaceStyle",{styleSrc:t})}var t,n}));const b=(e,a)=>e===a||0===e.indexOf(a+".");async function m(e){const a={...e},t=await r.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!==i.copyPOINamesToMap&&(e.properties.text=function(e){let a=e.name;return i.poiMapNameXForm?(Object.keys(i.poiMapNameXForm).filter((a=>b(e.category,a))).forEach((e=>{i.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)}))};r.bus.on("venueData/loadMap",(async()=>{l.then((async t=>{const n=await t.fetchText(t.files.style),s=await t.fetchJson(t.files.theme),u=t.files.spritesheet,o=t.files.glyphs,{id:d,bounds:l,structures:p,venueCenter:v,venueRadius:g,defaultOrdinal:f}=t,b=t.venueList[d].mapTokens?{[d]:[]}:await async function(t){return e.pipe(e.prop("structures"),e.map(e.prop("levels")),e.chain(e.keys),e.prepend(t.id),e.map((e=>t.files.geoJson.replace("${geoJsonId}",e))),e.map(t.fetchJson),e.map(e.andThen((e=>[e.id,h(e.id,e.features,t.id,t.structures)]))),(e=>a.all(e)),e.andThen(e.fromPairs))(t)}(t).then(m),y={mapFeatures:b,mapStyleSource:n,mapTheme:s,badgesSpriteUrl:u,mapGlyphsUrl:o,structures:p,defaultOrdinal:f,venueBounds:{n:l.ne.lat,s:l.sw.lat,e:l.ne.lng,w:l.sw.lng},venueId:d,venueCenter:v,venueRadius:g,accountId:i.accountId,secure:void 0!==i.auth,tileServerAuthInfo:t.tileServerAuthInfo};c.resolve(y),r.bus.send("venueData/mapDataLoaded",y)}))}));const y=e=>null==e.shouldDisplay||e.shouldDisplay;r.bus.on("venueData/loadBuildingSelectorData",(()=>l.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 r.bus.send("venueData/buildingSelectorDataLoaded",t),t})))),r.bus.on("venueData/normalizeCoords",(({coords:e})=>l.then((a=>t(e,a.bounds)))));const D={edges:[],nodes:[]};r.bus.on("venueData/loadNavGraph",(async()=>l.then((async e=>{const a={navGraphData:e.files.nav?await e.fetchJson(e.files.nav):D,structures:e.structures};return r.bus.send("venueData/navGraphLoaded",a),a})))),r.bus.on("venueData/loadPoiData",(async()=>l.then((async e=>{const a=i.useOldDataModel?e.files.poisOld||e.files.pois:e.files.pois||e.files.poisOld;if(a){const t=await e.fetchJson(a);r.bus.send("venueData/poiDataLoaded",{pois:t,structures:e.structures})}})))),r.bus.on("venueData/getVenueCenter",(async()=>l.then((async e=>({lat:e.venueCenter[0],lng:e.venueCenter[1],ordinal:0}))))),r.bus.on("venueData/getContentUrl",(({type:e,name:a=""})=>l.then((t=>t.files[e]+a)))),r.bus.on("venueData/getFloorIdToNameMap",(()=>l.then(e.pipe(e.prop("structures"),e.map(e.prop("levels")),e.chain(e.values),e.map(e.props(["id","name"])),e.fromPairs)))),r.bus.on("venueData/getFloorIdName",(({floorId:a})=>l.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 I=(a,t)=>()=>l.then(e.pipe(e.prop(a),e.defaultTo(t)));r.bus.on("venueData/getVenueData",(()=>l)),r.bus.on("venueData/getVenueName",I("name")),r.bus.on("venueData/getVenueCategory",I("category")),r.bus.on("venueData/getVenueTimezone",I("tz")),r.bus.on("venueData/getAccountId",(()=>i.accountId)),r.bus.on("venueData/getVenueId",I("id")),r.bus.on("venueData/getPositioningSupported",I("positioningSupported")),r.bus.on("venueData/getStructures",I("structures")),r.bus.on("venueData/loadNewVenue",(async({venueId:e,accountId:t,assetStage:n=i.assetStage})=>{l.reject(new Error("loadNewVenue called - previous loading ignored")),c.reject(new Error("loadNewVenue called - previous loading ignored")),l=new a,c=new a,g({...i,venueId:e,accountId:t,assetStage:n},[]).then(f)})),r.bus.on("venueData/changeVenueLanguage",(async({lang:e})=>l.then((async a=>{const t=v(e),n=`${a.bareVenueId}${t.assetSuffix}`;r.bus.send("venueData/loadNewVenue",{accountId:i.accountId,venueId:n})})))),r.bus.on("venueData/getPoiImageUrl",(({imageName:e,size:a})=>`https://img.locuslabs.com/resize/${i.accountId}/${a}cc/poi/${e}`)),r.bus.on("venueData/getDistributionId",(()=>l.then((e=>`${e.bareVenueId}-${i.accountId}`)))),r.bus.on("venueData/getCustomKeywords",(()=>l.then((e=>{const a=i.useOldDataModel&&e.files.searchOld||e.files.search;return e.fetchJson(a)})))),r.bus.on("venueData/isGrabEnabled",I("enableGrab")),r.bus.on("venueData/getGrabPoiIds",I("grabPoiIds",[])),r.bus.on("venueData/getAssetsTimestamp",I("version")),r.bus.on("venueData/getTranslatedFloorId",(async({floorId:e})=>l.then((a=>{const t=r.i18n().language,n=v(t);return`${a.bareVenueId}${n.assetSuffix}-${e.split("-").slice(1).join("-")}`})))),r.bus.on("venueData/getQueueTypes",(()=>l.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()=>{let e=[];null===new URLSearchParams("undefined"==typeof window?"":window.location.search).get("lang")&&(e="undefined"==typeof window?[]:navigator.languages);const a=i.deepLinkProps||{};a.lang&&e.unshift(a.lang);const t=a.vid||i.venueId,n=i.useDynamicUrlParams&&a.stage?a.stage:i.assetStage,s=a.accountId||("alpha"===n?"A1VPTJKREFJWX5":i.accountId);g({...i,venueId:t,accountId:s,assetStage:n},e).then(f)},runTest:async({testRoutine:e,reset:t=!1,venueData:n=null})=>{let s,u;return(t||n)&&(l=new a,c=new a),n&&(l=a.resolve(n)),await e(),l.v&&(s=await l),c.v&&(u=await c),{venueDataObj:s,mapDataObj:u}},internal:{getDefaultStructureId:p}}}export{r as create};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"ramda";import{findBoundsOfCoordinates as t}from"../../../src/utils/bounds.js";import{global as a}from"../../../src/utils/configUtils.js";const n=async(e,t)=>e?fetch(t,{headers:{Authorization:e}}):fetch(t),s=e=>t=>n(e,t).then((e=>e.json())),o=e=>t=>n(e,t).then((e=>e.text())),l=e=>`https://api.content.locuslabs.com/${e}`,r=(t,a,n,s,o)=>e.mapObjIndexed(((e,a)=>((e,t,a,n,s,o)=>"theme"===o||"style"===o?`${l(a)}/${t}/${o}/${s}/${n}/${o}.json`:e.replace(/https:\/\/content.locuslabs.com/gi,l(a)))(e,t,n,s,o,a)),a),i=async(e,t,n)=>{const s={alpha:"alpha-a.locuslabs.com",beta:"beta-a.locuslabs.com",gamma:"gamma-a.locuslabs.com",prod:"a.locuslabs.com"},{assetStage:o,accountId:l,formatVersion:i}=e;let{venueId:c}=e;const u=`https://${s[o]||s.prod}/accounts/${l}`,d=i||"v5",g=e.dataFetch&&a[e.dataFetch]&&a[e.dataFetch].getFiles?await a[e.dataFetch].getFiles(e):await t(`${u}/${d}.json`);if(n.length>0){const t=n.map((e=>e.slice(0,2)));for(let a=0;a<t.length;a+=1)if(g[`${c}${t[a]}`]){c=`${c}${t[a]}`,e.venueId=`${c}`;break}}if(!g[c])throw Error(`Attempt to access venue ${c} which is not within venue list: ${Object.keys(g)}`);const h=g[c].files,m=(e.dataFetch&&a[e.dataFetch]&&a[e.dataFetch].getVenueData?await a[e.dataFetch].getVenueData(e):await t(h.venueData))[c];m.tileServerAuthInfo&&function(e){const t={defaultOrdinal:0,defaultStructureId:"singleBuilding",formatVersion:"v5",structures:{singleBuilding:{name:"singleBuilding",boundsPolygon:[],defaultLevelId:"singleLevel",id:"singleBuilding",levels:{singleLevel:{boundsPolygon:[],clfloor:0,details:"",id:"singleLevel",name:"singleLevel",ordinal:0}}}},structureOrder:["singleBuilding"]};for(const a in t)e[a]=t[a]}(m),m.venueList=g;const p=(e=>{const t=e.deepLinkProps?e.deepLinkProps.contentStage:null;return"alpha"===t||"beta"===t||"prod"===t?t:null})(e);return m.files=p?r(m.category,h,p,l,c):h,m},c=e=>{const{structureOrder:a,structures:n}=e;return a.map((e=>{const a=n[e],s=t(a.boundsPolygon);return{...a,bounds:s}}))};const u=([e,t,...a])=>[t,e,...a],d=(e,t)=>{return!e||!Array.isArray(e)||e.length<1?e:(a=e[0][0],n=t.ne.lng,s=t.sw.lng,(a>n?a<=s:e=>s)?e:e.map(u));var a,n,s};export{c as buildStructures,s as createFetchJson,o as createFetchText,i as getVenueDataFromUrls,d as normalizeCoords};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{pick as t,isNil as o,map as n,omit as e,path as r}from"ramda";import{encode as i,calculateAdjacent as s}from"../../../src/extModules/geohasher.js";import{distance as l}from"../../../src/utils/geodesy.js";import u from"./minPriorityQueue.js";const d=9999;function f(r,s,l,u){const d={},f={};let a={};r.nodes.forEach((o=>{const n=s(o.floorId),e=l(o.floorId);!function(t){const o=t.floorId+":"+i(t.lat,t.lng).substr(0,7),n=t.floorId+":"+i(t.lat,t.lng).substr(0,8);f[o]||(f[o]=[]);f[o].push(t),f[n]||(f[n]=[]);f[n].push(t),d[t.id]=t}({...t(["id","lat","lng","floorId"],o),edges:[],ordinal:n,structureId:e})})),r.edges.forEach((t=>d[t.s].edges.push(function(t,n){const e=function(t){return t.x?"Security Checkpoint":""===t.t?"Ground":t.t}(t),r="escalator"!==e.toLowerCase()&&"stairs"!==e.toLowerCase(),i=c(t.s,t.d,n),s=t.l||i/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:i,dst:t.d,o:t.o,isAccessible:r,isDriveway:!o(t.h)&&!t.h,src:t.s,transitTime:s,type:e,path:u,weight:s}}(t,d))));const h=t=>{if(void 0===t.floorId&&void 0===t.ordinal)throw Error("Endpoint specified in findRoute without floorId nor an ordinal");const o=t.lat||t.latitude,n=t.lng||t.longitude;return t.floorId?C(t.floorId,o,n,f,d):S(t.ordinal,o,n,d)};return{_nodes:d,_geoDb:f,findClosestNode:(t,o,n)=>C(t,o,n,f,d),findShortestPath:(t,o,n)=>function(t,o,n,e={}){return b(h(t),h(o),n,a,u,e)}(t,o,d,n),findAllShortestPaths:function(t,o,n){const e=h(t),r=o.map((t=>h(t)));return e&&r.length?function(t,o,n,e={},r={},i={}){return o.map((o=>{try{return b(t,o,n,e,r,i)}catch(t){return null}}))}(e,r,d,a,u,n):[]},floorIdToOrdinal:s,floorIdToStructureId:l,updateWithSecurityWaitTime:function(t){a=n(e(["lastUpdated"]),t),I()},clearCache:I}}function c(t,o,n){const e=n[t],r=n[o];return l(e.lat,e.lng,r.lat,r.lng)}let a,h,p,g,m,y;const I=()=>{a={},h={},p={},g=new u,m=null,y={}};function b(t,o,n,e={},i={},s={}){for(t.id===m&&y===JSON.stringify(s)||(I(),g.offerWithPriority(t.id,0),a[t.id]=0,p[t.id]=!0,m=t.id,y=JSON.stringify(s));!g.isEmpty()&&!p[o.id];){const t=n[g.poll()],o=a[t.id];for(let n=0;n<t.edges.length;n++){const l=t.edges[n];if(p[l.dst])continue;if(s.requiresAccessibility&&!l.isAccessible)continue;let u=l.weight;if(l.o&&e[l.o]){const t=e[l.o];t.queueTime&&(u=t.queueTime),t.isTemporarilyClosed&&(u=d),l.securityWaitTimes=t}if(l.o&&i[l.o]){l.securityLane=i[l.o];const{type:t,id:o}=i[l.o],n=r(["selectedSecurityLanes",t],s);if(n&&!n.includes(o))continue}void 0===a[l.dst]?(h[l.dst]=t,a[l.dst]=o+u,g.offerWithPriority(l.dst,o+u)):a[l.dst]>o+u&&(a[l.dst]=o+u,h[l.dst]=t,g.raisePriority(l.dst,o+u))}p[t.id]=!0}if(!p[o.id])return null;const l=[];let u=o;for(;u;)l.push(u),u=h[u.id];return l.reverse()}function w(t,o,n,e){const r=o.substr(0,e),i=[];i.push(t+":"+s(s(r,"top"),"left")),i.push(t+":"+s(r,"top")),i.push(t+":"+s(s(r,"top"),"right")),i.push(t+":"+s(r,"left")),i.push(t+":"+r),i.push(t+":"+s(r,"right")),i.push(t+":"+s(s(r,"bottom"),"left")),i.push(t+":"+s(r,"bottom")),i.push(t+":"+s(s(r,"bottom"),"right"));const l=[];for(let t=0;t<i.length;t++){const o=n[i[t]];if(o)for(let t=0;t<o.length;t++)l.push(o[t])}return l}function C(t,o,n,e,r){const s=function(t,o,n,e){let r=w(t,o,n,8);return r.length>0?r:(r=w(t,o,n,7),r.length>0?r:null)}(t,i(o,n),e)||function(t,o,n,e){const r=Object.values(e).filter((o=>o.floorId===t)).map((t=>[t,l(t.lat,t.lng,o,n)]));if(!r.length)throw Error(`findClosestNodeByFloor2 found no nodes on floor ${t}`);return T(r)}(t,o,n,r),u=[];for(let t=0;t<s.length;t++){const e=l(o,n,s[t].lat,s[t].lng);u.push([s[t],e])}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]}function S(t,o,n,e){const r=Object.values(e).filter((o=>o.ordinal===t)).map((t=>[t,l(t.lat,t.lng,o,n)]));if(!r.length)throw Error(`findClosestNodeByOrdinal found no nodes on ordinal ${t}`);return T(r)}function T(t){let o=t[0];for(let n=1;n<t.length;n++)t[n][1]<o[1]&&(o=t[n]);return o[0]}export{f as createNavGraph,S as findClosestNodeByOrdinal,b as findShortestPath};
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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,y)=>{let c=r(t);c=n(c),s&&c[0].coordinates.unshift([s.lng,s.lat]),i&&e.last(c).coordinates.push([i.lng,i.lat]);return{segments:c.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=c[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(c,e.prop("title",s),e.prop("title",i),p,l,g)}};export{s as buildSegments};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{compose as e,not as t,includes as r,__ as a,toLower as n,prop as s,last as c,find as u,propEq as i,drop 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,u={},i){return e.map(((i,T)=>{const R=N("securityWaitTimes")(i.waypoints),L=R&&!R.isTemporarilyClosed?R.queueTime:Math.round(1===(y=i.waypoints).length?y[0].eta:y.map(s("eta")).slice(1).reduce(((e,t)=>e+t),0));var y;const I=Math.round(function(e){return 1===e.length?e[0].distance:e.map((e=>e.distance)).slice(1).reduce(((e,t)=>e+t),0)}(i.waypoints)),m=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}}(i.segmentCategory),p=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}(i.segmentCategory,i.waypoints),P=function(e,t,r,a,n,s){const u=e[t];switch(u.segmentCategory){case _.START:return O(u.waypoints[0].position,r);case _.WALKING_TO_END:return O(u.waypoints[u.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[c(e.waypoints).position.floorId]}(u,n);default:return s(`wayfinder:${u.type}`)}}(e,T,t,r,a,n),W=function(e,t,r,a,n){const s=S(t,a),c="Proceed";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 s(`${c} <1 minute to`,`${c} xx minute to`);case _.WALK_DOWN:return s(`${c} <1 minute down to`,`${c} xx minute down to`);case _.WALK_UP:return s(`${c} <1 minute up to`,`${c} xx minute up to`);case _.TRAIN:return s("Take train <1 minute","Take train xx minute");case _.BUS:return s("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""}}(i,L,d(u,i.waypoints),n),w={primaryText:P,secondaryText:W,icon:m,animationAnchor:p,eta:L,distance:I,bounds:o(i.waypoints),isAccessible:E(i),securityWaitTimes:R};return i.poiId&&(w.poiId=i.poiId),w}))}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=u(i("id",r.id),a);return s("displayText",n)},N=t=>e(s(t),u(s(t)),T(1));export{R as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from"ramda";import n from"zousan";import{buildStructuresLookup as o}from"../../../src/utils/buildStructureLookup.js";import{distance as e}from"../../../src/utils/geodesy.js";import{findRoute as i}from"./findRoute.js";import{createNavGraph as r}from"./navGraph.js";import{enrichDebugNavGraph as a}from"./navGraphDebug.js";import{buildSegments as s}from"./segmentBuilder.js";const u={SECURITY:"SecurityLane",IMMIGRATION:"ImmigrationLane"};function d(d,l){const p=d.log.sublog("wayfinder"),c=async()=>{d.bus.send("venueData/loadNavGraph")};let f=new n;d.bus.on("wayfinder/_getNavGraph",(()=>f)),d.bus.on("venueData/navGraphLoaded",(async({navGraphData:t,structures:n})=>{const e=o(n),i=await y(),a=r(t,e.floorIdToOrdinal,e.floorIdToStructureId,i);f.resolve(a)}));const y=async()=>{const n=await d.bus.get("poi/getByCategoryId",{categoryId:"security"});return t.pipe(t.map(m),t.filter(t.identity))(n)},m=n=>n.queue&&{type:t.path(["queue","queueType"],n),id:t.path(["queue","queueSubtype"],n)};d.bus.on("wayfinder/showNavLineFromPhysicalLocation",(async({toEndpoint:t,selectedSecurityLanes:n=null,requiresAccessibility:o})=>async function(t,n,o){const e=await T({fromEndpoint:t,toEndpoint:n,options:o});if(e){const{segments:t}=e;o.primary&&d.bus.send("map/resetNavlineFeatures"),d.bus.send("map/showNavlineFeatures",{segments:t,category:o.primary?"primary":"alternative"})}return e}(await d.bus.get("user/getPhysicalLocation"),t,{selectedSecurityLanes:n,requiresAccessibility:o,primary:!0})));const h=(t,n)=>d.bus.get("poi/getById",{id:t}).then((o=>{if(o&&o.position)return w(o,n);throw Error("Unknown POI ID "+t)}));const I=["lat","lng","floorId","ordinal"],g=t.pipe(t.pick(I),t.keys,t.propEq("length",I.length),Boolean),w=(t,n)=>({lat:t.position.latitude,lng:t.position.longitude,floorId:t.position.floorId,ordinal:n(t.position.floorId),title:t.name});async function T({fromEndpoint:t,toEndpoint:n,options:o={}}){return f.then((async e=>{o.compareFindPaths=l.compareFindPaths;const r=i(e,t,n,o);if(!r)return null;t.floorId&&n.floorId&&b(t,n,r);const a=await d.bus.get("venueData/getFloorIdToNameMap"),u=await d.bus.get("venueData/getQueueTypes"),c=d.gt();o.requiresAccessibility;const{steps:f,segments:y}=s(r.waypoints,t,n,a,c,u);p.info("route",r);const m=Math.round(r.waypoints.reduce(((t,{eta:n})=>t+n),0)),h=Math.round(r.waypoints.reduce(((t,{distance:n})=>t+n),0));return{...r,segments:y,steps:f,time:m,distance:h}}))}d.bus.on("wayfinder/getNavigationEndpoint",(({ep:t})=>async function(t){return f.then((n=>{if(!t)throw Error("wayfinder: Invalid endpoint definition",t);if("number"==typeof t)return h(t,n.floorIdToOrdinal);if("string"==typeof t){if(t.match(/^\d+$/))return h(parseInt(t),n.floorIdToOrdinal);if(t.indexOf(",")>0){let[o,e,i,r]=t.split(",");if(!n.floorIdToStructureId(i))throw Error("Unknown floorId in endpoint: "+i);return r||(r="Starting Point"),{lat:parseFloat(o),lng:parseFloat(e),ordinal:n.floorIdToOrdinal(i),floorId:i,title:r}}}if(g(t))return t;if(t.latitude)return{lat:t.latitude,lng:t.longitude,floorId:t.floorId,ordinal:n.floorIdToOrdinal(t.floorId),title:t.title};if(t.position&&t.name)return w(t,n.floorIdToOrdinal);throw Error("Invalid start or end point: "+t)}))}(t))),d.bus.on("wayfinder/checkIfPathHasSecurity",(({fromEndpoint:n,toEndpoint:o,options:e={}})=>f.then((r=>{e.compareFindPaths=l.compareFindPaths;const a=i(r,n,o,e);if(!a)return{routeExists:!1};const s=n=>Boolean(a.waypoints.find(t.pathEq(["securityLane","type"],n)));return{routeExists:!0,queues:a.waypoints.filter((n=>t.pathEq(["securityLane","type"],u.SECURITY,n)||t.pathEq(["securityLane","type"],u.IMMIGRATION,n))),hasSecurity:s(u.SECURITY),hasImmigration:s(u.IMMIGRATION)}})))),d.bus.on("wayfinder/getRoute",T);const b=(t,n,o)=>d.bus.send("session/submitEvent",{type:"navigation",startPosition:{venueId:t.floorId.split("-")[0],buildingId:o.waypoints[0].position.structureId,floorId:o.waypoints[0].position.floorId,lat:o.waypoints[0].position.lat,lng:o.waypoints[0].position.lng},endPosition:{venueId:n.floorId.split("-")[0],buildingId:o.waypoints[o.waypoints.length-1].position.structureId,floorId:o.waypoints[o.waypoints.length-1].position.floorId,lat:o.waypoints[o.waypoints.length-1].position.lat,lng:o.waypoints[o.waypoints.length-1].position.lng}});function v(n,o,e,i){let r=t.clone(n);return r=E(r,e,i),o&&o.length?{...r,transitTime:S(o,"transitTime"),distance:S(o,"distance")}:(r.distance="start"===i?P(r,e):P(e,r),r.transitTime=L(r.distance),r)}function S(n,o){return t.aperture(2,n).map((([n,o])=>{return(e=o.id,n=>t.find((t=>t.dst===e),n.edges))(n);var e})).map(t.prop(o)).reduce(((t,n)=>t+n),0)}function E(t,n,o){return{...t,[o+"Information"]:{lat:n?.lat||n?.position?.latitude,lng:n?.lng||n?.position?.longitude,floorId:n?.floorId||n?.position?.floorId}}}function P(t,n){return e(n?.lat||n?.position?.latitude,n?.lng||n?.position?.longitude,t?.lat||t?.position?.latitude,t?.lng||t?.position?.longitude)}function L(t){return t/60}function O(n){const o=n.filter((t=>null!==t));return t.sortBy(t.propOr(1/0,"transitTime"),o)}function q(n,o,e,i,r){const a=M(o,i,n),s=M(e,n,r);if(!a||!s)return null;const u=N(o,a),d=N(e,s);let l=t.clone(n);return l=E(l,i,"start"),l=E(l,r,"end"),{...l,transitTime:u+d,distance:a+s,startInformation:{...l.startInformation,transitTime:u,distance:a},endInformation:{...l.endInformation,transitTime:d,distance:s}}}function N(t,n){return t&&t.length?S(t,"transitTime"):L(n)}function M(t,n,o){return t&&t.length?S(t,"distance"):P(o,n)}return d.bus.on("wayfinder/addPathTimeSingle",(async({poi:t,startLocation:n,options:o={}})=>n?f.then((e=>function(t,n,o,e){const i=w(o,t.floorIdToOrdinal),r=t.findShortestPath(e,i,n);return v(o,r,e,"start")}(e,o,t,n))):t)),d.bus.on("wayfinder/addPathTimeMultiple",(async({pois:n,startLocation:o,options:e={}})=>o?f.then((i=>function(n,o,e,i){try{const r=t.clone(e),a=r.map((t=>w(t,n.floorIdToOrdinal))),s=n.findAllShortestPaths(i,a,o);return O(r.map(((t,n)=>v(t,s[n],i,"start"))))}catch(t){return p.error(t),e}}(i,e,n,o))):n)),d.bus.on("wayfinder/multipointAddPathTimeMultiple",(async({pois:n,startLocation:o,endLocation:e,options:i={}})=>o||e?f.then((r=>function(n,o,e,i,r){try{const a=t.clone(e),s=a.map((t=>w(t,n.floorIdToOrdinal)));let u,d,l;return i&&(u=n.findAllShortestPaths(i,s,o)),r&&(d=function(t,n,o,e){const i=[];for(const r of n)i.push(t.findShortestPath(r,o,e));return i}(n,s,r,o)),l=i&&r?a.map(((t,n)=>q(t,u[n],d[n],i,r))):i?a.map(((t,n)=>v(t,u[n],i,"start"))):a.map(((t,n)=>v(t,d[n],r,"end"))),O(l)}catch(t){return p.error(t),e}}(r,i,n,o,e))):n)),d.bus.on("wayfinder/multipointAddPathTimeSingle",(async({poi:t,startLocation:n,endLocation:o,options:e={}})=>n||o?f.then((i=>function(t,n,o,e,i){const r=w(o,t.floorIdToOrdinal);let a,s;e&&(a=t.findShortestPath(e,r,n));i&&(s=t.findShortestPath(r,i,n));return e&&i?q(o,a,s,e,i):e?v(o,a,e,"start"):i?v(o,s,i,"end"):o}(i,e,t,n,o))):t)),d.bus.on("venueData/loadNewVenue",(()=>{f=new n,c()})),d.bus.on("poi/setDynamicData",(({plugin:t,idValuesMap:n})=>{"security"===t&&f.then((t=>t.updateWithSecurityWaitTime(n)))})),d.bus.on("wayfinder/getNavGraphFeatures",(()=>f.then((({_nodes:t})=>a(t))))),{init:c,internal:{resolveNavGraph:t=>f.resolve(t),prepareSecurityLanes:y}}}export{u as SecurityLaneType,d as create};
|
package/dist/src/app.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ApplicationInsights as e}from"@microsoft/applicationinsights-web";import n from"IObject";import t from"query-string";import{map as o,mergeDeepRight as i}from"ramda";import r from"zousan-plus";import a from"../package.json.js";import s from"./debugTools.js";import{buildEnv as l}from"./env.js";import{create as c}from"./extModules/bustle.js";import{initLog as u}from"./extModules/log.js";import g from"./utils/i18n.js";const p="undefined"!=typeof window;async function d(e,n,t){let o=n;if(o.includes("/")){const e=o.split("/");o=e[e.length-1]}return void 0!==t.active&&(!1===t.active||"notLocalhost"===t.active&&e.env.isLocalhost())?(e.log.info(`Plugin ${n} explicitly deativated`),null):import(`../plugins/${n}/src/${o}.js`).then((o=>(e.log.info(`Creating plugin ${n}`),o.create(e,t))))}async function m(e){return p?import(`./configs/${e}.json`):import(`./configs/${e}.json.js`)}async function f(e,n){let t={};const o=await Promise.all(n.map(m));for(const e of o){let n=e.default;n=n.extends?await f(n,n.extends):n,t=i(t,n)}return t=i(t,e),t}const w=e=>n=>import(`./configs/postproc-${e}.js`).then((e=>e.process(n)));async function h(i){const m=Object.create(null);let h=i.extends?await f(i,i.extends):i;h.plugins.monitoring&&import("../_virtual/_empty_module_placeholder.js").then((e=>e.activate(h))),h=await(async e=>e.configPostProc?r.series(e,...e.configPostProc.map(w)):e)(h);const y=(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"})(h),b=await g(y,{debug:h.debug});m.i18n=()=>b,m.gt=()=>b.t.bind(b),m.config=h,m.plugins=new n;const j=u("web-engine",{enabled:!!h.debug,isBrowser:p,color:"cyan",logFilter:h.logFilter,truncateObjects:!p});if(m.log=j.sublog(h.name),m.bus=c({trace:!1,showEvents:!0,reportAllErrors:!0,log:j}),m.info={wePkg:a},process.env.APP_INSIGHTS){const n=new e({config:{connectionString:process.env.APP_INSIGHTS,disableAjaxTracking:!0,disableFetchTracking:!0}});n.loadAppInsights(),m.bus.on("appInsights/log",(e=>{e.properties.location=window.location.origin,n.trackEvent({...e}),n.flush()}))}if("undefined"!=typeof window&&(h.debug?(m.debug=o((e=>e.bind(m)),s),s.dndGo.call(m)):m.debug={},window._app=m,window.document&&window.document.title&&h.setWindowTitle&&(document.title=h.name)),m.env=l(m),h.theme?await r.evaluate({name:"ThemeManagerModule",value:import("../_virtual/_empty_module_placeholder.js")},{name:"HistoryManager",value:import("./historyManager.js")},{name:"LayerManager",value:import("../_virtual/_empty_module_placeholder.js")}).then((async({LayerManager:e,HistoryManager:n,ThemeManagerModule:t})=>{const o=t.initThemeManager(m);m.themePack=await o.buildTheme(h.theme,h.defaultTheme),e.initLayerManager(m),n.initHistoryManager(m),m.destroy=()=>e.destroy(m)})):m.destroy=()=>{},h.plugins){for(const e in h.plugins)try{const n=h.plugins[e];if(m.plugins[e])throw Error(`Duplicate plugin name "${e}"`);const t=await d(m,e,n);t&&(m.plugins=m.plugins.set(e,t))}catch(n){j.error("Error instantiating plugin "+e),j.error(n)}for(const e in m.plugins)m.plugins[e].init()}return m}export{h as create};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"query-string";const e={navFrom:"online/getDirectionsFromTo",navTo:"online/getDirectionsFromTo",waypoints:"online/getDirectionsFromTo",accessible:"online/getDirectionsFromTo",showNav:"online/getDirectionsFromTo",poiId:["online/getDirectionsFromTo","online/poiView"],vid:"venueDataLoader",stage:"venueDataLoader",contentStage:"venueDataLoader",accountId:"venueDataLoader",search:"online/headerOnline",ho:["online/getDirectionsFromTo","analytics2"],home:"online/homeView",zoom:"mapRenderer",pitch:"mapRenderer",bearing:"mapRenderer",lat:"mapRenderer",lng:"mapRenderer",radius:"mapRenderer",buildingId:"mapRenderer",floorId:"mapRenderer",refInstallId:"analytics2",multipointRouting:["online/getDirectionsFromTo","online/poiView"]};function n(n,o,i){if(void 0!==o.lldebug)try{n.debug=JSON.parse(o.lldebug),null===n.debug&&(n.debug={})}catch(e){n.debug=!0}return Object.keys(e).forEach((r=>{if(void 0!==o[r]){let t=e[r];Array.isArray(t)||(t=[t]),t.forEach((e=>{let t=n.plugins[e];!t&&i&&(t=n.plugins[e]={}),t.deepLinkProps={...t.deepLinkProps,[r]:o[r]}}))}})),o.poiId&&o.showNav&&delete n.plugins["online/poiView"].deepLinkProps.poiId,n}export{n as setDeepLinksForParms};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var a="SDK headless",e={analytics2:{productName:"LocusMaps JS SDK",active:!1,disableSending:!1},clientAPI:{},dynamicPois:{},poiDataManager:{},sdkServer:{},searchService:{},venueDataLoader:{assetStage:"prod",formatVersion:"v5",availableLanguages:[{langCode:"en",assetSuffix:""}]},wayfinder:{compareFindPaths:!1}},s={name:
|
|
1
|
+
var a="SDK headless",e={analytics2:{productName:"LocusMaps JS SDK",active:!1,disableSending:!1},clientAPI:{},dynamicPois:{},poiDataManager:{},sdkServer:{},searchService:{},venueDataLoader:{assetStage:"prod",formatVersion:"v5",availableLanguages:[{langCode:"en",assetSuffix:""}]},wayfinder:{compareFindPaths:!1}},s={name:a,plugins:e};export{s as default,a as name,e as plugins};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"zousan";const n=(o,n)=>o.splice(n,1)[0],t=(o,t)=>{let r=0;do{r=o.indexOf(t,r),r>=0&&n(o,r)}while(r>=0);return o};function r(n={}){const r=n.log?n.log.sublog?n.log.sublog("bustle",{color:"pink"}):n.log:console,e={},s={};function c(o,n){e[o]&&t(e[o],n)}function u(o,n){s[o]&&t(s[o],n)}function l(t,c){return n.trace&&(c||(c={}),c._stack=Error().stack),n.showEvents&&("function"==typeof n.showEvents?n.showEvents(t,c)&&r.info("send with",t," and ",c):r.info("send with",t," and ",c)),new o((u=>o.soon(((t,c,u)=>()=>{const l=e[t],f=s[t],i=[];if(l)for(const t of l)try{i.push(t(c))}catch(t){n.reportAllErrors&&r.error(t),n.rejectOnError?i.push(o.reject(t)):i.push(t)}const h=o.all(i);if(f)for(const o of f)try{o(c,h)}catch(o){n.reportAllErrors&&r.error(o)}u(h)})(t,c,u))))}return{get:(n,t)=>l(n,t).then((t=>1!==t.length?o.reject(`${n} event did not return a single result, but ${t.length} results.`):t[0])),moff:u,monitor:function(o,n){return s[o]||(s[o]=[]),s[o].push(n),()=>u(o,n)},off:c,on:function(o,n){return e[o]||(e[o]=[]),e[o].push(n),()=>c(o,n)},send:l}}export{r as create};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={black:"[30m",red:"[31m",green:"[32m",yellow:"[33m",blue:"[34m",magenta:"[35m",cyan:"[36m",white:"[37m"};function o(n,r){const t=function(o,n={}){let r=o+": ",t=null;if(n.color)if(n.isBrowser)r="%c"+r,t=`color: ${n.color}`;else{const o=e[n.color];o&&(r=o+r)}function l(e){return function(){if(void 0===n.enabled||n.enabled||e===console.error){let o=Array.from(arguments);t&&o.unshift(t),o.unshift(r),n.truncateObjects&&e!==console.error&&(o=o.map((e=>{return"object"==typeof e?(o=JSON.stringify(e),r=parseInt(n.truncateObjects)||100,o&&o.length>r?o.substring(0,r)+"...":o):e;var o,r})));const l=!n.logFilter||((e,o)=>"string"==typeof o?e[0].includes(o):o.test(e[0]))(o,n.logFilter);(l||e===console.error)&&e.apply(console,o)}}}const c=l(console.log);return c.info=c,c.warn=l(console.warn),c.detailed=l(console.debug),c.error=l(console.error),c.setEnabled=e=>{n.enabled=e},c}(n,r);return t.sublog=(e,t)=>o(n+"."+e,Object.assign(Object.create(r),t)),t}export{o as initLog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"ramda";import"zousan";let n=null;const t=t=>function(){return n=n?n.then((()=>t.apply(null,arguments))):t.apply(null,arguments),n};function l(n,t){const l={};return Object.keys(t).forEach((o=>{n(o,t[o])&&(l[o]=t[o])})),l}export{l as filterOb,t as singleFile};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{point as n,lineString as t}from"@turf/helpers";import e from"@turf/point-to-line-distance";import*as r from"ramda";const l=(n,t)=>{const e=n[0],r=n[1];let l=!1;for(let n=0,o=t.length-1;n<t.length;o=n++){const u=t[n][0],s=t[n][1],i=t[o][0],f=t[o][1];s>r!=f>r&&e<(i-u)*(r-s)/(f-s)+u&&(l=!l)}return l},o=n=>{const{n:t,s:e,e:r,w:l}=n.bounds;return[[t,r],[t,l],[e,l],[e,r],[t,r]]};function u(n,t,e,u){if(!r.length(n))return null;const s=(n=n.filter((n=>null==n.shouldDisplay||!0===n.shouldDisplay))).filter((n=>l([t,e],o(n))));if(0===s.length)return null;if(1===s.length&&!u)return r.head(s);const i=s.filter((n=>l([t,e],n.boundsPolygon)));if(1===i.length)return r.head(i);if(i.length)return h(s);if(u)return null;const c=s.map((n=>f(t,e,n))),d=Math.min.apply(null,c);return s[c.indexOf(d)]}const s=n=>t(n.boundsPolygon.map((n=>d(n)))),i={},f=(n,t,e)=>{for(let r=0;r<99;r++)c(n,t,e);return c(n,t,e)},c=(t,r,l)=>{const o=n([r,t]),u=(n=>{let t=i[n.id];return t||(t=s(n),i[n.id]=t),t})(l);return e(o,u)},d=n=>[n[1],n[0]],a=n=>{if(!n.bounds)return 0;const{n:t,s:e,e:r,w:l}=n.bounds;return Math.abs((t-e)*(r-l))},h=n=>{return n.reduce((t=a,(n,e)=>t(n)<t(e)?n:e));var t},p=(n,t)=>Object.values(n.levels).reduce(((n,e)=>e.ordinal===t?e:n),void 0),g=(n,t)=>n.reduce(((n,e)=>Object.values(e.levels).reduce(((n,e)=>e.id===t?e:n),null)||n),void 0);function m(n,t,e,r,l){const o=u(n,t,e,l);return{building:o,floor:o?p(o,r):null}}const b=(n,t,e,r,l)=>m(n,t,e,r,l).floor;function v(n,t,e,r,l,o,u,s){let i=0,f=0,c=0,d=0,a=0;const h=[{x:n,y:t}];for(let p=1,g=0;p<=20;++p)g=p/20,i=1-g,f=i*i,c=f*i,d=g*g,a=d*g,h.push({x:c*n+3*f*g*e+3*i*d*l+a*u,y:c*t+3*f*g*r+3*i*d*o+a*s});return h}export{v as bezierCurveTo,m as getBuildingAndFloorAtPoint,g as getFloor,b as getFloorAt,u as getStructureAtPoint,p as ordToFloor,l as pointInPolygon};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n from"i18next";async function e(e,{debugMode:t,fallbackLng:o}={}){const a=n.createInstance();return a.init({debug:t,interpolation:{escapeValue:!1},resources:{en:{translation:{"Proceed xx minutes to":"Proceed {{count}} minute to","Proceed xx minutes to_plural":"Proceed {{count}} minutes to"}}},fallbackLng:void 0===o?"en":o,lng:e,postProcess:["pseudoTrans"]}).then((()=>(t&&a.on("missingKey",(function(n,e,t,o){console.error("i18nNext: key not found. Language: "+a.language+", Key: "+t+", namespace: "+e+", lngs: ",n)})),a)))}const t={ar:"بال عن أمام الأخذ البرية. ثم كما وقام شاسعة الجنوبي, أمدها الإمداد عن انه. ٣٠ فكانت والكساد انه. أساسي الشمال الإتفاقية بال أم. زهاء المؤلّفة حين عل, سكان قررت هذه ان, شعار باستخدام ولم مع.\n\nدول الأمور الصفحة الأوروبية قد. تم حدى فاتّبع الهجوم, ما أوسع معاملة فعل, خلاف الأوروبية، إيو كل. تُصب واندونيسيا، حين قد. أي حاول حقول وهولندا، هذا, بين عن لهيمنة بالسيطرة.\n\nأعمال الإتحاد العمليات من وصل. وقوعها، باستخدام قد أخر, بل حتى علاقة التبرعات. فقد لم الأرض استبدال. حتى الخاسر اقتصادية بـ. أصقاع أعلنت اتفاقية تلك بل, كان إذ بحشد أخرى ليبين. الشتاء، اليابان، مكن أم, به، قد العالم، أوراقهم, بل لعدم لغزو أواخر مكن.\n",ja:"私は場合いよいよある所有らってのの末がしたた。無論結果に圧迫顔もよくその発展ないですまでを決するてみるでしでも発展云いませたから、そうには描いたないたた。機会へ載っない方は別に今をひょろひょろでずまし。むしろ嘉納さんを意味方面そう#「を積んない権力この自分何か記念をというおお尋ねだろででですで、ある今はこれか頼み例があるで、ネルソンさんののの引込のあなたにもっともお努力といと私赤に実建設が起っようにとやかくご附随を描いですましから、どうもとにかく相違に云おでてならますのが行っないませ。"},o=(n,e)=>"en"===e?n:a(n,t[e]),a=(n,e)=>n.length<e.length?e.substring(0,n.length):e;export{e as default,o as toLang};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atriusmaps-node-sdk",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.225",
|
|
4
4
|
"description": "This project provides an API to Atrius Personal Wayfinder maps within a Node environment. See the README.md for more information",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"map",
|
|
@@ -14,27 +14,34 @@
|
|
|
14
14
|
"atrius",
|
|
15
15
|
"acuitybrands"
|
|
16
16
|
],
|
|
17
|
-
"repository": "https://gitlab.com/locuslabspublic/atriusmaps-node-sdk",
|
|
18
17
|
"license": "UNLICENSED",
|
|
19
18
|
"author": "Glenn Crownover <crownover@locuslabs.com>",
|
|
20
19
|
"type": "module",
|
|
21
20
|
"exports": {
|
|
22
21
|
".": {
|
|
23
|
-
"import": "./
|
|
24
|
-
"require": "./dist/cjs/
|
|
25
|
-
"default": "./dist/cjs/
|
|
22
|
+
"import": "./dist/nodesdk/nodeEntry.js",
|
|
23
|
+
"require": "./dist/cjs/nodesdk/nodeEntry.js",
|
|
24
|
+
"default": "./dist/cjs/nodesdk/nodeEntry.js"
|
|
26
25
|
},
|
|
27
26
|
"./package.json": "./package.json"
|
|
28
27
|
},
|
|
29
|
-
"main": "./dist/cjs/
|
|
30
|
-
"module": "./lib/
|
|
28
|
+
"main": "./dist/cjs/nodesdk/nodeEntry.js",
|
|
29
|
+
"module": "./lib/nodesdk/nodeEntry.js",
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
31
33
|
"scripts": {
|
|
32
|
-
"build": "
|
|
33
|
-
"
|
|
34
|
+
"build": "rollup -c rollup.config.js && cp package-cjs.json dist/cjs/package.json",
|
|
35
|
+
"test": "yarn build && yarn test:nobuild",
|
|
36
|
+
"test:nobuild": "jest --no-cache --verbose --forceExit --testMatch='**/test/**.js'"
|
|
34
37
|
},
|
|
35
38
|
"dependencies": {
|
|
39
|
+
"@turf/circle": "^6.5.0",
|
|
40
|
+
"@turf/helpers": "^6.5.0",
|
|
41
|
+
"@turf/point-to-line-distance": "^6.5.0",
|
|
36
42
|
"IObject": "^0.6.2",
|
|
37
43
|
"flexsearch": "^0.7.31",
|
|
44
|
+
"https-proxy-agent": "^7.0.4",
|
|
38
45
|
"i18next": "^20.3.4",
|
|
39
46
|
"node-fetch": "^2.6.1",
|
|
40
47
|
"query-string": "^7.0.1",
|
|
@@ -43,6 +50,7 @@
|
|
|
43
50
|
},
|
|
44
51
|
"devDependencies": {
|
|
45
52
|
"@rollup/plugin-json": "^4.1.0",
|
|
53
|
+
"jest": "^29.7.0",
|
|
46
54
|
"rollup": "^2.59.0"
|
|
47
55
|
}
|
|
48
56
|
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import json from '@rollup/plugin-json'
|
|
2
|
-
// import { terser } from 'rollup-plugin-terser'
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
input: [
|
|
6
|
-
'./lib/src/configs/sdkHeadless.json',
|
|
7
|
-
'./lib/src/utils/observable.js',
|
|
8
|
-
'./lib/plugins/clientAPI/src/clientAPI.js',
|
|
9
|
-
'./lib/plugins/dynamicPois/src/dynamicPois.js',
|
|
10
|
-
'./lib/plugins/poiDataManager/src/poiDataManager.js',
|
|
11
|
-
'./lib/plugins/sdkServer/src/sdkServer.js',
|
|
12
|
-
'./lib/plugins/searchService/src/searchService.js',
|
|
13
|
-
'./lib/plugins/venueDataLoader/src/venueDataLoader.js',
|
|
14
|
-
'./lib/plugins/wayfinder/src/wayfinder.js',
|
|
15
|
-
'./lib/deploy/nodeEntry.js'
|
|
16
|
-
],
|
|
17
|
-
output: {
|
|
18
|
-
format: 'cjs',
|
|
19
|
-
plugins: [
|
|
20
|
-
// terser()
|
|
21
|
-
],
|
|
22
|
-
inlineDynamicImports: false,
|
|
23
|
-
preserveModules: true,
|
|
24
|
-
preserveModulesRoot: "lib",
|
|
25
|
-
// file: 'dist/cjs/atriusmaps.js'
|
|
26
|
-
dir: 'dist/cjs/'
|
|
27
|
-
},
|
|
28
|
-
plugins: [
|
|
29
|
-
json()
|
|
30
|
-
]
|
|
31
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var e = require('node-fetch');
|
|
4
|
-
var package_json = require('../package.json.js');
|
|
5
|
-
var controller = require('../src/controller.js');
|
|
6
|
-
var observable = require('../src/utils/observable.js');
|
|
7
|
-
var prepareSDKConfig = require('./prepareSDKConfig.js');
|
|
8
|
-
|
|
9
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
-
|
|
11
|
-
var e__default = /*#__PURE__*/_interopDefaultLegacy(e);
|
|
12
|
-
|
|
13
|
-
const r=package_json["default"].version;globalThis.fetch||(globalThis.fetch=e__default["default"]);let c=!1;const i=e=>e.toString().length<2?"0"+e:e,a=()=>`AtriusMaps Node SDK (${(()=>{const e=new Date;return `${e.getHours()}:${i(e.getMinutes())}:${i(e.getSeconds())}.${e.getMilliseconds()}`})()}): `,g=function(){if(c){let e=a()+Array.from(arguments).map((e=>"object"==typeof e?JSON.stringify(e):e)).join(" ");const n=e.split("\n");n.length>1?e=n[0]+`… (+ ${n.length-1} lines)`:e.length>256&&(e=e.substring(0,255)+`… (length: ${e.length} chars)`),console.log(e);}};const l={getVersion:()=>r,newMap:e=>async function(e){return new Promise(((n,r)=>{e.headless=!0;const c=prepareSDKConfig(e);controller.create(c).then((e=>{const t=(n,t)=>("string"==typeof n&&(n={...t,command:n}),g("Sending command object: ",n),e.bus.get("clientAPI/execute",n).then((e=>(g("Received Message: ",e),e))).catch((e=>{throw g("Error: ",e.message),e})));observable(t),e.eventListener.observe((function(){t.fire.apply(t,arguments);})),t.on("ready",((e,o)=>{const{commands:s}=o.commandJSON;!function(e,n){n.forEach((n=>{e[n.command]=function(){const t={command:n.command};for(let e=0;e<arguments.length;e++)t[n.args[e].name]=arguments[e];return e(t)};}));}(t,s),n(t),g("map ready");}));}));}))}(e),setLogging:e=>{c=e,e&&g(`Atrius Maps JS SDK Client v${r} Logging enabled.`);}};
|
|
14
|
-
|
|
15
|
-
module.exports = l;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function _interopNamespace(e) {
|
|
4
|
-
if (e && e.__esModule) return e;
|
|
5
|
-
var n = Object.create(null);
|
|
6
|
-
if (e) {
|
|
7
|
-
Object.keys(e).forEach(function (k) {
|
|
8
|
-
if (k !== 'default') {
|
|
9
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
10
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () { return e[k]; }
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
n["default"] = e;
|
|
18
|
-
return Object.freeze(n);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async function t(t,e){const o=await(async()=>{if(!t||!t.type)throw Error("No authentication type found in config");return Promise.resolve((t=>{switch(t.type){case"ms":return "MSAuth";case"cognito":return "CognitoAuth";case"google":return "GoogleAuth";default:throw Error(`Unknown auth type: '${t.type}'`)}})(t)).then((t=>(function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(`./${t}`))).then((o=>o.default(t.config,e)))})();return {getToken:async()=>o.getToken(),isLoggedIn:async()=>o.isLoggedIn(),federatedLogin:async()=>o.federatedLogin(),logout:()=>o.logout(),getAccountInfo:()=>o.getAccountInfo(),getType:()=>t.type}}
|
|
22
|
-
|
|
23
|
-
module.exports = t;
|
package/lib/deploy/nodeEntry.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"node-fetch";import n from"../package.json.js";import{create as t}from"../src/controller.js";import o from"../src/utils/observable.js";import s from"./prepareSDKConfig.js";const r=n.version;globalThis.fetch||(globalThis.fetch=e);let c=!1;const i=e=>e.toString().length<2?"0"+e:e,a=()=>`AtriusMaps Node SDK (${(()=>{const e=new Date;return`${e.getHours()}:${i(e.getMinutes())}:${i(e.getSeconds())}.${e.getMilliseconds()}`})()}): `,g=function(){if(c){let e=a()+Array.from(arguments).map((e=>"object"==typeof e?JSON.stringify(e):e)).join(" ");const n=e.split("\n");n.length>1?e=n[0]+`… (+ ${n.length-1} lines)`:e.length>256&&(e=e.substring(0,255)+`… (length: ${e.length} chars)`),console.log(e)}};const l={getVersion:()=>r,newMap:e=>async function(e){return new Promise(((n,r)=>{e.headless=!0;const c=s(e);t(c).then((e=>{const t=(n,t)=>("string"==typeof n&&(n={...t,command:n}),g("Sending command object: ",n),e.bus.get("clientAPI/execute",n).then((e=>(g("Received Message: ",e),e))).catch((e=>{throw g("Error: ",e.message),e})));o(t),e.eventListener.observe((function(){t.fire.apply(t,arguments)})),t.on("ready",((e,o)=>{const{commands:s}=o.commandJSON;!function(e,n){n.forEach((n=>{e[n.command]=function(){const t={command:n.command};for(let e=0;e<arguments.length;e++)t[n.args[e].name]=arguments[e];return e(t)}}))}(t,s),n(t),g("map ready")}))}))}))}(e),setLogging:e=>{c=e,e&&g(`Atrius Maps JS SDK Client v${r} Logging enabled.`)}};export{l as default};
|
package/lib/package.json.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e="web-engine",s="3.3.31",o="UNLICENSED",l="module",a="src/main.js",t=["demo","deploy","pagesSrc","src/extModules/flexapi"],r={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"},n=["defaults"],i={"@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","@mapbox/mapbox-gl-draw":"^1.3.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@turf/circle":"^6.5.0",IObject:"^0.6.2","crypto-browserify":"^3.12.0","file-loader":"^6.2.0",flexsearch:"^0.7.31","h3-js":"^4.1.0",i18next:"^20.3.4","i18next-browser-languagedetector":"^6.1.1",jsonschema:"^1.2.6",luxon:"^2.0.1","maplibre-gl":"~2.1.9","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"},c={"@babel/core":"^7.14.8","@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","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:"9.5.2","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"},d="yarn@3.2.2",p={name:"web-engine",version:"3.3.31",private:!0,license:"UNLICENSED",type:"module",main:"src/main.js",workspaces:t,scripts:r,"lint-staged":{"*.js":["eslint --fix"]},browserslist:n,dependencies:i,devDependencies:c,packageManager:"yarn@3.2.2"};export{n as browserslist,p as default,i as dependencies,c as devDependencies,o as license,a as main,e as name,d as packageManager,r as scripts,l as type,s as version,t as workspaces};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"ramda";import t from"zousan";function a(a,s){let n=new t;const i=new t;function o(...e){r(...e),p(...e)}function r(t,s){const n=e.pipe(e.filter((e=>"parking"===e.category)),e.map((a=>{const s=a.dynamicAttributes;if(!s)throw Error(`No dynamicAttributes defined for parking POI ${a.poiId}`);return{...(t-a.timestamp)/1e3<s["parking.timeToLive"]?e.pick(["lotStatus","rateDay","rateHour","timeIsReal","timeToTerminal1","timeToTerminal2"],a):{lotStatus:s["parking.default"],rateDay:"$ -",rateHour:"$ -",timeIsReal:!1},lastUpdated:a.timestamp,lotName:a.lotName}})))(s);a.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:n})}function u(t,s){const n=e.pipe(e.map((e=>[e.poiId,l(t,e)])),e.fromPairs)(s);a.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:n})}const l=(e,t)=>({queueTime:t.queueTime,isTemporarilyClosed:t.isTemporarilyClosed,timeIsReal:!t.isQueueTimeDefault&&t.expiration>e,lastUpdated:e});function p(t,s){const n=["dynamicData","openClosed"],i=e.filter(e.hasPath(n),s),o=e.map(e.path(n),i);if(!e.all(e.both(e.has("isOpen"),e.has("expiration")),e.values(o)))throw Error("Open Closed poi status is malformed.");{const s=e.pipe(e.prop("expiration"),e.lt(t)),n=e.filter(s,o);a.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:n})}}return a.bus.on("venueData/venueDataLoaded",(({venueData:e})=>{n.v?n=t.resolve(e):n.resolve(e)})),a.bus.on("sdk/readyWhenYouAre",(()=>i)),{init:async()=>{const e=s.urlBase||"https://rest.locuslabs.com/v3",t=s.urlBaseV1||s.urlBase||"https://rest.locuslabs.com/v1",r=a.config.plugins.venueDataLoader.accountId;async function l(){return n.then((e=>{let a=`${t}/venue/${e.id}/account/${r}/get-all-dynamic-pois/`;return(t.startsWith("./")||t.endsWith(".json"))&&(a=t),a}))}const p=async()=>n.then((t=>e.startsWith("./")||e.endsWith(".json")?e:`${e}/venueId/${t.id}/accountId/${r}/get-dynamic-queue-times/`)),c=async()=>{Promise.all([l().then(fetch).then((e=>e.json())).then((e=>o(Date.now(),e))),p().then(fetch).then((e=>e.json())).then((e=>u(Date.now(),e)))]).then((()=>i.resolve(!0))).catch((e=>{console.error(e),i.resolve(!0)}))},m=await a.bus.get("venueData/getQueueTypes");m.SecurityLane&&m.SecurityLane.length?n.then(c).then((()=>setInterval(c,3e4))):i.resolve(!0)},internal:{processSecurityWaitTimes:u,processParkingPOIS:r,processOpenClosedPois:p,processDynamicPois:o}}}export{a as create};
|
|
@@ -1 +0,0 @@
|
|
|
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","waypoints"]))})),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 +0,0 @@
|
|
|
1
|
-
import*as a from"ramda";import{getFlexSearchInstance as r}from"./utils.js";function t(t,e){const o=r({lang:e});function n(r){return Object.values(r).map((r=>{const{poiId:t,category:e="",name:o,keywords:n=[],roomId:c=""}=r,i=a.path(["dynamicData","grab","tags"],r)||[],p=n.filter(a.prop("isUserSearchable")).map(a.prop("name")),s=`${o} ${e.split(".").join(" ")} ${c} ${p.join(" ")} ${i.join(" ")}`;return[Number(t),s]}))}return n(t).forEach((([a,r])=>o.add(a,r))),{search:function(r){const e=o.search(r);return Object.values(a.pick(e,t))},updateMultiple:function(a){n(a).forEach((([a,r])=>o.update(a,r)))}}}export{t as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"ramda";import r from"zousan";import{getLocalized as a}from"../../../src/utils/configUtils.js";import{arrayPick as s}from"../../../src/utils/rand.js";import t from"./poiSearch.js";import n from"./searchTypeahead.js";function o(o,i){const c={poiSearch:null,typeahead:null,indexesCreated:new r,defaultSearchTerms:null,specialQueryTerms:{}},u=async()=>{const e=await o.bus.get("poi/getAll");c.poiSearch=t(e,o.i18n().language),c.typeahead=n(e,c.poiSearch.search,o.i18n().language),c.defaultSearchTerms=a(i,"defaultSearchTerms",o.i18n().language),c.indexesCreated.resolve()};async function d(){const r=await o.bus.get("user/getPhysicalLocation"),a=await o.bus.get("poi/getByFloorId",{floorId:r.floorId}),s=Object.values(e.pickBy((e=>-1===e.category.indexOf("portal")&&"element.door"!==e.category),a)),t=await o.bus.get("wayfinder/addPathTimeMultiple",{pois:s,startLocation:r});return e.sortBy(e.prop("distance"),Object.values(t)).slice(0,50)}o.bus.on("search/queryNearby",(async()=>{const e=await d();return o.bus.send("search/showNearby",{pois:e,term:"Nearby"}),e})),o.bus.on("search/queryNearbyAsync",d),o.bus.on("search/queryCategory",(async({category:e,categoryName:r,searchTerm:a})=>{const s=await c.indexesCreated.then((()=>c.poiSearch.search({query:a||e})));return o.bus.send("search/showCategory",{pois:s,category:e,categoryName:r}),s})),o.bus.on("search/query",(({term:e})=>c.indexesCreated.then((()=>{const r=c.poiSearch.search({query:e});return o.bus.send("search/showSearchResults",{results:r,term:e}),r})))),o.bus.on("search/queryAsync",(({term:e})=>c.indexesCreated.then((()=>c.poiSearch.search({query:e}))))),o.bus.on("search/queryWithSpecial",(({term:e})=>{if(c.specialQueryTerms[e]){const{event:r,params:a}=c.specialQueryTerms[e];return o.bus.send(r,a)}return o.bus.get("search/query",{term:e})})),o.bus.on("search/getDefaultSearchTerms",(async({limit:e=5}={})=>{const r=c.defaultSearchTerms,a=r&&r.length?r:await async function(e){const r=(await o.bus.send("poi/getAllCategories"))[0],a=Array.from(new Set(r));return function(e){for(let r=e.length-1;r>0;r--){const a=Math.floor(Math.random()*(r+1));[e[r],e[a]]=[e[a],e[r]]}return e}(a).slice(0,e)}(e);return o.bus.send("search/showDefaultSearchKeywords",{keywords:a}),a})),o.bus.on("search/getDefaultSearchPois",(async({limit:r=5}={})=>{const a=await o.bus.get("poi/getAll"),t=e.pickBy(((e,r)=>e.isNavigable),a);return s(Object.values(t),r)})),o.bus.on("search/registerSpecialQuery",(({term:e,event:r,params:a,addKeyword:s=!0})=>{c.indexesCreated.then((()=>{s&&c.typeahead.addKeyword(e),c.specialQueryTerms[e]={event:r,params:a}}))})),o.bus.on("search/addKeywords",(({keywords:e})=>c.indexesCreated.then((()=>e.forEach((e=>c.typeahead.addKeyword(e))))))),o.bus.on("search/typeahead",(({term:e,limit:r})=>c.indexesCreated.then((()=>{const{keywords:a,pois:s}=c.typeahead.query(e,r);return{keywords:a,pois:s,term:e}})))),o.bus.on("venueData/loadNewVenue",(()=>{c.indexesCreated=new r,u()})),o.bus.on("poi/setDynamicData",(async({plugin:e,idValuesMap:r})=>{if("grab"!==e)return;const a=Object.keys(r).map((e=>o.bus.get("poi/getById",{id:e})));return Promise.all(a).then((e=>c.indexesCreated.then((()=>c.poiSearch.updateMultiple(e)))))}));return{init:u,runTest:async(e,r)=>(await r(),c)}}export{o as create};
|