atriusmaps-node-sdk 3.3.721 → 3.3.723
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/deploy/prepareSDKConfig.js +40 -14
- package/dist/cjs/nodesdk/nodeEntry.js +14 -5
- package/dist/cjs/package.json.js +1 -1
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +14 -7
- package/dist/cjs/plugins/dynamicPois/src/processors.js +3 -1
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +55 -21
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +6 -2
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +19 -8
- package/dist/cjs/plugins/searchService/src/poiSearch.js +3 -2
- package/dist/cjs/plugins/searchService/src/searchService.js +6 -2
- package/dist/cjs/plugins/searchService/src/utils.js +3 -1
- package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +53 -21
- package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +17 -7
- package/dist/cjs/plugins/wayfinder/src/findRoute.js +21 -7
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +56 -20
- package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +3 -1
- package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +75 -33
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +15 -5
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +47 -18
- package/dist/cjs/src/app.js +21 -8
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +15 -6
- package/dist/cjs/src/configs/postproc-stateTracking.js +8 -3
- package/dist/cjs/src/debugTools.js +8 -3
- package/dist/cjs/src/env.js +2 -1
- package/dist/cjs/src/extModules/bustle.js +40 -16
- package/dist/cjs/src/extModules/flexapi/src/validate.js +42 -18
- package/dist/cjs/src/extModules/log.js +16 -6
- package/dist/cjs/src/historyManager.js +3 -1
- package/dist/cjs/src/utils/configUtils.js +21 -8
- package/dist/cjs/src/utils/dom.js +19 -10
- package/dist/cjs/src/utils/funcs.js +8 -3
- package/dist/cjs/src/utils/geom.js +15 -5
- package/dist/cjs/src/utils/isInitialState.js +7 -3
- package/dist/cjs/src/utils/location.js +17 -8
- package/dist/cjs/src/utils/observable.js +17 -6
- package/dist/cjs/src/utils/rand.js +6 -2
- package/dist/package.json.js +1 -1
- package/dist/plugins/wayfinder/src/navGraph.js +1 -1
- package/dist/plugins/wayfinder/src/stepBuilder.js +1 -1
- package/package.json +1 -1
|
@@ -19,18 +19,25 @@
|
|
|
19
19
|
*/
|
|
20
20
|
function getLocalized(config, name, lang, def) {
|
|
21
21
|
let key = name;
|
|
22
|
-
if (lang)
|
|
22
|
+
if (lang) {
|
|
23
|
+
key += '-' + lang;
|
|
24
|
+
}
|
|
23
25
|
|
|
24
26
|
const value = config[key];
|
|
25
27
|
|
|
26
|
-
if (value)
|
|
28
|
+
if (value) {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
27
31
|
|
|
28
32
|
if (lang) {
|
|
29
|
-
if (lang.indexOf('-') > 0)
|
|
30
|
-
|
|
33
|
+
if (lang.indexOf('-') > 0) // we have sublocales, so strip last one and try again
|
|
34
|
+
{
|
|
31
35
|
return getLocalized(config, name, lang.substring(0, lang.indexOf('-')), def);
|
|
36
|
+
}
|
|
32
37
|
// no sublanguage, so next is try the name on its own
|
|
33
|
-
else
|
|
38
|
+
else {
|
|
39
|
+
return getLocalized(config, name, null, def);
|
|
40
|
+
}
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
// we are here means we just checked the name (no lang arg) and there was no value found, so
|
|
@@ -43,13 +50,19 @@ function getLocalized(config, name, lang, def) {
|
|
|
43
50
|
// the value of that key is not "no" or "false" or false (boolean) or undefined or null
|
|
44
51
|
// Any other value will be considered true - even 0 and ""
|
|
45
52
|
function debugIsTrue(app, key) {
|
|
46
|
-
if (!app.config.debug)
|
|
53
|
+
if (!app.config.debug) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
47
56
|
|
|
48
57
|
let value = app.config.debug[key];
|
|
49
58
|
|
|
50
|
-
if (value === undefined || value === null || value === false)
|
|
59
|
+
if (value === undefined || value === null || value === false) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
51
62
|
|
|
52
|
-
if (value === true)
|
|
63
|
+
if (value === true) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
53
66
|
|
|
54
67
|
value = value.toLowerCase ? value.toLowerCase() : value; // lower case it if possible
|
|
55
68
|
|
|
@@ -14,20 +14,27 @@ function ad(eConf, parent) {
|
|
|
14
14
|
|
|
15
15
|
let tag = 'div';
|
|
16
16
|
|
|
17
|
-
if (c.tag)
|
|
17
|
+
if (c.tag) {
|
|
18
|
+
tag = c.tag;
|
|
19
|
+
}
|
|
18
20
|
|
|
19
21
|
const node = document.createElement(tag);
|
|
20
22
|
|
|
21
23
|
for (const cc in c) {
|
|
22
|
-
if (c[cc] != null)
|
|
23
|
-
if (cc === 'klass')
|
|
24
|
-
|
|
24
|
+
if (c[cc] != null) {
|
|
25
|
+
if (cc === 'klass') // null or undefined
|
|
26
|
+
{
|
|
25
27
|
node.setAttribute('class', c.klass);
|
|
26
|
-
else if (cc === 'tag');
|
|
27
|
-
|
|
28
|
-
else if (cc === 'text')
|
|
29
|
-
|
|
30
|
-
else
|
|
28
|
+
} else if (cc === 'tag') ; else if (cc === 'styles') {
|
|
29
|
+
setStyles(node, c.styles);
|
|
30
|
+
} else if (cc === 'text') {
|
|
31
|
+
node.textContent = c.text;
|
|
32
|
+
} else if (cc === 'html') {
|
|
33
|
+
node.innerHTML = c.html;
|
|
34
|
+
} else {
|
|
35
|
+
node.setAttribute(cc, c[cc]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
parent.appendChild(node);
|
|
@@ -38,7 +45,9 @@ function ad(eConf, parent) {
|
|
|
38
45
|
const del = element => element?.parentNode?.removeChild(element);
|
|
39
46
|
|
|
40
47
|
const setStyles = (node, styles) => {
|
|
41
|
-
for (const style in styles)
|
|
48
|
+
for (const style in styles) {
|
|
49
|
+
node.style[style] = styles[style];
|
|
50
|
+
}
|
|
42
51
|
};
|
|
43
52
|
|
|
44
53
|
exports.$ = $;
|
|
@@ -7,8 +7,11 @@ require('zousan');
|
|
|
7
7
|
let lastFn = null;
|
|
8
8
|
const singleFile = fn =>
|
|
9
9
|
function () {
|
|
10
|
-
if (lastFn)
|
|
11
|
-
|
|
10
|
+
if (lastFn) {
|
|
11
|
+
lastFn = lastFn.then(() => fn.apply(null, arguments));
|
|
12
|
+
} else {
|
|
13
|
+
lastFn = fn.apply(null, arguments);
|
|
14
|
+
}
|
|
12
15
|
|
|
13
16
|
return lastFn;
|
|
14
17
|
};
|
|
@@ -24,7 +27,9 @@ const singleFile = fn =>
|
|
|
24
27
|
function filterOb(fn, ob) {
|
|
25
28
|
const ret = {};
|
|
26
29
|
Object.keys(ob).forEach(key => {
|
|
27
|
-
if (fn(key, ob[key]))
|
|
30
|
+
if (fn(key, ob[key])) {
|
|
31
|
+
ret[key] = ob[key];
|
|
32
|
+
}
|
|
28
33
|
});
|
|
29
34
|
return ret;
|
|
30
35
|
}
|
|
@@ -70,7 +70,9 @@ const NULL_STRUCTURE_AND_FLOOR = { structure: null, floor: null };
|
|
|
70
70
|
*/
|
|
71
71
|
function getStructureAndFloorAtPoint(structures, lat, lng, ord, mapviewBBox, preciseFlag = false) {
|
|
72
72
|
// Step 1 of logic flow
|
|
73
|
-
if (!R__namespace.length(structures))
|
|
73
|
+
if (!R__namespace.length(structures)) {
|
|
74
|
+
return NULL_STRUCTURE_AND_FLOOR;
|
|
75
|
+
}
|
|
74
76
|
|
|
75
77
|
structures = structures.filter(s => s.shouldDisplay == null || s.shouldDisplay === true);
|
|
76
78
|
|
|
@@ -104,7 +106,9 @@ function getStructureAndFloorWithinFloorsAtPoint(structures, floorsToConsider, l
|
|
|
104
106
|
//
|
|
105
107
|
if (preciseFlag) {
|
|
106
108
|
// not within any floor's bounding box? return nulls
|
|
107
|
-
if (pointWithinFloorsBBox.length === 0)
|
|
109
|
+
if (pointWithinFloorsBBox.length === 0) {
|
|
110
|
+
return NULL_STRUCTURE_AND_FLOOR;
|
|
111
|
+
}
|
|
108
112
|
|
|
109
113
|
// Step 3 (precise) - We need to determine which of the floors found above are we ACTUALLY in:
|
|
110
114
|
const floorsWithinBoundsPolygon = pointWithinFloorsBBox.filter(ftc =>
|
|
@@ -113,7 +117,9 @@ function getStructureAndFloorWithinFloorsAtPoint(structures, floorsToConsider, l
|
|
|
113
117
|
|
|
114
118
|
// We should never be in MORE than one floor's bounding polygon, so return 1st one
|
|
115
119
|
// and in unlikely case we ARE in multiple, user will get first one...
|
|
116
|
-
if (floorsWithinBoundsPolygon.length >= 1)
|
|
120
|
+
if (floorsWithinBoundsPolygon.length >= 1) {
|
|
121
|
+
return R__namespace.head(floorsWithinBoundsPolygon);
|
|
122
|
+
}
|
|
117
123
|
|
|
118
124
|
// precise yet not within any floor polygon, "so you get nothing. you lose. good day sir!"
|
|
119
125
|
return NULL_STRUCTURE_AND_FLOOR;
|
|
@@ -131,13 +137,17 @@ function getStructureAndFloorWithinFloorsAtPoint(structures, floorsToConsider, l
|
|
|
131
137
|
// .map(structure => ({ structure, floor: structure.levels[structure.defaultLevelId] }))
|
|
132
138
|
.map(structure => ({ structure, floor: null }));
|
|
133
139
|
|
|
134
|
-
if (floorsWithinBuildingBoundingBox.length >= 1)
|
|
140
|
+
if (floorsWithinBuildingBoundingBox.length >= 1) {
|
|
141
|
+
return floorsWithinBuildingBoundingBox[0];
|
|
142
|
+
}
|
|
135
143
|
|
|
136
144
|
return NULL_STRUCTURE_AND_FLOOR; // user does not seem to be near ANYTHING!
|
|
137
145
|
}
|
|
138
146
|
|
|
139
147
|
// Step 4 - If we are only in the bounding box of a single floor, return it
|
|
140
|
-
if (pointWithinFloorsBBox.length === 1)
|
|
148
|
+
if (pointWithinFloorsBBox.length === 1) {
|
|
149
|
+
return pointWithinFloorsBBox[0];
|
|
150
|
+
}
|
|
141
151
|
|
|
142
152
|
// Step 5 - Ok, so from here, we are NOT precise, and the map center is within MULTIPLE bounding boxes
|
|
143
153
|
// so how do we determine WHICH item to select...?
|
|
@@ -8,8 +8,10 @@ let userInteracted = false;
|
|
|
8
8
|
function userInteractionHandler() {
|
|
9
9
|
if (!userInteracted) {
|
|
10
10
|
userInteracted = true;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
for (const cb of callbacks) {
|
|
12
|
+
// eslint-disable-next-line n/no-callback-literal
|
|
13
|
+
cb(true);
|
|
14
|
+
}
|
|
13
15
|
callbacks.clear();
|
|
14
16
|
}
|
|
15
17
|
document.body.removeEventListener('click', userInteractionHandler);
|
|
@@ -17,7 +19,9 @@ function userInteractionHandler() {
|
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
function startInitialStateListener() {
|
|
20
|
-
if (listenerStarted)
|
|
22
|
+
if (listenerStarted) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
21
25
|
listenerStarted = true;
|
|
22
26
|
|
|
23
27
|
if (typeof window === 'undefined' || window.document?.body == null) {
|
|
@@ -12,27 +12,34 @@ var geom = require('./geom.js');
|
|
|
12
12
|
* @returns an Endpoint { lat, lng, ordinal, floorId, title }
|
|
13
13
|
*/
|
|
14
14
|
async function locationToEndpoint(app, location) {
|
|
15
|
-
if (location.poiId)
|
|
15
|
+
if (location.poiId) {
|
|
16
16
|
return app.bus.get('wayfinder/getNavigationEndpoint', {
|
|
17
17
|
ep: location.poiId,
|
|
18
18
|
});
|
|
19
|
+
}
|
|
19
20
|
|
|
20
21
|
let { lat, lng, ord, ordinal, floorId, title = '', structureId } = location;
|
|
21
22
|
|
|
22
|
-
if (lat == null || lng == null)
|
|
23
|
+
if (lat == null || lng == null) {
|
|
24
|
+
throw Error('To obtain a location, you must provide a lat,lng or a poiId');
|
|
25
|
+
}
|
|
23
26
|
|
|
24
|
-
if (ordinal === undefined && ord !== undefined)
|
|
27
|
+
if (ordinal === undefined && ord !== undefined) {
|
|
28
|
+
ordinal = ord;
|
|
29
|
+
} // normalize on "ordinal"
|
|
25
30
|
|
|
26
31
|
// Now lets normalize the return structure - determine ordinal, floorId and structureId
|
|
27
32
|
const structures = await getStructures(app);
|
|
28
33
|
|
|
29
34
|
if (ordinal == null) {
|
|
30
|
-
if (floorId == null)
|
|
31
|
-
|
|
35
|
+
if (floorId == null) // if neither ordinal nor floorId is defined bad dog!
|
|
36
|
+
{
|
|
32
37
|
throw Error('Call to locationToEndpoint with no ordinal and no floorId');
|
|
33
|
-
else {
|
|
38
|
+
} else {
|
|
34
39
|
const floor = geom.getFloor(structures, floorId);
|
|
35
|
-
if (!floor)
|
|
40
|
+
if (!floor) {
|
|
41
|
+
throw Error(`floor with id ${floorId} not found.`);
|
|
42
|
+
}
|
|
36
43
|
ordinal = floor.ordinal;
|
|
37
44
|
}
|
|
38
45
|
} else {
|
|
@@ -44,7 +51,9 @@ async function locationToEndpoint(app, location) {
|
|
|
44
51
|
}
|
|
45
52
|
}
|
|
46
53
|
|
|
47
|
-
if (floorId != null && structureId == null)
|
|
54
|
+
if (floorId != null && structureId == null) {
|
|
55
|
+
structureId = geom.getStructureForFloorId(structures, floorId)?.id;
|
|
56
|
+
}
|
|
48
57
|
|
|
49
58
|
return { lat, lng, floorId, ordinal, title, structureId };
|
|
50
59
|
}
|
|
@@ -3,20 +3,25 @@
|
|
|
3
3
|
function fire() {
|
|
4
4
|
const ob = this._observers;
|
|
5
5
|
|
|
6
|
-
if (!ob)
|
|
6
|
+
if (!ob) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
7
9
|
|
|
8
|
-
for (let x = 0; x < ob.length; x++)
|
|
10
|
+
for (let x = 0; x < ob.length; x++) {
|
|
9
11
|
try {
|
|
10
12
|
ob[x].apply(this, arguments);
|
|
11
13
|
} catch (err) {
|
|
12
14
|
console.error(err);
|
|
13
15
|
}
|
|
16
|
+
}
|
|
14
17
|
|
|
15
18
|
return this;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
function observe(cb) {
|
|
19
|
-
if (!this._observers)
|
|
22
|
+
if (!this._observers) {
|
|
23
|
+
this._observers = [];
|
|
24
|
+
}
|
|
20
25
|
|
|
21
26
|
this._observers.push(cb);
|
|
22
27
|
|
|
@@ -36,7 +41,9 @@ function filter(fn) {
|
|
|
36
41
|
const o2 = create();
|
|
37
42
|
|
|
38
43
|
this.observe(function () {
|
|
39
|
-
if (fn.apply(this, arguments))
|
|
44
|
+
if (fn.apply(this, arguments)) {
|
|
45
|
+
o2.fire.apply(o2, arguments);
|
|
46
|
+
}
|
|
40
47
|
});
|
|
41
48
|
|
|
42
49
|
return o2;
|
|
@@ -61,13 +68,17 @@ const observable = { detach, filter, fire, observe, on };
|
|
|
61
68
|
// extend `to` argument with properties from `from`
|
|
62
69
|
// [short version]
|
|
63
70
|
function extend(to, from) {
|
|
64
|
-
for (const prop in from)
|
|
71
|
+
for (const prop in from) {
|
|
72
|
+
to[prop] = from[prop];
|
|
73
|
+
}
|
|
65
74
|
|
|
66
75
|
return to;
|
|
67
76
|
}
|
|
68
77
|
|
|
69
78
|
function create(ob) {
|
|
70
|
-
if (ob)
|
|
79
|
+
if (ob) {
|
|
80
|
+
return extend(ob, observable);
|
|
81
|
+
}
|
|
71
82
|
|
|
72
83
|
return Object.create(observable);
|
|
73
84
|
}
|
|
@@ -46,8 +46,12 @@ const rand = (min, max) => {
|
|
|
46
46
|
* @returns {number[]} An array of unique random integers from 0 to max-1
|
|
47
47
|
*/
|
|
48
48
|
function randomSet(size, max) {
|
|
49
|
-
if (!max)
|
|
50
|
-
|
|
49
|
+
if (!max) {
|
|
50
|
+
max = size;
|
|
51
|
+
}
|
|
52
|
+
if (size > max) {
|
|
53
|
+
size = max;
|
|
54
|
+
}
|
|
51
55
|
|
|
52
56
|
const result = [];
|
|
53
57
|
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="web-engine",t="3.3.
|
|
1
|
+
var e="web-engine",t="3.3.723",s="UNLICENSED",r="module",o="src/main.js",i=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],l={colors:"cat utils/colors1.txt && node utils/processColors.js | pbcopy && cat utils/colors2.txt","cypress:comp":"cypress open --component --browser chrome","cypress:comp:ci":"cypress run --component",demo:"cd demo/ && yarn start",dev:"yarn mol e2e","format:check":"yarn prettier . --check","format:fix":"yarn prettier . --write",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh",lint:"eslint .",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol","playwright:ci":"yarn playwright test --grep-invert sdk","playwright:ci:failed":"yarn playwright test --last-failed --grep-invert sdk","playwright:sdk":"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./test/sdk && npx http-server' 8080 'yarn playwright test sdk --ui'","playwright:ui":"yarn playwright test --ui --grep-invert sdk",prepare:"husky",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:all":"yarn lint && yarn format:check && yarn test && yarn test:vitest && yarn cypress:comp:ci && yarn playwright:ci","test:vitest":"vitest run",typecheck:"tsc -p tsconfig.checkjs.json"},a=["defaults"],n={react:"^18.3.1"},c={"@azure/event-hubs":"^5.12.2","@csstools/normalize.css":"^11.0.1","@dnd-kit/core":"^6.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@locus-labs/mod-badge":"^0.1.102","@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","@mapbox/mapbox-gl-draw":"^1.5.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.6","@turf/area":"^7.2.0","@turf/bbox-clip":"^7.2.0","@turf/bbox-polygon":"^7.2.0","@turf/bearing":"^7.2.0","@turf/circle":"^7.2.0","@turf/helpers":"^7.2.0","@turf/point-to-line-distance":"^7.2.0","@vitejs/plugin-react":"^4.3.4","axe-core":"^4.10.3",browserslist:"^4.27.0","crypto-browserify":"^3.12.1","cypress-multi-reporters":"^2.0.5","cypress-real-events":"^1.14.0","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^20.6.1","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"6.0.2",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^2.9.2","mocha-junit-reporter":"^2.2.1",mochawesome:"^7.1.3","node-polyfill-webpack-plugin":"^4.1.0","path-browserify":"^1.0.1","prop-types":"^15.8.1",ramda:"^0.30.1",react:"^18.3.1","react-compound-slider":"^3.4.0","react-dom":"^18.3.1","react-json-editor-ajrm":"^2.5.14","react-qr-svg":"^2.4.0","react-svg":"^16.3.0","react-virtualized-auto-sizer":"^1.0.25","react-window":"^1.8.11","smoothscroll-polyfill":"^0.4.4","styled-components":"^6.1.15","styled-normalize":"^8.1.1","throttle-debounce":"^5.0.2",trackjs:"^3.10.4","ua-parser-js":"^0.7.40",uuid:"11.1.0",zousan:"^3.0.1","zousan-plus":"^4.0.1"},p={"@applitools/eyes-playwright":"^1.44.1","@axe-core/playwright":"^4.10.2","@azure/identity":"^4.13.0","@azure/playwright":"^1.0.0","@babel/core":"^7.26.10","@babel/eslint-parser":"^7.26.10","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-syntax-import-assertions":"^7.26.0","@babel/plugin-transform-modules-commonjs":"^7.26.3","@babel/plugin-transform-runtime":"^7.26.10","@babel/preset-env":"^7.26.9","@babel/preset-react":"^7.26.3","@playwright/test":"^1.56.0","@testing-library/jest-dom":"^6.6.3","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","babel-jest":"^29.7.0","babel-loader":"^10.0.0","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^5.0.2","babel-plugin-styled-components":"^2.1.4","chai-colors":"^1.0.1","css-loader":"^7.1.2",cypress:"^14.2.0","cypress-wait-until":"^3.0.2",eslint:"^8.57.1","eslint-config-prettier":"^10.1.8","eslint-config-standard":"^17.1.0","eslint-import-resolver-alias":"^1.1.2","eslint-import-resolver-typescript":"^3.9.1","eslint-plugin-cypress":"^2.15.2","eslint-plugin-import":"^2.31.0","eslint-plugin-jest":"^28.11.0","eslint-plugin-n":"^17.16.2","eslint-plugin-node":"^11.1.0","eslint-plugin-playwright":"^2.2.2","eslint-plugin-promise":"^5.2.0","eslint-plugin-react":"^7.37.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.5.1",glob:"^11.0.1",husky:"^9.1.7",jest:"29.7.0","jest-environment-jsdom":"^29.7.0","lint-staged":"^15.5.0","node-fetch":"^2.7.0","null-loader":"^4.0.1",nx:"19.8.14","nx-remotecache-azure":"^19.0.0","os-browserify":"^0.3.0",prettier:"3.7.4","start-server-and-test":"^2.0.11",typescript:"^5.8.2",vite:"^4.3.9",vitest:"^4.0.17","webpack-merge":"^6.0.1"},d="yarn@4.7.0",m={node:"24.x"},u={},y={name:e,version:t,private:!0,license:s,type:r,main:o,workspaces:i,scripts:l,"lint-staged":{"*.js":["eslint --fix","prettier --check"],"*.{json,md,css,ts,tsx,jsx}":["prettier --check"]},browserslist:a,resolutions:n,dependencies:c,devDependencies:p,packageManager:d,engines:m,nx:u};export{a as browserslist,y as default,c as dependencies,p as devDependencies,m as engines,s as license,o as main,e as name,u as nx,d as packageManager,n as resolutions,l as scripts,r as type,t as version,i as workspaces};
|
|
@@ -1 +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
|
|
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";function d(r,s,l,u){const d={},c={},a=new Set;let h={};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);c[o]||(c[o]=[]);c[o].push(t),c[n]||(c[n]=[]);c[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){if(t.x)return"Security Checkpoint";if(""===t.t)return"Ground";return t.t}(t),r=e.toLowerCase(),i="escalator"!==r&&"stairs"!==r,s=f(t.s,t.d,n),l=t.l||s/60,u=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]}})),d=t.p?u(t.p):null;return{distance:s,dst:t.d,o:t.o,isAccessible:i,isDriveway:!o(t.h)&&!t.h,src:t.s,transitTime:l,type:e,path:d,weight:l}}(t,d)));const p=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?w(t.floorId,o,n,c,d):T(t.ordinal,o,n,d)};return{_nodes:d,_geoDb:c,_nodesToAvoid:a,addNodesToAvoid:t=>function(t){a.clear(),t.forEach(t=>a.add(t))}(t),findClosestNode:(t,o,n)=>w(t,o,n,c,d),findShortestPath:(t,o,n)=>function(t,o,n,e={}){return I(p(t),p(o),n,a,h,u,e)}(t,o,d,n),findAllShortestPaths:function(t,o,n){const e=p(t),r=o.map(t=>p(t));return e&&r.length?function(t,o,n,e,r={},i={},s={}){return o.map(o=>{try{return I(t,o,n,e,r,i,s)}catch(t){return null}})}(e,r,d,a,h,u,n):[]},floorIdToOrdinal:s,floorIdToStructureId:l,updateWithSecurityWaitTime:function(t){h=n(e(["lastUpdated"]),t),y()},clearCache:y}}function f(t,o,n){const e=n[t],r=n[o];return l(e.lat,e.lng,r.lat,r.lng)}let c,a,h,p,g,m;const y=()=>{c={},a={},h={},p=new u,g=null,m={}};function I(t,o,n,e,i={},s={},l={}){for(t.id===g&&m===JSON.stringify(l)||(y(),p.offerWithPriority(t.id,0),c[t.id]=0,h[t.id]=!0,g=t.id,m=JSON.stringify(l));!p.isEmpty()&&!h[o.id];){const t=n[p.poll()],o=c[t.id];for(let n=0;n<t.edges.length;n++){const u=t.edges[n];if(e.size>0&&e.has(u.dst))continue;if(h[u.dst])continue;if(l.requiresAccessibility&&!u.isAccessible)continue;let d=u.weight;if(u.o&&i[u.o]){const t=i[u.o];t.queueTime&&(d=t.queueTime),t.isTemporarilyClosed&&(d=9999),u.securityWaitTimes=t}if(u.o&&s[u.o]){u.securityLane=s[u.o];const{type:t,id:o}=s[u.o],n=r(["selectedSecurityLanes",t],l);if(n&&!n.includes(o))continue}void 0===c[u.dst]?(a[u.dst]=t,c[u.dst]=o+d,p.offerWithPriority(u.dst,o+d)):c[u.dst]>o+d&&(c[u.dst]=o+d,a[u.dst]=t,p.raisePriority(u.dst,o+d))}h[t.id]=!0}if(!h[o.id])return null;const u=[];let d=o;for(;d;)u.push(d),d=a[d.id];return u.reverse()}function b(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 w(t,o,n,e,r){const s=function(t,o,n){let e=b(t,o,n,8);return e.length>0?e:(e=b(t,o,n,7),e.length>0?e: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 v(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 T(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 v(r)}function v(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{d as createNavGraph,T as findClosestNodeByOrdinal,I as findShortestPath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bearing as e}from"@turf/bearing";import{point as t}from"@turf/helpers";import{compose as r,not as n,includes as a,__ as s,toLower as i,prop as o,find as c,drop as u,last as _,propEq as T}from"ramda";import{findBoundsOfWaypoints as A}from"../../../src/utils/bounds.js";import{metersToYards as S}from"../../../src/utils/distance.js";import{bearingToDirection as d,distance as R}from"../../../src/utils/geodesy.js";import E from"./segmentBadges.js";import I from"./segmentCategories.js";function O(r,n="",a="",s,i,c={},u,_=[],T){return r.map((u,R)=>{const O=N("securityWaitTimes")(u.waypoints),
|
|
1
|
+
import{bearing as e}from"@turf/bearing";import{point as t}from"@turf/helpers";import{compose as r,not as n,includes as a,__ as s,toLower as i,prop as o,find as c,drop as u,last as _,propEq as T}from"ramda";import{findBoundsOfWaypoints as A}from"../../../src/utils/bounds.js";import{metersToYards as S}from"../../../src/utils/distance.js";import{bearingToDirection as d,distance as R}from"../../../src/utils/geodesy.js";import E from"./segmentBadges.js";import I from"./segmentCategories.js";function O(r,n="",a="",s,i,c={},u,_=[],T){return r.map((u,R)=>{const O=N("securityWaitTimes")(u.waypoints),f=O&&!O.isTemporarilyClosed?O.queueTime:Math.round(function(e){if(1===e.length)return e[0].eta;return e.map(o("eta")).slice(1).reduce((e,t)=>e+t,0)}(u.waypoints)),L=Math.round(function(e){if(1===e.length)return e[0].distance;return e.map(e=>e.distance).slice(1).reduce((e,t)=>e+t,0)}(u.waypoints)),P="yards"===T?S(L):L,W=function(e){switch(e){case I.START:return E.START;case I.WALKING_TO_END:return E.END;case I.ELEVATOR:return E.ELEVATOR;case I.ELEVATOR_UP:return E.ELEVATOR_UP;case I.ELEVATOR_DOWN:return E.ELEVATOR_DOWN;case I.STAIRS:return E.STAIRS;case I.STAIRS_UP:return E.STAIRS_UP;case I.STAIRS_DOWN:return E.STAIRS_DOWN;case I.ACCESSIBLE_STAIRS:return E.ACCESSIBLE_STAIRS;case I.ACCESSIBLE_STAIRS_UP:return E.ACCESSIBLE_STAIRS_UP;case I.ACCESSIBLE_STAIRS_DOWN:return E.ACCESSIBLE_STAIRS_DOWN;case I.ESCALATOR:return E.ESCALATOR;case I.ESCALATOR_UP:return E.ESCALATOR_UP;case I.ESCALATOR_DOWN:return E.ESCALATOR_DOWN;case I.WALKING_TO_PORTAL:case I.WALK:case I.WALK_DOWN:case I.WALK_UP:return E.WALK;case I.TRAIN:return E.TRAIN;case I.TRAIN_UP:return E.TRAIN_UP;case I.TRAIN_DOWN:return E.TRAIN_DOWN;case I.BUS:return E.BUS;case I.BUS_UP:return E.BUS_UP;case I.BUS_DOWN:return E.BUS_DOWN;case I.SECURITY_CHECKPOINT:return E.SECURITY_CHECKPOINT;case I.RAMP:return E.RAMP;case I.RAMP_UP:return E.RAMP_UP;case I.RAMP_DOWN:return E.RAMP_DOWN;default:return E.WALK}}(u.segmentCategory),U=function(e,t){let r;switch(e){case I.START:r=0;break;case I.WALKING_TO_END:r=t.length-1;break;case I.WALKING_TO_PORTAL:r=Math.min(t.length-1,Math.ceil(t.length/2));break;default:r=t.length-1}return t[r].position}(u.segmentCategory,u.waypoints),D=(({waypoints:r},n)=>{const[a]=r,s=r[r.length-1],i=t([a.position.lng,a.position.lat]),o=t([s.position.lng,s.position.lat]),c=e(i,o);return d(c,n)})(u,i),g=function(e,t,r,n,a,s,i,o){const c=e[t];switch(c.segmentCategory){case I.START:return y(c.waypoints[0].position,r);case I.WALKING_TO_END:return y(c.waypoints[c.waypoints.length-1].position,n);case I.WALKING_TO_SECURITY_CHECKPOINT:{const r=e[t+1].waypoints,n=m(o,r),a=s("wayfinder:Security Lane"),u=n?`${n} ${a}`:null,_=w(r,i);return u||_||s(`wayfinder:${c.type}`)}case I.WALKING_TO_PORTAL:return s(`wayfinder:${e[t+1].type}`);case I.SECURITY_CHECKPOINT:{const e=m(o,c.waypoints),t=s("wayfinder:Security Lane"),r=e?`${e} ${t}`:null,n=w(c.waypoints,i);return r||n||l(c,a)}case I.ELEVATOR:case I.ELEVATOR_DOWN:case I.ELEVATOR_UP:case I.ESCALATOR:case I.ESCALATOR_DOWN:case I.ESCALATOR_UP:case I.STAIRS:case I.STAIRS_DOWN:case I.STAIRS_UP:case I.ACCESSIBLE_STAIRS:case I.ACCESSIBLE_STAIRS_DOWN:case I.ACCESSIBLE_STAIRS_UP:return l(c,a);default:return s(`wayfinder:${c.type}`)}}(r,R,n,a,s,i,_,c),K={primaryText:g,secondaryText:p(u,f,i,!1),secondaryTextUI:p(u,f,i,!0,D,T,P),icon:W,animationAnchor:U,eta:f,distance:L,bounds:A(u.waypoints),isAccessible:C(u),securityWaitTimes:O};return u.poiId&&(K.poiId=u.poiId),K})}function y(e,t){return e.name?e.name:t}function l(e,t){return t[_(e.waypoints).position.floorId]}function p(e,t,r,n,a,s,i){const o=L(t,r),c="Proceed";switch(e.segmentCategory){case I.START:return r("wayfinder:Begin route at");case I.ELEVATOR:return r("wayfinder:Take elevator to");case I.ELEVATOR_UP:return r("wayfinder:Take elevator up to");case I.ELEVATOR_DOWN:return r("wayfinder:Take elevator down to");case I.STAIRS:return r("wayfinder:Take stairs to");case I.STAIRS_UP:return r("wayfinder:Take stairs up to");case I.STAIRS_DOWN:return r("wayfinder:Take stairs down to");case I.ACCESSIBLE_STAIRS:return r("wayfinder:Take accessible stairs to");case I.ACCESSIBLE_STAIRS_UP:return r("wayfinder:Take accessible stairs up to");case I.ACCESSIBLE_STAIRS_DOWN:return r("wayfinder:Take accessible stairs down to");case I.ESCALATOR:return r("wayfinder:Take escalator to");case I.ESCALATOR_UP:return r("wayfinder:Take escalator up to");case I.ESCALATOR_DOWN:return r("wayfinder:Take escalator down to");case I.WALK:case I.WALKING_TO_SECURITY_CHECKPOINT:case I.WALKING_TO_PORTAL:case I.WALKING_TO_END:return n?f(i,s,a,r):o(`${c} <1 minute to`,`${c} xx minute to`);case I.WALK_DOWN:return o(`${c} <1 minute down to`,`${c} xx minute down to`);case I.WALK_UP:return o(`${c} <1 minute up to`,`${c} xx minute up to`);case I.TRAIN:return o("Take train <1 minute","Take train xx minute");case I.BUS:return o("Take bus <1 minute","Take bus xx minute");case I.SECURITY_CHECKPOINT:return r("wayfinder:Through");case I.RAMP:return r("wayfinder:Take ramp to");case I.RAMP_UP:return r("wayfinder:Take ramp up to");case I.RAMP_DOWN:return r("wayfinder:Take ramp down to");default:return""}}const f=(e,t,r,n)=>e>1?n("meters"===t?"wayfinder:Proceed __direction__ __count__ meter to_plural":"wayfinder:Proceed __direction__ __count__ yard to_plural",{direction:r,count:e}):e<=1?n("meters"===t?"wayfinder:Proceed __direction__ __count__ meter to":"wayfinder:Proceed __direction__ __count__ yard to",{direction:r,count:e}):void 0,L=(e,t)=>(r,n)=>0===e?t("wayfinder:"+r):t("wayfinder:"+n,{count:e}),C=r(n,a(s,["escalator","stairs"]),i,o("type")),m=(e,t)=>{const r=N("securityLane")(t);if(!r)return;const n=o(r.type,e),a=c(T(r.id,"id"),n);return o("displayText",a)},N=e=>r(o(e),c(o(e)),u(1)),w=(e,t)=>{if(!e||0===e.length)return null;const r=e[0],{lat:n,lng:a,floorId:s}=r.position,i=t.filter(e=>e.position&&e.position.floorId===s);let o=null,c=1/0;return i.forEach(e=>{const t=R(n,a,e.position.latitude,e.position.longitude);t<c&&(c=t,o=e)}),o?o.name:null};export{O as default};
|
package/package.json
CHANGED