atriusmaps-node-sdk 3.3.594 → 3.3.596
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/package.json.js +1 -1
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +9 -9
- package/dist/cjs/src/utils/geodesy.js +9 -9
- package/dist/package.json.js +1 -1
- package/dist/plugins/wayfinder/src/stepBuilder.js +1 -1
- package/dist/src/utils/geodesy.js +1 -1
- package/package.json +1 -1
package/dist/cjs/package.json.js
CHANGED
|
@@ -19,14 +19,14 @@ var segmentCategories = require('./segmentCategories.js');
|
|
|
19
19
|
* @returns {string} - The general direction of the segment.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
const calculateSegmentGeneralDirection = ({ waypoints }) => {
|
|
22
|
+
const calculateSegmentGeneralDirection = ({ waypoints }, T) => {
|
|
23
23
|
const [firstWaypoint] = waypoints;
|
|
24
24
|
const lastWaypoint = waypoints[waypoints.length - 1];
|
|
25
25
|
const from = helpers.point([firstWaypoint.position.lng, firstWaypoint.position.lat]);
|
|
26
26
|
const to = helpers.point([lastWaypoint.position.lng, lastWaypoint.position.lat]);
|
|
27
27
|
const bearingDegrees = bearing.bearing(from, to);
|
|
28
28
|
// Convert bearing to general direction
|
|
29
|
-
return geodesy.bearingToDirection(bearingDegrees) // returns cardinal direction 'north', 'northeast' etc as a string
|
|
29
|
+
return geodesy.bearingToDirection(bearingDegrees, T) // returns cardinal direction 'north', 'northeast' etc as a string
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -67,7 +67,7 @@ function getSteps (segments, startName = '', destinationName = '', floorIdToName
|
|
|
67
67
|
const currentUnitsDistance = currentUnits === 'yards' ? distance.metersToYards(distance$1) : distance$1;
|
|
68
68
|
const icon = getIcon(segment.segmentCategory);
|
|
69
69
|
const animationAnchor = getAnimationAnchor(segment.segmentCategory, segment.waypoints);
|
|
70
|
-
const direction = calculateSegmentGeneralDirection(segment); // returns string like 'north', 'southwest', etc.
|
|
70
|
+
const direction = calculateSegmentGeneralDirection(segment, T); // returns string like 'north', 'southwest', etc.
|
|
71
71
|
const primaryText = getPrimaryText(segments, index, startName, destinationName, floorIdToNameMap, T, securityPois, queueTypes);
|
|
72
72
|
const secondaryText = getSecondaryText(segment, eta, T, false); // this is old but apparently relied on by customers using JS SDK and Mobile SDK
|
|
73
73
|
const secondaryTextUI = getSecondaryText(segment, eta, T, true, direction, currentUnits, currentUnitsDistance); // this is used in Webengine UI
|
|
@@ -254,7 +254,7 @@ function getSecondaryText (segment, minutes, T, ui, direction, currentUnits, cur
|
|
|
254
254
|
if (!ui) {
|
|
255
255
|
return zeroOrOtherKeys(`${travelVerb} <1 minute to`, `${travelVerb} xx minute to`)
|
|
256
256
|
} else {
|
|
257
|
-
return createSecondaryTextWithHeading(currentUnitsDistance, currentUnits, direction,
|
|
257
|
+
return createSecondaryTextWithHeading(currentUnitsDistance, currentUnits, direction, T)
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
case segmentCategories.WALK_DOWN: return zeroOrOtherKeys(`${travelVerb} <1 minute down to`, `${travelVerb} xx minute down to`)
|
|
@@ -271,16 +271,16 @@ function getSecondaryText (segment, minutes, T, ui, direction, currentUnits, cur
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
const createSecondaryTextWithHeading = (currentUnitsDistance, currentUnits, direction,
|
|
274
|
+
const createSecondaryTextWithHeading = (currentUnitsDistance, currentUnits, direction, T) => {
|
|
275
275
|
if (currentUnitsDistance > 1) {
|
|
276
276
|
return currentUnits === 'meters'
|
|
277
|
-
? T(`wayfinder:
|
|
278
|
-
: T(`wayfinder:
|
|
277
|
+
? T(`wayfinder:Proceed __direction__ __count__ meter to_plural`, { direction, count: currentUnitsDistance })
|
|
278
|
+
: T(`wayfinder:Proceed __direction__ __count__ yard to_plural`, { direction, count: currentUnitsDistance })
|
|
279
279
|
}
|
|
280
280
|
if (currentUnitsDistance <= 1) {
|
|
281
281
|
return currentUnits === 'meters'
|
|
282
|
-
? T(`wayfinder:
|
|
283
|
-
: T(`wayfinder:
|
|
282
|
+
? T(`wayfinder:Proceed __direction__ __count__ meter to`, { direction, count: currentUnitsDistance })
|
|
283
|
+
: T(`wayfinder:Proceed __direction__ __count__ yard to`, { direction, count: currentUnitsDistance })
|
|
284
284
|
}
|
|
285
285
|
};
|
|
286
286
|
|
|
@@ -34,16 +34,16 @@ function distance (lat1, lng1, lat2, lng2) {
|
|
|
34
34
|
return R * c
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
function bearingToDirection (deg) {
|
|
37
|
+
function bearingToDirection (deg, T) {
|
|
38
38
|
const names = [
|
|
39
|
-
'north', // 0
|
|
40
|
-
'northeast', // 45
|
|
41
|
-
'east', // 90
|
|
42
|
-
'southeast', // 135
|
|
43
|
-
'south', // 180 / -180
|
|
44
|
-
'southwest', // -135
|
|
45
|
-
'west', // -90
|
|
46
|
-
'northwest' // -45
|
|
39
|
+
T('wayfinder:north'), // 0
|
|
40
|
+
T('wayfinder:northeast'), // 45
|
|
41
|
+
T('wayfinder:east'), // 90
|
|
42
|
+
T('wayfinder:southeast'), // 135
|
|
43
|
+
T('wayfinder:south'), // 180 / -180
|
|
44
|
+
T('wayfinder:southwest'), // -135
|
|
45
|
+
T('wayfinder:west'), // -90
|
|
46
|
+
T('wayfinder:northwest') // -45
|
|
47
47
|
];
|
|
48
48
|
// normalize -180..180
|
|
49
49
|
const d = ((deg + 180) % 360) - 180;
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="web-engine",s="3.3.
|
|
1
|
+
var e="web-engine",s="3.3.596",t="UNLICENSED",o="module",r="src/main.js",l=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],i={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","playwright:ci":"yarn playwright test --grep-invert sdk","playwright:ui":"yarn playwright test --ui --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'",demo:"cd demo/ && yarn start",dev:"yarn mol e2e",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",prepare:"husky",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:vitest":"vitest run"},a=["defaults"],n={react:"^18.3.1"},p={"@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","@locus-labs/mol-desktop-icon":"^0.1.131","@locus-labs/mol-desktop-tooltip":"^0.3.102","@locus-labs/mol-mobile-box":"^0.1.115","@locus-labs/mol-mobile-icon":"^0.1.118","@locus-labs/mol-mobile-text":"^0.1.116","@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"},c={"@applitools/eyes-playwright":"^1.40.5","@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-standard":"^17.1.0","eslint-import-resolver-typescript":"^3.9.1","eslint-plugin-cypress":"^2.15.2","eslint-plugin-import":"^2.31.0","eslint-plugin-jest":"^28.11.0","eslint-plugin-n":"^17.16.2","eslint-plugin-node":"^11.1.0","eslint-plugin-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","start-server-and-test":"^2.0.11",typescript:"^5.8.2",vite:"^4.3.9",vitest:"^2.1.9","webpack-merge":"^6.0.1"},d="yarn@4.7.0",m={node:"22.x"},u={},b={name:e,version:s,private:!0,license:t,type:o,main:r,workspaces:l,scripts:i,"lint-staged":{"*.js":["eslint --fix"]},browserslist:a,resolutions:n,dependencies:p,devDependencies:c,packageManager:d,engines:m,nx:u};export{a as browserslist,b as default,p as dependencies,c as devDependencies,m as engines,t as license,r as main,e as name,u as nx,d as packageManager,n as resolutions,i as scripts,o as type,s as version,l as workspaces};
|
|
@@ -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
|
|
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 o,prop as i,find as c,drop as u,last as T,propEq as _}from"ramda";import{findBoundsOfWaypoints as A}from"../../../src/utils/bounds.js";import{metersToYards as d}from"../../../src/utils/distance.js";import{bearingToDirection as R,distance as O}from"../../../src/utils/geodesy.js";import p from"./segmentBadges.js";import y from"./segmentCategories.js";function l(r,n="",a="",s,o,c={},u,T=[],_){return r.map(((u,O)=>{const l=I("securityWaitTimes")(u.waypoints),m=l&&!l.isTemporarilyClosed?l.queueTime:Math.round(1===(L=u.waypoints).length?L[0].eta:L.map(i("eta")).slice(1).reduce(((e,t)=>e+t),0));var L;const W=Math.round(function(e){return 1===e.length?e[0].distance:e.map((e=>e.distance)).slice(1).reduce(((e,t)=>e+t),0)}(u.waypoints)),C="yards"===_?d(W):W,U=function(e){switch(e){case y.START:return p.START;case y.WALKING_TO_END:return p.END;case y.ELEVATOR:return p.ELEVATOR;case y.ELEVATOR_UP:return p.ELEVATOR_UP;case y.ELEVATOR_DOWN:return p.ELEVATOR_DOWN;case y.STAIRS:return p.STAIRS;case y.STAIRS_UP:return p.STAIRS_UP;case y.STAIRS_DOWN:return p.STAIRS_DOWN;case y.ESCALATOR:return p.ESCALATOR;case y.ESCALATOR_UP:return p.ESCALATOR_UP;case y.ESCALATOR_DOWN:return p.ESCALATOR_DOWN;case y.WALKING_TO_PORTAL:case y.WALK:case y.WALK_DOWN:case y.WALK_UP:return p.WALK;case y.TRAIN:return p.TRAIN;case y.TRAIN_UP:return p.TRAIN_UP;case y.TRAIN_DOWN:return p.TRAIN_DOWN;case y.BUS:return p.BUS;case y.BUS_UP:return p.BUS_UP;case y.BUS_DOWN:return p.BUS_DOWN;case y.SECURITY_CHECKPOINT:return p.SECURITY_CHECKPOINT;case y.RAMP:return p.RAMP;case y.RAMP_UP:return p.RAMP_UP;case y.RAMP_DOWN:return p.RAMP_DOWN;default:return p.WALK}}(u.segmentCategory),g=function(e,t){let r;switch(e){case y.START:r=0;break;case y.WALKING_TO_END:r=t.length-1;break;case y.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],o=t([a.position.lng,a.position.lat]),i=t([s.position.lng,s.position.lat]),c=e(o,i);return R(c,n)})(u,o),K=function(e,t,r,n,a,s,o,i){const c=e[t];switch(c.segmentCategory){case y.START:return S(c.waypoints[0].position,r);case y.WALKING_TO_END:return S(c.waypoints[c.waypoints.length-1].position,n);case y.WALKING_TO_SECURITY_CHECKPOINT:{const r=e[t+1].waypoints,n=w(i,r),a=s("wayfinder:Security Lane"),u=n?`${n} ${a}`:null,T=P(r,o);return u||T||s(`wayfinder:${c.type}`)}case y.WALKING_TO_PORTAL:return s(`wayfinder:${e[t+1].type}`);case y.SECURITY_CHECKPOINT:{const e=w(i,c.waypoints),t=s("wayfinder:Security Lane"),r=e?`${e} ${t}`:null,n=P(c.waypoints,o);return r||n||f(c,a)}case y.ELEVATOR:case y.ELEVATOR_DOWN:case y.ELEVATOR_UP:case y.ESCALATOR:case y.ESCALATOR_DOWN:case y.ESCALATOR_UP:case y.STAIRS:case y.STAIRS_DOWN:case y.STAIRS_UP:return f(c,a);default:return s(`wayfinder:${c.type}`)}}(r,O,n,a,s,o,T,c),h={primaryText:K,secondaryText:E(u,m,o,!1),secondaryTextUI:E(u,m,o,!0,D,_,C),icon:U,animationAnchor:g,eta:m,distance:W,bounds:A(u.waypoints),isAccessible:N(u),securityWaitTimes:l};return u.poiId&&(h.poiId=u.poiId),h}))}function S(e,t){return e.name?e.name:t}function f(e,t){return t[T(e.waypoints).position.floorId]}function E(e,t,r,n,a,s,o){const i=L(t,r),c="Proceed";switch(e.segmentCategory){case y.START:return r("wayfinder:Begin route at");case y.ELEVATOR:return r("wayfinder:Take elevator to");case y.ELEVATOR_UP:return r("wayfinder:Take elevator up to");case y.ELEVATOR_DOWN:return r("wayfinder:Take elevator down to");case y.STAIRS:return r("wayfinder:Take stairs to");case y.STAIRS_UP:return r("wayfinder:Take stairs up to");case y.STAIRS_DOWN:return r("wayfinder:Take stairs down to");case y.ESCALATOR:return r("wayfinder:Take escalator to");case y.ESCALATOR_UP:return r("wayfinder:Take escalator up to");case y.ESCALATOR_DOWN:return r("wayfinder:Take escalator down to");case y.WALK:case y.WALKING_TO_SECURITY_CHECKPOINT:case y.WALKING_TO_PORTAL:case y.WALKING_TO_END:return n?m(o,s,a,r):i(`${c} <1 minute to`,`${c} xx minute to`);case y.WALK_DOWN:return i(`${c} <1 minute down to`,`${c} xx minute down to`);case y.WALK_UP:return i(`${c} <1 minute up to`,`${c} xx minute up to`);case y.TRAIN:return i("Take train <1 minute","Take train xx minute");case y.BUS:return i("Take bus <1 minute","Take bus xx minute");case y.SECURITY_CHECKPOINT:return r("wayfinder:Through");case y.RAMP:return r("wayfinder:Take ramp to");case y.RAMP_UP:return r("wayfinder:Take ramp up to");case y.RAMP_DOWN:return r("wayfinder:Take ramp down to");default:return""}}const m=(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}),N=r(n,a(s,["escalator","stairs"]),o,i("type")),w=(e,t)=>{const r=I("securityLane")(t);if(!r)return;const n=i(r.type,e),a=c(_(r.id,"id"),n);return i("displayText",a)},I=e=>r(i(e),c(i(e)),u(1)),P=(e,t)=>{if(!e||0===e.length)return null;const r=e[0],{lat:n,lng:a,floorId:s}=r.position,o=t.filter((e=>e.position&&e.position.floorId===s));let i=null,c=1/0;return o.forEach((e=>{const t=O(n,a,e.position.latitude,e.position.longitude);t<c&&(c=t,i=e)})),i?i.name:null};export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=t=>t*Math.PI/180;function
|
|
1
|
+
const t=t=>t*Math.PI/180;function n(n,a,s,r){const e=t(n),h=t(s),o=t(s-n),i=t(r-a),w=Math.sin(o/2)*Math.sin(o/2)+Math.cos(e)*Math.cos(h)*Math.sin(i/2)*Math.sin(i/2);return 6371e3*(2*Math.atan2(Math.sqrt(w),Math.sqrt(1-w)))}function a(t,n){const a=(t+180)%360-180;return[n("wayfinder:north"),n("wayfinder:northeast"),n("wayfinder:east"),n("wayfinder:southeast"),n("wayfinder:south"),n("wayfinder:southwest"),n("wayfinder:west"),n("wayfinder:northwest")][(Math.round(a/45)+8)%8]}export{a as bearingToDirection,n as distance,t as toRadians};
|
package/package.json
CHANGED