atriusmaps-node-sdk 3.3.898 → 3.3.900

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.
Files changed (62) hide show
  1. package/dist/cjs/nodesdk/nodeEntry.js +36 -58
  2. package/dist/cjs/package.json.js +8 -4
  3. package/dist/cjs/plugins/clientAPI/src/clientAPI.js +8 -6
  4. package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +50 -142
  5. package/dist/cjs/plugins/dynamicPois/src/processors.js +31 -53
  6. package/dist/cjs/plugins/flightStatus/src/flightDetailsMapper.js +47 -116
  7. package/dist/cjs/plugins/flightStatus/src/flightStatus.js +48 -82
  8. package/dist/cjs/plugins/flightStatus/src/utils.js +4 -14
  9. package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +77 -154
  10. package/dist/cjs/plugins/sdkServer/src/prepareSDKConfig.js +45 -76
  11. package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +70 -79
  12. package/dist/cjs/plugins/sdkServer/src/sdkServer.js +97 -147
  13. package/dist/cjs/plugins/searchService/src/flexsearchExports/lang.js +16 -190
  14. package/dist/cjs/plugins/searchService/src/flexsearchExports/simple.js +28 -35
  15. package/dist/cjs/plugins/searchService/src/poiSearch.js +10 -21
  16. package/dist/cjs/plugins/searchService/src/searchService.js +45 -147
  17. package/dist/cjs/plugins/searchService/src/searchTypeahead.js +17 -28
  18. package/dist/cjs/plugins/searchService/src/utils.js +9 -13
  19. package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +148 -304
  20. package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +47 -126
  21. package/dist/cjs/plugins/wayfinder/src/findRoute.js +6 -73
  22. package/dist/cjs/plugins/wayfinder/src/minPriorityQueue.js +7 -27
  23. package/dist/cjs/plugins/wayfinder/src/navGraph.js +78 -259
  24. package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +26 -57
  25. package/dist/cjs/plugins/wayfinder/src/segmentBadges.js +25 -25
  26. package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +50 -133
  27. package/dist/cjs/plugins/wayfinder/src/segmentCategories.js +29 -29
  28. package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +53 -145
  29. package/dist/cjs/plugins/wayfinder/src/wayfinder.js +105 -349
  30. package/dist/cjs/src/app.js +53 -91
  31. package/dist/cjs/src/configs/postproc-mol-url-parms.js +34 -43
  32. package/dist/cjs/src/configs/postproc-stateTracking.js +1 -19
  33. package/dist/cjs/src/controller.js +4 -26
  34. package/dist/cjs/src/debugTools.js +55 -94
  35. package/dist/cjs/src/env.js +8 -19
  36. package/dist/cjs/src/extModules/bustle.js +15 -71
  37. package/dist/cjs/src/extModules/flexapi/src/help.js +7 -22
  38. package/dist/cjs/src/extModules/flexapi/src/index.js +15 -29
  39. package/dist/cjs/src/extModules/flexapi/src/validate.js +45 -93
  40. package/dist/cjs/src/extModules/geohasher.js +13 -31
  41. package/dist/cjs/src/extModules/log.js +18 -29
  42. package/dist/cjs/src/historyManager.js +4 -6
  43. package/dist/cjs/src/utils/bounds.js +2 -4
  44. package/dist/cjs/src/utils/buildStructureLookup.js +7 -7
  45. package/dist/cjs/src/utils/configUtils.js +7 -43
  46. package/dist/cjs/src/utils/date.js +5 -17
  47. package/dist/cjs/src/utils/distance.js +2 -2
  48. package/dist/cjs/src/utils/dom.js +9 -24
  49. package/dist/cjs/src/utils/funcs.js +15 -30
  50. package/dist/cjs/src/utils/geodesy.js +24 -39
  51. package/dist/cjs/src/utils/geom.js +32 -148
  52. package/dist/cjs/src/utils/i18n.js +39 -70
  53. package/dist/cjs/src/utils/isInitialState.js +7 -13
  54. package/dist/cjs/src/utils/location.js +10 -29
  55. package/dist/cjs/src/utils/observable.js +4 -29
  56. package/dist/cjs/src/utils/rand.js +9 -80
  57. package/dist/cjs/utils/constants.js +1 -1
  58. package/dist/package.json.js +1 -1
  59. package/dist/plugins/sdkServer/src/prepareSDKConfig.js +1 -1
  60. package/dist/src/utils/buildStructureLookup.js +1 -1
  61. package/dist/src/utils/date.js +1 -1
  62. package/package.json +1 -1
