atriusmaps-node-sdk 3.3.869 → 3.3.871
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/clientAPI/src/clientAPI.js +1 -1
- package/dist/cjs/plugins/monitoring/src/monitoring.js +164 -0
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +1 -1
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +1 -1
- package/dist/cjs/plugins/searchService/src/searchService.js +1 -1
- package/dist/cjs/plugins/searchService/src/searchTypeahead.js +1 -1
- package/dist/cjs/plugins/searchService/src/utils.js +1 -1
- package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +1 -0
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +2 -2
- package/dist/cjs/src/app.js +7 -5
- package/dist/package.json.js +1 -1
- package/dist/plugins/clientAPI/src/clientAPI.js +1 -1
- package/dist/plugins/monitoring/src/monitoring.js +1 -0
- package/dist/plugins/poiDataManager/src/poiDataManager.js +1 -1
- package/dist/plugins/sdkServer/src/sdkServer.js +1 -1
- package/dist/plugins/searchService/src/searchService.js +1 -1
- package/dist/plugins/searchService/src/searchTypeahead.js +1 -1
- package/dist/plugins/searchService/src/utils.js +1 -1
- package/dist/plugins/wayfinder/src/navGraph.js +1 -1
- package/dist/src/app.js +1 -1
- package/package.json +1 -1
package/dist/cjs/package.json.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('../../../src/extModules/flexapi/src/index.js');
|
|
4
4
|
|
|
5
|
-
function create(app
|
|
5
|
+
function create(app) {
|
|
6
6
|
const api = index();
|
|
7
7
|
app.bus.on('clientAPI/registerCommand', ob =>
|
|
8
8
|
api.registerCommand(ob, cob => app.bus.get(`clientAPI/${cob.command}`, cob)),
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var trackjs = require('trackjs');
|
|
4
|
+
var UAParser = require('ua-parser-js');
|
|
5
|
+
var _package = require('../../../package.json.js');
|
|
6
|
+
|
|
7
|
+
// import { ApplicationInsights } from '@microsoft/applicationinsights-web'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
Example configuration for monitoring plugin
|
|
12
|
+
|
|
13
|
+
"monitoring": {
|
|
14
|
+
"active": true, // this is the default, so not needed but here for clarification
|
|
15
|
+
"monitorLocalhost": true, // this is false by default
|
|
16
|
+
"trackjs": {
|
|
17
|
+
"token": "a15a776ef76c4b91bd40a8d34c2bf30a",
|
|
18
|
+
"application": "locusmol"
|
|
19
|
+
},
|
|
20
|
+
"applicationInsights": {
|
|
21
|
+
// nothing here for now - do we want to include connectionString, disableAjaxTracking and disableFetchTracking ?
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const PKG_VERSION = _package.default.version;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* This is a non-standard plugin lifecycle function - created just for the monitoring so that we could "activate" (load) 3rd party monitoring
|
|
30
|
+
* libraries as early in the application setup as possible - so this activate function is called from within app.js before the usual looping
|
|
31
|
+
* through the plugin list and calling create.
|
|
32
|
+
*
|
|
33
|
+
* For both the current monitoring options (trackjs / applictaionInsights) there are bus messages to listen for, and that can't happen until
|
|
34
|
+
* the create method - so that is why setup for these monitors is spread between activate (happens first) and create (happens later).
|
|
35
|
+
*
|
|
36
|
+
* @param {object} config The monitoring configuration object (see above for an example)
|
|
37
|
+
*/
|
|
38
|
+
async function activate(config) {
|
|
39
|
+
if (
|
|
40
|
+
location.host.includes('localhost') &&
|
|
41
|
+
!config.monitorLocalhost
|
|
42
|
+
) // we don't usually want to include TrackJS in local development
|
|
43
|
+
{
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (
|
|
48
|
+
config.active !== undefined &&
|
|
49
|
+
!config.active
|
|
50
|
+
) // standard webEngine plugin config allows us to de-activate by setting active: false
|
|
51
|
+
{
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (config.trackjs) {
|
|
56
|
+
await activateTrackJS(config.trackjs);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (config.applicationInsights) {
|
|
60
|
+
await activateApplicationInsights();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const activateTrackJS = async config => {
|
|
65
|
+
trackjs.TrackJS.install({ ...config, version: PKG_VERSION });
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
let appInsights; // this gets defined here, but used later in finalizeSetupApplicationInsights
|
|
69
|
+
const activateApplicationInsights = async () => {
|
|
70
|
+
// See https://ablcode.visualstudio.com/Atrius/_wiki/wikis/Wayfinder%20Webengine/86142/application-insights
|
|
71
|
+
return process.env.APP_INSIGHTS
|
|
72
|
+
? import('@microsoft/applicationinsights-web').then(({ ApplicationInsights }) => {
|
|
73
|
+
appInsights = new ApplicationInsights({
|
|
74
|
+
config: {
|
|
75
|
+
connectionString: process.env.APP_INSIGHTS,
|
|
76
|
+
disableAjaxTracking: true,
|
|
77
|
+
disableFetchTracking: true,
|
|
78
|
+
disableCookiesUsage: true, // older versions of app insights used to have this option, but it is now deprecated
|
|
79
|
+
cookieCfg: {
|
|
80
|
+
enabled: false, // disable cookie usage per EU GDPR requirements
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
appInsights.loadAppInsights();
|
|
85
|
+
})
|
|
86
|
+
: null;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
function create(app, config) {
|
|
90
|
+
if (
|
|
91
|
+
location.host.includes('localhost') &&
|
|
92
|
+
!config.monitorLocalhost
|
|
93
|
+
) // we don't usually want to include monitoring in local development
|
|
94
|
+
{
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (config.trackjs) {
|
|
99
|
+
finalizeSetupTrackjs(app);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (config.applicationInsights) {
|
|
103
|
+
finalizeSetupApplicationInsights(app);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
init: () => {}, // noop
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function finalizeSetupTrackjs(app) {
|
|
112
|
+
// set environment metadata
|
|
113
|
+
if (location.host.includes('apps.locuslabs')) {
|
|
114
|
+
if (location.pathname.includes('Commit')) {
|
|
115
|
+
trackjs.TrackJS.addMetadata('env', 'commit');
|
|
116
|
+
} else {
|
|
117
|
+
trackjs.TrackJS.addMetadata('env', 'staging');
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
trackjs.TrackJS.addMetadata('env', 'production');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
app.bus.on('venueData/venueDataLoaded', ({ venueData }) => {
|
|
124
|
+
trackjs.TrackJS.addMetadata('venueId', venueData.id);
|
|
125
|
+
trackjs.TrackJS.addMetadata('assetStage', venueData.assetStage);
|
|
126
|
+
trackjs.TrackJS.addMetadata('venueAssetVersion', venueData.version);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
app.bus.on('kioskAdmin/kioskLocationChanged', ({ kioskLocation }) => {
|
|
130
|
+
trackjs.TrackJS.addMetadata('kioskLocation', kioskLocation);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function finalizeSetupApplicationInsights(app) {
|
|
135
|
+
if (process.env.APP_INSIGHTS) {
|
|
136
|
+
app.bus.on('appInsights/log', async log => {
|
|
137
|
+
const shortAccountId = await app.bus.get('venueData/getAccountId');
|
|
138
|
+
const parsedUserAgent = new UAParser().getResult();
|
|
139
|
+
|
|
140
|
+
appInsights.trackEvent({
|
|
141
|
+
...log,
|
|
142
|
+
properties: {
|
|
143
|
+
url: window.location.href,
|
|
144
|
+
instanceName: app.config.name,
|
|
145
|
+
shortAccountId,
|
|
146
|
+
productVersion: app.info.wePkg.version,
|
|
147
|
+
deviceTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
148
|
+
deviceOSName: parsedUserAgent.os.name,
|
|
149
|
+
deviceOSVersion: parsedUserAgent.os.version,
|
|
150
|
+
uiLocale: app.i18n().language,
|
|
151
|
+
browserName: parsedUserAgent.browser.name,
|
|
152
|
+
browserVersion: parsedUserAgent.browser.version,
|
|
153
|
+
webConfigId: app.config.uuid,
|
|
154
|
+
location: typeof window !== 'undefined' ? window.location.origin : 'server',
|
|
155
|
+
...log.properties,
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
appInsights.flush();
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
exports.activate = activate;
|
|
164
|
+
exports.create = create;
|
|
@@ -25,7 +25,7 @@ function _interopNamespaceDefault(e) {
|
|
|
25
25
|
|
|
26
26
|
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
27
27
|
|
|
28
|
-
async function create(app
|
|
28
|
+
async function create(app) {
|
|
29
29
|
const log = app.log.sublog('poiDataManager');
|
|
30
30
|
const init = () => {
|
|
31
31
|
app.bus.send('venueData/loadPoiData');
|
|
@@ -163,7 +163,7 @@ function create(app, config) {
|
|
|
163
163
|
*/
|
|
164
164
|
app.bus.on('search/getDefaultSearchPois', async ({ limit = 5 } = {}) => {
|
|
165
165
|
const allPois = await app.bus.get('poi/getAll');
|
|
166
|
-
const navigablePred =
|
|
166
|
+
const navigablePred = val => val.isNavigable;
|
|
167
167
|
const navigablePois = R__namespace.pickBy(navigablePred, allPois);
|
|
168
168
|
return rand.arrayPick(Object.values(navigablePois), limit);
|
|
169
169
|
});
|
|
@@ -35,7 +35,7 @@ function createSuggestedKeywordsSearch(pois, lang) {
|
|
|
35
35
|
const poisKeywords = R.pipe(R.values, R.chain(R.prop('keywords')), R.filter(R.prop('isUserSearchable')), R.pluck('name'))(pois);
|
|
36
36
|
const allPotentialKeywords = [...categories, ...poisKeywords];
|
|
37
37
|
const keywords = Array.from(new Set([...allPotentialKeywords]));
|
|
38
|
-
const index = utils.getFlexSearchInstance({ lang
|
|
38
|
+
const index = utils.getFlexSearchInstance({ lang});
|
|
39
39
|
|
|
40
40
|
keywords.forEach((keyword, i) => index.add(i, keyword));
|
|
41
41
|
|
|
@@ -5,7 +5,7 @@ var simple = require('./flexsearchExports/simple.js');
|
|
|
5
5
|
|
|
6
6
|
const NON_ASCII_LANGUAGES = ['ko', 'ja', 'zh-Hans', 'zh-Hant'];
|
|
7
7
|
|
|
8
|
-
const getFlexSearchInstance = ({ lang
|
|
8
|
+
const getFlexSearchInstance = ({ lang }) => {
|
|
9
9
|
const options = {
|
|
10
10
|
tokenize: 'reverse',
|
|
11
11
|
rtl: lang === 'ar', // only for arabic
|
|
@@ -201,6 +201,7 @@ function embellishTilemapVenueData(venueData) {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
204
205
|
const between = (val, lim1, lim2) => (val > lim1 ? val <= lim2 : val => lim2);
|
|
205
206
|
|
|
206
207
|
// exchanges the first and second items in an array, preserving the rest of the array untouched
|
|
@@ -235,7 +235,7 @@ function findAllShortestPathsImpl(
|
|
|
235
235
|
return destinations.map(d => {
|
|
236
236
|
try {
|
|
237
237
|
return findShortestPath(start, d, nodes, nodesToAvoid, securityWaitTimes, securityLanesMap, options);
|
|
238
|
-
} catch
|
|
238
|
+
} catch {
|
|
239
239
|
return null;
|
|
240
240
|
}
|
|
241
241
|
});
|
|
@@ -389,7 +389,7 @@ function geohashSearch(floorId, geohash, geoDb, size) {
|
|
|
389
389
|
return nodes;
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
-
function findNodesByGeohash(floorId, geohash, geoDb
|
|
392
|
+
function findNodesByGeohash(floorId, geohash, geoDb) {
|
|
393
393
|
let foundNodes = geohashSearch(floorId, geohash, geoDb, 8);
|
|
394
394
|
if (foundNodes.length > 0) {
|
|
395
395
|
return foundNodes;
|
package/dist/cjs/src/app.js
CHANGED
|
@@ -34,10 +34,12 @@ async function setupPlugin(app, id, config) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
return import(`../plugins/${id}/src/${name}.js`)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
return import(`../plugins/${id}/src/${name}.js`)
|
|
38
|
+
.catch(() => import(`../plugins/${id}/src/${name}.js`))
|
|
39
|
+
.then(pluginModule => {
|
|
40
|
+
app.log.info(`Creating plugin ${id}`);
|
|
41
|
+
return pluginModule.create(app, config);
|
|
42
|
+
});
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
// takes the `lang` query parameter and returns the most specific supported language
|
|
@@ -115,7 +117,7 @@ async function create(rawConfig) {
|
|
|
115
117
|
|
|
116
118
|
// this handles error reporting, so we want it activated ASAP
|
|
117
119
|
if (config.plugins.monitoring) {
|
|
118
|
-
await Promise.resolve().then(function () { return
|
|
120
|
+
await Promise.resolve().then(function () { return require('../plugins/monitoring/src/monitoring.js'); }).then(mon => mon.activate(config.plugins.monitoring));
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
config = await handleConfigPostProcess(config);
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="web-engine",t="3.3.
|
|
1
|
+
var e="web-engine",t="3.3.871",s="UNLICENSED",r="module",o="src/main.js",i=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],a={"build-storybook":"storybook build",colors:"cat utils/colors1.txt && node utils/processColors.js | pbcopy && cat utils/colors2.txt",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","icons:convert":"node scripts/convertSvgToJsx.mjs",lint:"eslint . --ext .js,.jsx,.ts,.tsx",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",storybook:"storybook dev -p 6006",test:"vitest run --project unit","test-watch":"vitest --watch","test:comp":"vitest run --project browser","test:comp:ci":"vitest run --project browser --reporter=dot","test:comp:ui":"VITE_COMP_UI=1 vitest --project browser --ui --browser.headless=false","test:all":"yarn lint && yarn format:check && yarn test && yarn playwright:ci","test:mod":"playwright test --config=playwright.mod.config.ts",typecheck:"tsc -p tsconfig.checkjs.json"},l=["defaults"],n={"@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":"^5.2.0","@zumer/snapdom":"^2.9.0","axe-core":"^4.10.3",browserslist:"^4.27.0","crypto-browserify":"^3.12.1",dompurify:"^3.3.3","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^26.0.0","i18next-browser-languagedetector":"^6.1.1",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^2.9.2","node-polyfill-webpack-plugin":"^4.1.0","path-browserify":"^1.0.1",pmtiles:"^4.4.0","prop-types":"^15.8.1","qrcode.react":"^4.2.0",ramda:"^0.30.1",react:"^19.2.4","react-compound-slider":"^3.4.0","react-dom":"^19.2.4","react-json-editor-ajrm":"^2.5.14","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.46.8","@axe-core/playwright":"^4.10.2","@azure/identity":"^4.13.0","@azure/playwright":"^1.0.0","@percy/cli":"^1.31.11","@percy/playwright":"^1.1.0","@playwright/test":"^1.59.1","@storybook/addon-essentials":"^8.6.15","@storybook/blocks":"^8.6.15","@storybook/react":"^8.6.15","@storybook/react-vite":"^8.6.15","@testing-library/dom":"^10.4.1","@testing-library/jest-dom":"^6.6.3","@testing-library/react":"^16.3.0","@testing-library/user-event":"^14.5.2","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","@vitest/browser":"4.1.6","@vitest/browser-playwright":"4.1.6","@vitest/ui":"4.1.6","chai-colors":"^1.0.1","css-loader":"^7.1.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-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","eslint-plugin-vitest":"^0.5.4","fetch-mock":"^12.6.0",glob:"^11.0.1",husky:"^9.1.7","lint-staged":"^16.4.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.8.3","start-server-and-test":"^2.0.11",storybook:"^8.6.15",typescript:"^5.8.2",vite:"^7.3.2",vitest:"^4.1.8","webpack-merge":"^6.0.1"},d="yarn@4.13.0",p={node:"24.x"},y={},u={name:e,version:t,private:!0,license:s,type:r,main:o,workspaces:i,scripts:a,"lint-staged":{"*.js":["eslint --fix","prettier --check"],"*.{json,md,css,ts,tsx,jsx}":["prettier --check"],"src/i18n/**/*.json":["node utils/sort-json.js","prettier --write"]},browserslist:l,dependencies:n,devDependencies:c,packageManager:d,engines:p,nx:y};export{l as browserslist,u as default,n as dependencies,c as devDependencies,p as engines,s as license,o as main,e as name,y as nx,d as packageManager,a as scripts,r as type,t as version,i as workspaces};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../../../src/extModules/flexapi/src/index.js";function t(t
|
|
1
|
+
import e from"../../../src/extModules/flexapi/src/index.js";function t(t){const n=e();return t.bus.on("clientAPI/registerCommand",e=>n.registerCommand(e,e=>t.bus.get(`clientAPI/${e.command}`,e))),t.bus.on("clientAPI/registerCustomType",({name:e,spec:t})=>n.registerCustomType(e,t)),t.bus.on("clientAPI/execute",e=>n.execute(e)),{init:()=>{}}}export{t as create};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{TrackJS as o}from"trackjs";import e from"ua-parser-js";import a from"../../../package.json.js";const n=a.version;async function t(o){location.host.includes("localhost")&&!o.monitorLocalhost||(void 0===o.active||o.active)&&(o.trackjs&&await i(o.trackjs),o.applicationInsights&&await c())}const i=async e=>{o.install({...e,version:n})};let s;const c=async()=>process.env.APP_INSIGHTS?import("@microsoft/applicationinsights-web").then(({ApplicationInsights:o})=>{s=new o({config:{connectionString:process.env.APP_INSIGHTS,disableAjaxTracking:!0,disableFetchTracking:!0,disableCookiesUsage:!0,cookieCfg:{enabled:!1}}}),s.loadAppInsights()}):null;function r(a,n){if(!location.host.includes("localhost")||n.monitorLocalhost)return n.trackjs&&function(e){location.host.includes("apps.locuslabs")?location.pathname.includes("Commit")?o.addMetadata("env","commit"):o.addMetadata("env","staging"):o.addMetadata("env","production");e.bus.on("venueData/venueDataLoaded",({venueData:e})=>{o.addMetadata("venueId",e.id),o.addMetadata("assetStage",e.assetStage),o.addMetadata("venueAssetVersion",e.version)}),e.bus.on("kioskAdmin/kioskLocationChanged",({kioskLocation:e})=>{o.addMetadata("kioskLocation",e)})}(a),n.applicationInsights&&function(o){process.env.APP_INSIGHTS&&o.bus.on("appInsights/log",async a=>{const n=await o.bus.get("venueData/getAccountId"),t=(new e).getResult();s.trackEvent({...a,properties:{url:window.location.href,instanceName:o.config.name,shortAccountId:n,productVersion:o.info.wePkg.version,deviceTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,deviceOSName:t.os.name,deviceOSVersion:t.os.version,uiLocale:o.i18n().language,browserName:t.browser.name,browserVersion:t.browser.version,webConfigId:o.config.uuid,location:"undefined"!=typeof window?window.location.origin:"server",...a.properties}}),s.flush()})}(a),{init:()=>{}}}export{t as activate,r as create};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"ramda";import o from"zousan";import{buildStructuresLookup as t}from"../../../src/utils/buildStructureLookup.js";import{debugIsTrue as i}from"../../../src/utils/configUtils.js";import{toLang as a}from"../../../src/utils/i18n.js";async function n(a
|
|
1
|
+
import*as e from"ramda";import o from"zousan";import{buildStructuresLookup as t}from"../../../src/utils/buildStructureLookup.js";import{debugIsTrue as i}from"../../../src/utils/configUtils.js";import{toLang as a}from"../../../src/utils/i18n.js";async function n(a){const n=a.log.sublog("poiDataManager"),u=()=>{a.bus.send("venueData/loadPoiData")};let l=new o;const p=(e,o)=>{const{position:t}=e,i=o.floorIdToStructure(t.floorId);if(!i)return n.error(`No structure found for floorId: ${t.floorId} for POI ${e.poiId}`),{...e};const a=o.floorIdToFloor(t.floorId),r={...t,structureName:i.name,buildingId:i.id,floorName:a.name,floorOrdinal:a.ordinal};return{...e,position:r}},d=(e,o)=>{e.roomInfo||(e.roomInfo=[]),e.roomInfo.push(o)},c=e.pipe(e.propOr([],"externalIds"),e.find(e.propEq("roomId","type")),e.prop("id"),e.unless(e.isNil,e.tail));a.bus.on("venueData/poiDataLoaded",async({pois:o,structures:r})=>{if(o=((o,t)=>e.pipe(e.values,e.map(e=>{e.distance=null,e.isNavigable=void 0===e.isNavigable||!0===e.isNavigable,e.capacity&&d(e,{name:`Seats ${e.capacity.join("-")}`,svgId:"number-of-seats"}),e.category.startsWith("meeting")&&d(e,{name:a.gt()("poiView:Conference Room"),svgId:"conference-room"});const o=c(e);return o&&(e.roomId=o),[e.poiId,p(e,t)]}),e.fromPairs)(o))(o,t(r)),i(a,"pseudoTransPois"))for(const e in o)o[e]=s(o[e],a.i18n().language);o=function(e){const o=[];return Object.values(e).forEach(e=>{try{const t=e.position;t?["buildingId","structureName","floorId","floorName","floorOrdinal","latitude","longitude"].forEach(i=>{null!==t[i]&&void 0!==t[i]||o.push({id:e.poiId,e:`invalid position property: ${i}: ${t[i]}`})}):o.push({poi:e,e:"No position information"})}catch(t){n.error(t),o.push({id:e.poiId,e:t.message})}}),o.length&&(n.warn("badPois:",o),o.forEach(o=>{delete e[o.id]})),e}(o),await async function(e){for(const o of Object.values(e))await h(o);return e}(o),l.resolve(o),a.config.debug&&a.env.isBrowser&&(window._pois=o),a.config.debug&&async function(e){const o=Date.now(),t=[],i=await a.bus.get("wayfinder/_getNavGraph");Object.values(e).forEach(e=>{try{const o=e.position;i.findClosestNode(o.floorId,o.latitude,o.longitude)||t.push({id:e.poiId,e:"No closest Navgraph Node"})}catch(o){n.error(o),t.push({id:e.poiId,e:o.message})}}),t.length&&n.warn("badPois:",t),n(`Total time for navgraph POI check: ${Date.now()-o}ms`)}(o)}),a.bus.on("poi/getById",async({id:e})=>l.then(o=>o[e])),a.bus.on("poi/getByFloorId",async({floorId:o})=>l.then(e.pickBy(e.pathEq(o,["position","floorId"])))),a.bus.on("poi/getByCategoryId",async({categoryId:o})=>l.then(e.pickBy(e=>e.category===o||e.category.startsWith(o+".")))),a.bus.on("poi/getAll",async()=>l);const m=["queue","primaryQueueId"],g=(o,t,i)=>{const a=e.path(["queue","queueType"],t);if(!a)return null;const n=o[a],r=e.path(m,t);return i.filter(e.pathEq(r,m)).filter(e=>e.poiId!==t.poiId).map(o=>{const t=e.path(["queue","queueSubtype"],o),i=f(t)(n);return{poiId:o.poiId,...i}})},f=o=>{return e.pipe(e.find(e.propEq(o,"id")),(t=`No queue found with ID: ${o}`,e=>{if(null!=e)return e;throw Error(t)}),e.pick(["displayText","imageId"]));var t};a.bus.on("poi/addOtherSecurityLanes",({poi:o})=>(async o=>{if(!e.path(m,o))return o;const t=await a.bus.get("venueData/getQueueTypes"),i=await a.bus.get("poi/getByCategoryId",{categoryId:"security"}),n=Object.values(i);return o.queue.otherQueues=g(t,o,n),o})(o));const y=e=>!!e?.startsWith("https:");async function h(t){if(!t)return;const i="undefined"==typeof window?1:window.devicePixelRatio||1,n=`${Math.round(351*i)}x${Math.round(197*i)}`;return e.length(t.images)?y(t.images[0])||(t.images=await o.all(t.images.map(e=>a.bus.get("venueData/getPoiImageUrl",{imageName:e,size:n})))):t.images=[],e.length(t.fullImages)?y(t.fullImages[0]?.url)||(t.fullImages=await o.all(t.fullImages.map(async({url:e,...o})=>({url:await a.bus.get("venueData/getPoiImageUrl",{imageName:e,size:n}),...o})))):t.fullImages=[],t}const I=e.memoizeWith(e.identity,e.pipe(e.pluck("category"),e.values,e.uniq));a.bus.on("poi/getAllCategories",async()=>l.then(I)),a.bus.on("venueData/loadNewVenue",()=>{l=new o,u()}),a.bus.on("poi/setDynamicData",({plugin:o,idValuesMap:t})=>{l.then(i=>{for(const a in t){const n=i[a].dynamicData||{};n[o]={...t[a]};const r=e.mergeRight(i[a],{dynamicData:n});i[a]=r}})}),a.bus.on("poi/setCoreAttributes",e=>{l.then(o=>{for(const t in e)r(o,t,e[t])})});return{init:u,runTest:async e=>(await e(),l),internal:{addImages:h,pseudoTransPoi:s,applyCorePoiAttributes:r}}}function r(o,t,i){if(!o[t])return;const{name:a}=i;null===a?o[t]=e.mergeRight(o[t],{name:o[t]._originalName??o[t].name}):(o[t]._originalName||(o[t]=e.mergeRight(o[t],{_originalName:o[t].name})),o[t]=e.mergeRight(o[t],{name:a}))}function s(e,o){return["description","nearbyLandmark","name","phone","operationHours"].forEach(t=>{e[t]&&(e[t]=a(e[t],o))}),e.keywords&&(e.keywords=e.keywords.map(e=>(e.name=a(e.name,o),e))),e.position.floorName&&(e.position.floorName=a(e.position.floorName,o)),e.position.structureName&&(e.position.structureName=a(e.position.structureName,o)),e}export{n as create};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{throttle as e}from"throttle-debounce";import{getStructureAndFloorAtPoint as o}from"../../../src/utils/geom.js";import t from"../../../src/utils/observable.js";import{headlessCommands as n,handleHeadless as s}from"./sdkHeadless.js";let a=null;function r(e,o){return"null"===e?"null-origin":e===o?"same-origin":"cross-origin"}function i(e,{messageType:o,senderOrigin:t,command:n,iframeOrigin:s}){e.send("appInsights/log",{name:"browserMessageObserved",properties:{command:n,deploymentHost:window.location.host,iframeOrigin:s,messageType:o,relation:r(t,s),senderOrigin:t,wouldRejectCrossOrigin:!l(t,s)}})}function l(e,o){return e===o}function d(e){const o=(e,o)=>{const t={payload:e,type:"LL-server"};o&&(t.clientMsgId=o);try{window.postMessage(t,"*")}catch
|
|
1
|
+
import{throttle as e}from"throttle-debounce";import{getStructureAndFloorAtPoint as o}from"../../../src/utils/geom.js";import t from"../../../src/utils/observable.js";import{headlessCommands as n,handleHeadless as s}from"./sdkHeadless.js";let a=null;function r(e,o){return"null"===e?"null-origin":e===o?"same-origin":"cross-origin"}function i(e,{messageType:o,senderOrigin:t,command:n,iframeOrigin:s}){e.send("appInsights/log",{name:"browserMessageObserved",properties:{command:n,deploymentHost:window.location.host,iframeOrigin:s,messageType:o,relation:r(t,s),senderOrigin:t,wouldRejectCrossOrigin:!l(t,s)}})}function l(e,o){return e===o}function d(e){const o=(e,o)=>{const t={payload:e,type:"LL-server"};o&&(t.clientMsgId=o);try{window.postMessage(t,"*")}catch{window.postMessage((e=>JSON.parse(JSON.stringify(e)))(t),"*")}};function t(t){const n=t.data;if(n&&"LL-client"===n.type){const s=window.location.origin;if(i(e.bus,{messageType:"LL-client",senderOrigin:t.origin,command:n.payload?.command,iframeOrigin:s}),!l(t.origin,s))return;e.bus.get("clientAPI/execute",n.payload).then(e=>o(e,n.msgId)).catch(o=>{e.config.debug&&console.error(o),((e,o)=>{const t={error:!0,payload:e,type:"LL-server"};o&&(t.clientMsgId=o),window.postMessage(t,"*")})(o.message,n.msgId)})}}return a&&a(),window.addEventListener("message",t),a=()=>window.removeEventListener("message",t),(e,o)=>{const t={event:e,payload:o,type:"LL-server"};window.postMessage(t,"*")}}async function m(a,r){const i=a.env.isBrowser?d(a):function(e){const o=t();return e.eventListener=o,(e,t)=>o.fire(e,t)}(a);return function(t,n){t.bus.monitor("map/userMoveStart",async({pitch:e,zoom:o,bearing:s})=>{const{lat:a,lng:r,floorId:i,ordinal:l,structureId:d}=await t.bus.get("map/getMapCenter");n("userMoveStart",{lat:a,lng:r,floorId:i,ord:l,structureId:d,pitch:e,zoom:o,bearing:s})}),t.bus.monitor("map/userMoving",e(500,async({pitch:e,zoom:o,bearing:s})=>{const{lat:a,lng:r,floorId:i,ordinal:l,structureId:d}=await t.bus.get("map/getMapCenter");n("userMoving",{lat:a,lng:r,floorId:i,ord:l,structureId:d,pitch:e,zoom:o,bearing:s})})),t.bus.monitor("map/moveEnd",async({pitch:e,zoom:o,bearing:s})=>{const{lat:a,lng:r,floorId:i,ordinal:l,structureId:d}=await t.bus.get("map/getMapCenter");n("moveEnd",{lat:a,lng:r,floorId:i,ord:l,structureId:d,pitch:e,zoom:o,bearing:s})}),t.bus.monitor("map/floorChanged",({structure:e,floor:o})=>n("levelChange",{floorId:o?o.id:null,floorName:o?o.name:null,ord:o?o.ordinal:null,structureId:e?e.id:null,structureName:e?e.name:null})),t.bus.monitor("map/poiClicked",({poi:e})=>n("poiSelected",e)),t.bus.monitor("poiDetails/showPoi",({poi:e})=>n("poiShown",e)),t.bus.monitor("map/click",async({lat:e,lng:s,ord:a})=>{const r=await t.bus.get("venueData/getStructures"),i=await t.bus.get("map/getViewBBox"),{building:l,floor:d}=o(r,e,s,a,i,!0);n("mapClicked",{lat:e,lng:s,ord:a,building:l,floor:d})})}(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),n.forEach(e=>a.bus.send("clientAPI/registerCommand",e)),s(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,...o})=>i(e,o))}}}export{m as create,r as describeMessageRelation,l as isSameOriginBrowserMessage,i as logBrowserMessageTelemetry};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"ramda";import r from"zousan";import{getLocalized as a}from"../../../src/utils/configUtils.js";import{randomizeArray as s,arrayPick as t}from"../../../src/utils/rand.js";import n from"./poiSearch.js";import o from"./searchTypeahead.js";function i(i,c){const u={poiSearch:null,typeahead:null,indexesCreated:new r,defaultSearchTerms:null,specialQueryTerms:{}},d=async()=>{const e=await i.bus.get("poi/getAll");u.poiSearch=n(e,i.i18n().language),u.typeahead=o(e,u.poiSearch.search,i.i18n().language),u.defaultSearchTerms=a(c,"defaultSearchTerms",i.i18n().language),u.indexesCreated.resolve()};async function y(){const r=await i.bus.getFirst("user/getPhysicalLocation");if(!r?.floorId)return[];const a=await i.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 i.bus.get("wayfinder/addPathTimeMultiple",{pois:s,startLocation:r});return e.sortBy(e.prop("distance"),Object.values(t)).slice(0,50)}i.bus.on("search/queryNearby",async()=>{const e=await y();return i.bus.send("search/showNearby",{pois:e,term:"Nearby"}),e}),i.bus.on("search/queryNearbyAsync",y),i.bus.on("search/queryCategory",async({category:e,categoryName:r,searchTerm:a})=>{const s=await u.indexesCreated.then(()=>u.poiSearch.search({query:a||e}));return i.bus.send("search/showCategory",{pois:s,category:e,categoryName:r}),s}),i.bus.on("search/query",({term:e})=>u.indexesCreated.then(()=>{const r=u.poiSearch.search({query:e});return i.bus.send("search/showSearchResults",{results:r,term:e}),r})),i.bus.on("search/queryAsync",({term:e})=>u.indexesCreated.then(()=>u.poiSearch.search({query:e}))),i.bus.on("search/queryWithSpecial",({term:e})=>{if(u.specialQueryTerms[e]){const{event:r,params:a}=u.specialQueryTerms[e];return i.bus.send(r,a)}return i.bus.get("search/query",{term:e})}),i.bus.on("search/getDefaultSearchTerms",async({limit:e=5}={})=>{const r=u.defaultSearchTerms,a=r&&r.length?r:await async function(e){const r=(await i.bus.send("poi/getAllCategories"))[0],a=Array.from(new Set(r));return s(a).slice(0,e)}(e);return i.bus.send("search/showDefaultSearchKeywords",{keywords:a}),a}),i.bus.on("search/getDefaultSearchPois",async({limit:r=5}={})=>{const a=await i.bus.get("poi/getAll"),s=e.pickBy(
|
|
1
|
+
import*as e from"ramda";import r from"zousan";import{getLocalized as a}from"../../../src/utils/configUtils.js";import{randomizeArray as s,arrayPick as t}from"../../../src/utils/rand.js";import n from"./poiSearch.js";import o from"./searchTypeahead.js";function i(i,c){const u={poiSearch:null,typeahead:null,indexesCreated:new r,defaultSearchTerms:null,specialQueryTerms:{}},d=async()=>{const e=await i.bus.get("poi/getAll");u.poiSearch=n(e,i.i18n().language),u.typeahead=o(e,u.poiSearch.search,i.i18n().language),u.defaultSearchTerms=a(c,"defaultSearchTerms",i.i18n().language),u.indexesCreated.resolve()};async function y(){const r=await i.bus.getFirst("user/getPhysicalLocation");if(!r?.floorId)return[];const a=await i.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 i.bus.get("wayfinder/addPathTimeMultiple",{pois:s,startLocation:r});return e.sortBy(e.prop("distance"),Object.values(t)).slice(0,50)}i.bus.on("search/queryNearby",async()=>{const e=await y();return i.bus.send("search/showNearby",{pois:e,term:"Nearby"}),e}),i.bus.on("search/queryNearbyAsync",y),i.bus.on("search/queryCategory",async({category:e,categoryName:r,searchTerm:a})=>{const s=await u.indexesCreated.then(()=>u.poiSearch.search({query:a||e}));return i.bus.send("search/showCategory",{pois:s,category:e,categoryName:r}),s}),i.bus.on("search/query",({term:e})=>u.indexesCreated.then(()=>{const r=u.poiSearch.search({query:e});return i.bus.send("search/showSearchResults",{results:r,term:e}),r})),i.bus.on("search/queryAsync",({term:e})=>u.indexesCreated.then(()=>u.poiSearch.search({query:e}))),i.bus.on("search/queryWithSpecial",({term:e})=>{if(u.specialQueryTerms[e]){const{event:r,params:a}=u.specialQueryTerms[e];return i.bus.send(r,a)}return i.bus.get("search/query",{term:e})}),i.bus.on("search/getDefaultSearchTerms",async({limit:e=5}={})=>{const r=u.defaultSearchTerms,a=r&&r.length?r:await async function(e){const r=(await i.bus.send("poi/getAllCategories"))[0],a=Array.from(new Set(r));return s(a).slice(0,e)}(e);return i.bus.send("search/showDefaultSearchKeywords",{keywords:a}),a}),i.bus.on("search/getDefaultSearchPois",async({limit:r=5}={})=>{const a=await i.bus.get("poi/getAll"),s=e.pickBy(e=>e.isNavigable,a);return t(Object.values(s),r)}),i.bus.on("search/registerSpecialQuery",({term:e,event:r,params:a,addKeyword:s=!0})=>{u.indexesCreated.then(()=>{s&&u.typeahead.addKeyword(e),u.specialQueryTerms[e]={event:r,params:a}})}),i.bus.on("search/addKeywords",({keywords:e})=>u.indexesCreated.then(()=>e.forEach(e=>u.typeahead.addKeyword(e)))),i.bus.on("search/typeahead",({term:e,limit:r})=>u.indexesCreated.then(()=>{const{keywords:a,pois:s}=u.typeahead.query(e,r);return{keywords:a,pois:s,term:e}})),i.bus.on("venueData/loadNewVenue",()=>{u.indexesCreated=new r,d()}),i.bus.on("poi/setDynamicData",async({plugin:e,idValuesMap:r})=>{if("grab"!==e)return;const a=Object.keys(r).map(e=>i.bus.get("poi/getById",{id:e}));return Promise.all(a).then(e=>u.indexesCreated.then(()=>u.poiSearch.updateMultiple(e)))});return{init:d,runTest:async(e,r)=>(await r(),u)}}export{i as create};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pipe as
|
|
1
|
+
import{pipe as r,values as e,chain as t,prop as a,filter as n,pluck as o}from"ramda";import{getFlexSearchInstance as i}from"./utils.js";function s(s,d,u){const c=function(s,d){const u=function(r){return Object.values(r).map(r=>r.category).map(r=>r.split(".")).map(r=>r[0])}(s),c=r(e,t(a("keywords")),n(a("isUserSearchable")),o("name"))(s),m=[...u,...c],l=Array.from(new Set([...m])),p=i({lang:d});l.forEach((r,e)=>p.add(e,r));return{search:r=>p.search(r).map(r=>l[r]),add:r=>{l.push(r),p.add(l.length-1,r)}}}(s,u);return{query:(r,e)=>{const t=c.search({query:r,limit:e}),a=!(r.length<3)&&t.length,n=e-t.length,o=a?function(r,e){const t=d({query:r,limit:e}),a=d({query:r,suggest:!0,limit:e}),n=t.map(r=>r.poiId),o=a.filter(r=>-1===n.indexOf(r.poiId));return t.concat(o)}(r,n):[];return{keywords:t,pois:o}},addKeyword:r=>{c.add(r)}}}export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"flexsearch";import{encode as r}from"./flexsearchExports/simple.js";const s=["ko","ja","zh-Hans","zh-Hant"],
|
|
1
|
+
import e from"flexsearch";import{encode as r}from"./flexsearchExports/simple.js";const s=["ko","ja","zh-Hans","zh-Hant"],n=({lang:n})=>{const o={tokenize:"reverse",rtl:"ar"===n,stemmer:{s:"",es:"",ies:"y"},encode:r};return s.includes(n)&&(o.tokenize="full"),new e.Index(o)};export{n as getFlexSearchInstance};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pick as t,isNil as o,map as n,omit as e,path as r}from"ramda";import{distance as i}from"../../../src/utils/geodesy.js";import{encode as s,calculateAdjacent as l}from"../../../src/extModules/geohasher.js";import u from"./minPriorityQueue.js";function d(r,i,l,u){const d={},c={},a=new Set;let h={};r.nodes.forEach(o=>{const n=i(o.floorId),e=l(o.floorId);!function(t){const o=t.floorId+":"+s(t.lat,t.lng).substr(0,7),n=t.floorId+":"+s(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
|
|
1
|
+
import{pick as t,isNil as o,map as n,omit as e,path as r}from"ramda";import{distance as i}from"../../../src/utils/geodesy.js";import{encode as s,calculateAdjacent as l}from"../../../src/extModules/geohasher.js";import u from"./minPriorityQueue.js";function d(r,i,l,u){const d={},c={},a=new Set;let h={};r.nodes.forEach(o=>{const n=i(o.floorId),e=l(o.floorId);!function(t){const o=t.floorId+":"+s(t.lat,t.lng).substr(0,7),n=t.floorId+":"+s(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{return null}})}(e,r,d,a,h,u,n):[]},floorIdToOrdinal:i,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 i(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+":"+l(l(r,"top"),"left")),i.push(t+":"+l(r,"top")),i.push(t+":"+l(l(r,"top"),"right")),i.push(t+":"+l(r,"left")),i.push(t+":"+r),i.push(t+":"+l(r,"right")),i.push(t+":"+l(l(r,"bottom"),"left")),i.push(t+":"+l(r,"bottom")),i.push(t+":"+l(l(r,"bottom"),"right"));const s=[];for(let t=0;t<i.length;t++){const o=n[i[t]];if(o)for(let t=0;t<o.length;t++)s.push(o[t])}return s}function w(t,o,n,e,r){const l=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,s(o,n),e)||function(t,o,n,e){const r=Object.values(e).filter(o=>o.floorId===t).map(t=>[t,i(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<l.length;t++){const e=i(o,n,l[t].lat,l[t].lng);u.push([l[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,i(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};
|
package/dist/src/app.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{map as e,mergeDeepRight as t}from"ramda";import n from"zousan-plus";import
|
|
1
|
+
import{map as e,mergeDeepRight as t}from"ramda";import n from"zousan-plus";import i from"./utils/i18n.js";import{startInitialStateListener as o}from"./utils/isInitialState.js";import a from"../package.json.js";import r from"./debugTools.js";import{buildEnv as s}from"./env.js";import{create as l}from"./extModules/bustle.js";import{initLog as u}from"./extModules/log.js";const c="undefined"!=typeof window;async function g(e,t,n){if(!n)return e.log.info(`Plugin ${t} explicitly disabled`),null;let i=t;if(i.includes("/")){const e=i.split("/");i=e[e.length-1]}return void 0!==n.active&&(!1===n.active||"notLocalhost"===n.active&&e.env.isLocalhost())?(e.log.info(`Plugin ${t} explicitly deativated`),null):import(`../plugins/${t}/src/${i}.js`).catch(()=>import(`../plugins/${t}/src/${i}.js`)).then(i=>(e.log.info(`Creating plugin ${t}`),i.create(e,n)))}async function p(e){return c?import(`./configs/${e}.json`):import(`./configs/${e}.json.js`)}async function d(e,n){let i={};const o=await Promise.all(n.map(p));for(const e of o){let n=e.default;n=n.extends?await d(n,n.extends):n,i=t(i,n)}return i=t(i,e),i}const m=e=>t=>import(`./configs/postproc-${e}.ts`).then(e=>e.process(t));async function f(t){const p=Object.create(null);let f=t.extends?await d(t,t.extends):t;f.plugins.monitoring&&await import("../plugins/monitoring/src/monitoring.js").then(e=>e.activate(f.plugins.monitoring)),f=await(async e=>e.configPostProc?n.series(e,...e.configPostProc.map(m)):e)(f);const h=(e=>{const t=e.supportedLanguages||["am","ar","de","el-GR","en","es","fr","hi","is","it","ja","ko","nl","pl","pt","ru","so","th","zh-Hans","zh-Hant"];if("undefined"!=typeof window){let e=new URLSearchParams(location.search).get("lang")||navigator.language;for(;e;){if(e&&t.includes(e))return e;e=e.substring(0,e.lastIndexOf("-"))}}return e.defaultLanguage||"en"})(f),w=await i(h,{debug:f.debug});p.i18n=()=>w,p.gt=()=>w.t.bind(w),p.config=f,p.plugins={};const y=u("web-engine",{enabled:!!f.debug,isBrowser:c,color:"cyan",logFilter:f.logFilter,truncateObjects:!c,trace:false});if(p.log=y.sublog(f.name),p.bus=l({showEvents:!0,reportAllErrors:!0,log:y}),p.info={wePkg:a},"undefined"!=typeof window&&(f.debug?(p.debug=e(e=>e.bind(p),r),r.dndGo.call(p)):p.debug={},window._app=p,window.document&&window.document.title&&f.setWindowTitle&&(document.title=f.name)),p.env=s(p),f.theme?await n.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:t,ThemeManagerModule:n})=>{const i=n.initThemeManager(p);p.themePack=await i.buildTheme(f.theme,f.defaultTheme),o(),e.initLayerManager(p),t.initHistoryManager(p),p.destroy=()=>e.destroy(p)}):p.destroy=()=>{},f.plugins){for(const e in f.plugins)try{const t=f.plugins[e];if(p.plugins[e])throw Error(`Duplicate plugin name "${e}"`);const n=await g(p,e,t);n&&(p.plugins[e]=n)}catch(t){y.error("Error instantiating plugin "+e),y.error(t)}for(const e in p.plugins)p.plugins[e].init()}return p}export{f as create};
|
package/package.json
CHANGED