atriusmaps-node-sdk 3.3.873 → 3.3.874
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/index.js +7 -0
- package/dist/cjs/plugins/dynamicPois/src/index.js +7 -0
- package/dist/cjs/plugins/flightStatus/src/index.js +7 -0
- package/dist/cjs/plugins/poiDataManager/src/index.js +7 -0
- package/dist/cjs/plugins/sdkServer/src/index.js +7 -0
- package/dist/cjs/plugins/searchService/src/index.js +7 -0
- package/dist/cjs/plugins/venueDataLoader/src/index.js +7 -0
- package/dist/cjs/plugins/wayfinder/src/index.js +7 -0
- package/dist/cjs/src/app.js +5 -13
- package/dist/package.json.js +1 -1
- package/dist/plugins/clientAPI/src/index.js +1 -0
- package/dist/plugins/dynamicPois/src/index.js +1 -0
- package/dist/plugins/flightStatus/src/index.js +1 -0
- package/dist/plugins/poiDataManager/src/index.js +1 -0
- package/dist/plugins/sdkServer/src/index.js +1 -0
- package/dist/plugins/searchService/src/index.js +1 -0
- package/dist/plugins/venueDataLoader/src/index.js +1 -0
- package/dist/plugins/wayfinder/src/index.js +1 -0
- package/dist/src/app.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/plugins/monitoring/src/monitoring.js +0 -164
- package/dist/plugins/monitoring/src/monitoring.js +0 -1
package/dist/cjs/package.json.js
CHANGED
package/dist/cjs/src/app.js
CHANGED
|
@@ -21,12 +21,6 @@ async function setupPlugin(app, id, config) {
|
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
let name = id;
|
|
25
|
-
if (name.includes('/')) {
|
|
26
|
-
const split = name.split('/');
|
|
27
|
-
name = split[split.length - 1];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
24
|
if (config.active !== undefined) {
|
|
31
25
|
if (config.active === false || (config.active === 'notLocalhost' && app.env.isLocalhost())) {
|
|
32
26
|
app.log.info(`Plugin ${id} explicitly deativated`);
|
|
@@ -34,12 +28,10 @@ async function setupPlugin(app, id, config) {
|
|
|
34
28
|
}
|
|
35
29
|
}
|
|
36
30
|
|
|
37
|
-
return import(`../plugins/${id}/src
|
|
38
|
-
.
|
|
39
|
-
.
|
|
40
|
-
|
|
41
|
-
return pluginModule.create(app, config);
|
|
42
|
-
});
|
|
31
|
+
return import(`../plugins/${id}/src/index.js`).then(pluginModule => {
|
|
32
|
+
app.log.info(`Creating plugin ${id}`);
|
|
33
|
+
return pluginModule.create(app, config);
|
|
34
|
+
});
|
|
43
35
|
}
|
|
44
36
|
|
|
45
37
|
// takes the `lang` query parameter and returns the most specific supported language
|
|
@@ -117,7 +109,7 @@ async function create(rawConfig) {
|
|
|
117
109
|
|
|
118
110
|
// this handles error reporting, so we want it activated ASAP
|
|
119
111
|
if (config.plugins.monitoring) {
|
|
120
|
-
await Promise.resolve().then(function () { return require('../
|
|
112
|
+
await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }).then(mon => mon.activate(config.plugins.monitoring));
|
|
121
113
|
}
|
|
122
114
|
|
|
123
115
|
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.874",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
|
+
export{create}from"./clientAPI.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{create}from"./dynamicPois.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{create}from"./flightStatus.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{create}from"./poiDataManager.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{create}from"./sdkServer.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{create}from"./searchService.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{create}from"./venueDataLoader.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{create}from"./wayfinder.js";
|
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 o from"./utils/i18n.js";import{startInitialStateListener as i}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){return n?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/index.js`).then(o=>(e.log.info(`Creating plugin ${t}`),o.create(e,n))):(e.log.info(`Plugin ${t} explicitly disabled`),null)}async function d(e){return c?import(`./configs/${e}.json`):import(`./configs/${e}.json.js`)}async function p(e,n){let o={};const i=await Promise.all(n.map(d));for(const e of i){let n=e.default;n=n.extends?await p(n,n.extends):n,o=t(o,n)}return o=t(o,e),o}const m=e=>t=>import(`./configs/postproc-${e}.ts`).then(e=>e.process(t));async function f(t){const d=Object.create(null);let f=t.extends?await p(t,t.extends):t;f.plugins.monitoring&&await import("../_virtual/_empty_module_placeholder.js").then(e=>e.activate(f.plugins.monitoring)),f=await(async e=>e.configPostProc?n.series(e,...e.configPostProc.map(m)):e)(f);const w=(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),h=await o(w,{debug:f.debug});d.i18n=()=>h,d.gt=()=>h.t.bind(h),d.config=f,d.plugins={};const y=u("web-engine",{enabled:!!f.debug,isBrowser:c,color:"cyan",logFilter:f.logFilter,truncateObjects:!c,trace:false});if(d.log=y.sublog(f.name),d.bus=l({showEvents:!0,reportAllErrors:!0,log:y}),d.info={wePkg:a},"undefined"!=typeof window&&(f.debug?(d.debug=e(e=>e.bind(d),r),r.dndGo.call(d)):d.debug={},window._app=d,window.document&&window.document.title&&f.setWindowTitle&&(document.title=f.name)),d.env=s(d),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 o=n.initThemeManager(d);d.themePack=await o.buildTheme(f.theme,f.defaultTheme),i(),e.initLayerManager(d),t.initHistoryManager(d),d.destroy=()=>e.destroy(d)}):d.destroy=()=>{},f.plugins){for(const e in f.plugins)try{const t=f.plugins[e];if(d.plugins[e])throw Error(`Duplicate plugin name "${e}"`);const n=await g(d,e,t);n&&(d.plugins[e]=n)}catch(t){y.error("Error instantiating plugin "+e),y.error(t)}for(const e in d.plugins)d.plugins[e].init()}return d}export{f as create};
|
package/package.json
CHANGED
|
@@ -1,164 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
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};
|