@@ -12,170 +12,134 @@ var log = require('./extModules/log.js');
12
12
 
13
13
  function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: null, default: e }); }
14
14
 
15
- const isBrowser = typeof window !== 'undefined';
15
+ const isBrowser = typeof window !== "undefined";
16
16
  const TRACE = false;
17
-
18
17
  async function setupPlugin(app, id, config) {
19
18
  if (!config) {
20
19
  app.log.info(`Plugin ${id} explicitly disabled`);
21
20
  return null;
22
21
  }
23
-
24
- if (config.active !== undefined) {
25
- if (config.active === false || (config.active === 'notLocalhost' && app.env.isLocalhost())) {
22
+ if (config.active !== void 0) {
23
+ if (config.active === false || config.active === "notLocalhost" && app.env.isLocalhost()) {
26
24
  app.log.info(`Plugin ${id} explicitly deativated`);
27
25
  return null;
28
26
  }
29
27
  }
30
-
31
- return import(`../plugins/${id}/src/index.js`).then(pluginModule => {
28
+ return import(`../plugins/${id}/src/index.js`).then((pluginModule) => {
32
29
  app.log.info(`Creating plugin ${id}`);
33
30
  return pluginModule.create(app, config);
34
31
  });
35
32
  }
36
-
37
- // takes the `lang` query parameter and returns the most specific supported language
38
- // Recognizes the following optional configuration parameters:
39
- // supportedLanguages : array of supported language strings. i.e. [ "en", "en-US", "fr", "ja" ]
40
- // defaultLanguage : if all fails, use this language. default = "en"
41
- const getLang = config => {
33
+ const getLang = (config) => {
42
34
  const supportedLanguages = config.supportedLanguages || [
43
- 'am',
44
- 'ar',
45
- 'de',
46
- 'el-GR',
47
- 'en',
48
- 'es',
49
- 'fr',
50
- 'hi',
51
- 'is',
52
- 'it',
53
- 'ja',
54
- 'ko',
55
- 'nl',
56
- 'pl',
57
- 'pt',
58
- 'ru',
59
- 'so',
60
- 'th',
61
- 'zh-Hans',
62
- 'zh-Hant',
35
+ "am",
36
+ "ar",
37
+ "de",
38
+ "el-GR",
39
+ "en",
40
+ "es",
41
+ "fr",
42
+ "hi",
43
+ "is",
44
+ "it",
45
+ "ja",
46
+ "ko",
47
+ "nl",
48
+ "pl",
49
+ "pt",
50
+ "ru",
51
+ "so",
52
+ "th",
53
+ "zh-Hans",
54
+ "zh-Hant"
63
55
  ];
64
-
65
- if (typeof window !== 'undefined') {
66
- // if this is a browser...
56
+ if (typeof window !== "undefined") {
67
57
  const queryParms = new URLSearchParams(location.search);
68
- // eslint-disable-next-line no-constant-condition
69
- let lang = queryParms.get('lang') || (typeof navigator ? navigator.language : null);
58
+ let lang = queryParms.get("lang") || (typeof navigator ? navigator.language : null);
70
59
  while (lang) {
71
60
  if (lang && supportedLanguages.includes(lang)) {
72
61
  return lang;
73
62
  } else {
74
- lang = lang.substring(0, lang.lastIndexOf('-'));
63
+ lang = lang.substring(0, lang.lastIndexOf("-"));
75
64
  }
76
65
  }
77
66
  }
78
-
79
- return config.defaultLanguage || 'en';
67
+ return config.defaultLanguage || "en";
80
68
  };
81
-
82
69
  async function loadConfig(name) {
83
- return isBrowser ? import(`./configs/${name}.json`) : import(`./configs/${name}.json.js`); // bit of a hack - but supports all versions of node. See https://gitlab.com/locuslabspublic/node-sdk/-/merge_requests/1
70
+ return isBrowser ? import(`./configs/${name}.json`) : import(`./configs/${name}.json.js`);
84
71
  }
85
-
86
72
  async function extendConfig(config, extendsConfigs) {
87
73
  let newConfig = {};
88
74
  const extConfigFiles = await Promise.all(extendsConfigs.map(loadConfig));
89
75
  for (const extendsConfigMod of extConfigFiles) {
90
76
  let extendsConfig = extendsConfigMod.default;
91
- extendsConfig = extendsConfig.extends ? await extendConfig(extendsConfig, extendsConfig.extends) : extendsConfig; // enable recursive extends
92
- newConfig = R.mergeDeepRight(newConfig, extendsConfig); // default is JSON data in ES6 modules import
77
+ extendsConfig = extendsConfig.extends ? await extendConfig(extendsConfig, extendsConfig.extends) : extendsConfig;
78
+ newConfig = R.mergeDeepRight(newConfig, extendsConfig);
93
79
  }
94
80
  newConfig = R.mergeDeepRight(newConfig, config);
95
81
  return newConfig;
96
82
  }
97
-
98
- // const isSimpleName = name => /^[-a-zA-Z0-9]+$/.test(name) // composed of only alphanumeric and dash
99
-
100
- const createPostProcessor = name => config => import(`./configs/postproc-${name}.ts`).then(pp => pp.process(config));
101
-
102
- const handleConfigPostProcess = async config =>
103
- config.configPostProc ? Zousan.series(config, ...config.configPostProc.map(createPostProcessor)) : config;
104
-
83
+ const createPostProcessor = (name) => (config) => import(`./configs/postproc-${name}.ts`).then((pp) => pp.process(config));
84
+ const handleConfigPostProcess = async (config) => config.configPostProc ? Zousan.series(config, ...config.configPostProc.map(createPostProcessor)) : config;
105
85
  async function create(rawConfig) {
106
- const appInstance = Object.create(null);
107
-
86
+ const appInstance = /* @__PURE__ */ Object.create(null);
108
87
  let config = rawConfig.extends ? await extendConfig(rawConfig, rawConfig.extends) : rawConfig;
109
-
110
- // this handles error reporting, so we want it activated ASAP
111
88
  if (config.plugins.monitoring) {
112
- await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }).then(mon => mon.activate(config.plugins.monitoring));
89
+ await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }).then((mon) => mon.activate(config.plugins.monitoring));
113
90
  }
114
-
115
91
  config = await handleConfigPostProcess(config);
116
-
117
92
  const lang = getLang(config);
118
93
  const i18n$1 = await i18n.default(lang, { debug: config.debug });
119
94
  appInstance.i18n = () => i18n$1;
120
- appInstance.gt = () => i18n$1.t.bind(i18n$1); // get translation function - don't hold this, it is bound to current lang
95
+ appInstance.gt = () => i18n$1.t.bind(i18n$1);
121
96
  appInstance.config = config;
122
-
123
97
  appInstance.plugins = {};
124
- const appLog = log.initLog('web-engine', {
98
+ const appLog = log.initLog("web-engine", {
125
99
  enabled: !!config.debug,
126
100
  isBrowser,
127
- color: 'cyan',
101
+ color: "cyan",
128
102
  logFilter: config.logFilter,
129
103
  truncateObjects: !isBrowser,
130
- trace: TRACE,
104
+ trace: TRACE
131
105
  });
132
-
133
106
  appInstance.log = appLog.sublog(config.name);
134
107
  appInstance.bus = bustle.create({
135
108
  showEvents: true,
136
109
  reportAllErrors: true,
137
- log: appLog,
110
+ log: appLog
138
111
  });
139
-
140
- appInstance.info = { wePkg: _package.default }; // web-engine package
141
-
142
- if (typeof window !== 'undefined') {
143
- // Prepare for non-browser environments
112
+ appInstance.info = { wePkg: _package.default };
113
+ if (typeof window !== "undefined") {
144
114
  if (config.debug) {
145
- appInstance.debug = R.map(fn => fn.bind(appInstance), debugTools);
146
- debugTools.dndGo.call(appInstance); // setup DnD by default...
115
+ appInstance.debug = R.map((fn) => fn.bind(appInstance), debugTools);
116
+ debugTools.dndGo.call(appInstance);
147
117
  } else {
148
118
  appInstance.debug = {};
149
- } // no tools unless in debug mode.. (good idea?)
150
-
119
+ }
151
120
  window._app = appInstance;
152
121
  if (window.document && window.document.title && config.setWindowTitle) {
153
122
  document.title = config.name;
154
123
  }
155
124
  }
156
-
157
125
  appInstance.env = env.buildEnv(appInstance);
158
-
159
126
  if (config.theme) {
160
- // the following is only needed when UI is active - which requires a theme
161
127
  await Zousan.evaluate(
162
- { name: 'ThemeManagerModule', value: Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }) },
163
- { name: 'HistoryManager', value: Promise.resolve().then(function () { return require('./historyManager.js'); }) },
164
- { name: 'LayerManager', value: Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }) },
128
+ { name: "ThemeManagerModule", value: Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }) },
129
+ { name: "HistoryManager", value: Promise.resolve().then(function () { return require('./historyManager.js'); }) },
130
+ { name: "LayerManager", value: Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }) }
165
131
  ).then(async ({ LayerManager, HistoryManager, ThemeManagerModule }) => {
166
132
  const ThemeManager = ThemeManagerModule.initThemeManager(appInstance);
167
133
  appInstance.themePack = await ThemeManager.buildTheme(config.theme, config.defaultTheme);
168
-
169
134
  isInitialState.startInitialStateListener();
170
135
  LayerManager.initLayerManager(appInstance);
171
136
  HistoryManager.initHistoryManager(appInstance);
172
-
173
137
  appInstance.destroy = () => LayerManager.destroy(appInstance);
174
138
  });
