atriusmaps-node-sdk 3.3.870 → 3.3.872
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
CHANGED
|
@@ -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;
|
package/dist/cjs/src/app.js
CHANGED
|
@@ -117,7 +117,7 @@ async function create(rawConfig) {
|
|
|
117
117
|
|
|
118
118
|
// this handles error reporting, so we want it activated ASAP
|
|
119
119
|
if (config.plugins.monitoring) {
|
|
120
|
-
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));
|
|
121
121
|
}
|
|
122
122
|
|
|
123
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.872",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};
|
|
@@ -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};
|
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