175
139
  } else {
176
- appInstance.destroy = () => {};
177
- } // noop
178
-
140
+ appInstance.destroy = () => {
141
+ };
142
+ }
179
143
  if (config.plugins) {
180
144
  for (const id in config.plugins) {
181
145
  try {
@@ -188,16 +152,14 @@ async function create(rawConfig) {
188
152
  appInstance.plugins[id] = plugin;
189
153
  }
190
154
  } catch (e) {
191
- appLog.error('Error instantiating plugin ' + id);
155
+ appLog.error("Error instantiating plugin " + id);
192
156
  appLog.error(e);
193
157
  }
194
158
  }
195
-
196
159
  for (const id in appInstance.plugins) {
197
160
  appInstance.plugins[id].init();
198
161
  }
199
162
  }
200
-
201
163
  return appInstance;
202
164
  }
203
165
 
@@ -1,55 +1,52 @@
1
1
  'use strict';
2
2
 
3
3
  const parmToPlugin = {
4
- navFrom: 'online/getDirectionsFromTo',
5
- navTo: 'online/getDirectionsFromTo',
6
- waypoints: 'online/getDirectionsFromTo',
7
- accessible: 'online/getDirectionsFromTo',
8
- showNav: 'online/getDirectionsFromTo',
9
- poiId: ['online/getDirectionsFromTo', 'online/poiView'],
10
- vid: 'venueDataLoader',
11
- stage: 'venueDataLoader',
12
- contentStage: 'venueDataLoader',
13
- accountId: 'venueDataLoader',
14
- search: 'online/headerOnline',
15
- ho: ['online/getDirectionsFromTo', 'analytics2'], // handoff indicator (used in analytics)
16
- home: 'online/homeView', // doing a handoff to home view
17
- zoom: 'mapRenderer',
18
- pitch: 'mapRenderer',
19
- bearing: 'mapRenderer',
20
- lat: 'mapRenderer',
21
- lng: 'mapRenderer',
22
- radius: 'mapRenderer',
23
- buildingId: 'mapRenderer',
24
- floorId: 'mapRenderer',
25
- visualTest: 'mapRenderer',
26
- refInstallId: 'analytics2',
27
- disableZoomToExplorePopup: 'levelIndicator',
4
+ navFrom: "online/getDirectionsFromTo",
5
+ navTo: "online/getDirectionsFromTo",
6
+ waypoints: "online/getDirectionsFromTo",
7
+ accessible: "online/getDirectionsFromTo",
8
+ showNav: "online/getDirectionsFromTo",
9
+ poiId: ["online/getDirectionsFromTo", "online/poiView"],
10
+ vid: "venueDataLoader",
11
+ stage: "venueDataLoader",
12
+ contentStage: "venueDataLoader",
13
+ accountId: "venueDataLoader",
14
+ search: "online/headerOnline",
15
+ ho: ["online/getDirectionsFromTo", "analytics2"],
16
+ // handoff indicator (used in analytics)
17
+ home: "online/homeView",
18
+ // doing a handoff to home view
19
+ zoom: "mapRenderer",
20
+ pitch: "mapRenderer",
21
+ bearing: "mapRenderer",
22
+ lat: "mapRenderer",
23
+ lng: "mapRenderer",
24
+ radius: "mapRenderer",
25
+ buildingId: "mapRenderer",
26
+ floorId: "mapRenderer",
27
+ visualTest: "mapRenderer",
28
+ refInstallId: "analytics2",
29
+ disableZoomToExplorePopup: "levelIndicator"
28
30
  };
29
-
30
- // Note: see note about security for forceCreate on postproc-stateTracking - same thing
31
- // applies here!
32
31
  function setDeepLinksForParms(config, parms, forceCreate) {
33
- // allow for lldebug on the URL to set debug mode. I made it "lldebug" just so it wasn't SO easy to guess. ;-)
34
- if (parms.has('lldebug')) {
32
+ if (parms.has("lldebug")) {
35
33
  try {
36
- config.debug = JSON.parse(parms.get('lldebug'));
37
- if (config.debug === null) // allow for a URL parm of just `lldebug` (no value = null)
38
- {
34
+ config.debug = JSON.parse(parms.get("lldebug"));
35
+ if (config.debug === null) {
39
36
  config.debug = {};
40
37
  }
41
38
  } catch {
42
39
  config.debug = true;
43
40
  }
44
41
  }
45
- Object.keys(parmToPlugin).forEach(key => {
42
+ Object.keys(parmToPlugin).forEach((key) => {
46
43
  if (parms.has(key)) {
47
44
  let plugins = parmToPlugin[key];
48
45
  if (!Array.isArray(plugins)) {
49
46
  plugins = [plugins];
50
47
  }
51
- plugins.forEach(plugin => {
52
- let pc = config.plugins[plugin]; // config for this plugin
48
+ plugins.forEach((plugin) => {
49
+ let pc = config.plugins[plugin];
53
50
  if (!pc && forceCreate) {
54
51
  pc = config.plugins[plugin] = {};
55
52
  }
@@ -57,15 +54,9 @@ function setDeepLinksForParms(config, parms, forceCreate) {
57
54
  });
58
55
  }
59
56
  });
60
-
61
- if (
62
- parms.has('poiId') &&
63
- parms.has('showNav')
64
- ) // poiId doubles as a parm for both - if showNav is defined, it should target getDirectionsFromTo only
65
- {
66
- delete config.plugins['online/poiView'].deepLinkProps.poiId;
57
+ if (parms.has("poiId") && parms.has("showNav")) {
58
+ delete config.plugins["online/poiView"].deepLinkProps.poiId;
67
59
  }
68
-
69
60
  return config;
70
61
  }
71
62
 
@@ -22,26 +22,9 @@ function _interopNamespaceDefault(e) {
22
22
 
23
23
  var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
24
24
 
25
- /**
26
- * Given a state string (JSON representation of latestState above) this will
27
- * update the app state (via calling all plugins with their state)
28
- *
29
- * Note: forceCreate is a potential security risk. It is used by the SDK BEFORE the extends
30
- * is processed, so needed here - but a user could prepare a stateString that included
31
- * some plugin they aren't supposed to have activated. Lets revisit this soon and
32
- * instead have a way to tell this postprocessor to look for state somewhere BESIDES
33
- * the location.search - then we can remove dangerous flag. (of course it would take someone
34
- * incredibly familiar with our source code to exploit this - and currently there is nothing
35
- * they could gain from it)
36
- * @param {Object} app App object created in App.js
37
- * @param {string} stateString stringified JSON object representing state
38
- * @param {boolean} forceCreate if true, create any plugin entries if not found
39
- */
40
25
  function setStateFromStateString(config, stateString, forceCreate) {
41
26
  const state = JSON.parse(stateString);
42
-
43
- // Iterate through each state object, which has a plugin id and key/value state props
44
- Object.keys(state).forEach(id => {
27
+ Object.keys(state).forEach((id) => {
45
28
  const so = state[id];
46
29
  let pluginConf = config.plugins[id];
47
30
  if (!pluginConf && forceCreate) {
@@ -56,7 +39,6 @@ function setStateFromStateString(config, stateString, forceCreate) {
56
39
  }
57
40
  }
58
41
  });
59
-
60
42
  return config;
61
43
  }
62
44
 
@@ -2,36 +2,14 @@
2
2
 
3
3
  var app = require('./app.js');
4
4
 
5
- /**
6
- * This manages the creation and organization of your App instances.
7
- * Each instance is created via the create function - passing in a configuration
8
- * object, which extends any existing configuration template.
9
- */
10
-
11
-
12
- // Note, we are no longer using IOBject - but we can freeze apps via Object.freeze(apps)
13
- // IObject.freeze = 'DEEP'
14
-
15
- // This is a list of "instances" of your full app stack. Often this will be only one.
16
- // If you wish to give it a name, use the appName property. Else one will be assigned.
17
5
  const apps = {};
18
-
19
- const sendAlert = msg => (typeof window !== 'undefined' && window.alert ? window.alert(msg) : console.error(msg));
20
-
21
- /**
22
- * Create a new instance of the engine. Pass in a configuration object which will
23
- * extend the config template.
24
- * @param {} config Configuration for this instance. Will be shallow copied.
25
- */
6
+ const sendAlert = (msg) => typeof window !== "undefined" && window.alert ? window.alert(msg) : console.error(msg);
26
7
  async function create(config) {
27
8
  if (!config) {
28
- throw Error('Attempt to create App instance with no configuration');
9
+ throw Error("Attempt to create App instance with no configuration");
29
10
  }
30
-
31
- // If no name was defined for this instance, create one.
32
- const appName = config.appName || 'Instance' + (Object.keys(apps).length + 1);
11
+ const appName = config.appName || "Instance" + (Object.keys(apps).length + 1);
33
12
  config.appName = appName;
34
-
35
13
  try {
36
14
  const app$1 = await app.create(config);
37
15
  apps[appName] = app$1;
@@ -41,7 +19,7 @@ async function create(config) {
41
19
  if (e.message) {
42
20
  sendAlert(e.message);
43
21
  } else {
44
- sendAlert('Error creating map. Please try again later.');
22
+ sendAlert("Error creating map. Please try again later.");
45
23
  }
46
24
  }
47
25
  }