atriusmaps-node-sdk 3.3.632 → 3.3.633

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 (54) hide show
  1. package/LICENSE.md +1 -2
  2. package/README.md +15 -16
  3. package/dist/cjs/deploy/prepareSDKConfig.js +73 -57
  4. package/dist/cjs/nodesdk/nodeEntry.js +51 -44
  5. package/dist/cjs/package.json.js +4 -1
  6. package/dist/cjs/plugins/clientAPI/src/clientAPI.js +6 -4
  7. package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +32 -26
  8. package/dist/cjs/plugins/dynamicPois/src/processors.js +41 -35
  9. package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +102 -95
  10. package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +52 -26
  11. package/dist/cjs/plugins/sdkServer/src/sdkServer.js +86 -66
  12. package/dist/cjs/plugins/searchService/src/flexsearchExports/lang.js +16 -16
  13. package/dist/cjs/plugins/searchService/src/flexsearchExports/simple.js +31 -8
  14. package/dist/cjs/plugins/searchService/src/poiSearch.js +14 -17
  15. package/dist/cjs/plugins/searchService/src/searchService.js +41 -39
  16. package/dist/cjs/plugins/searchService/src/searchTypeahead.js +14 -19
  17. package/dist/cjs/plugins/searchService/src/utils.js +4 -5
  18. package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +145 -127
  19. package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +37 -39
  20. package/dist/cjs/plugins/wayfinder/src/findRoute.js +11 -18
  21. package/dist/cjs/plugins/wayfinder/src/minPriorityQueue.js +18 -19
  22. package/dist/cjs/plugins/wayfinder/src/navGraph.js +111 -91
  23. package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +19 -16
  24. package/dist/cjs/plugins/wayfinder/src/segmentBadges.js +1 -1
  25. package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +79 -76
  26. package/dist/cjs/plugins/wayfinder/src/segmentCategories.js +1 -1
  27. package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +147 -107
  28. package/dist/cjs/plugins/wayfinder/src/wayfinder.js +178 -148
  29. package/dist/cjs/src/app.js +64 -44
  30. package/dist/cjs/src/configs/postproc-mol-url-parms.js +22 -21
  31. package/dist/cjs/src/configs/postproc-stateTracking.js +5 -8
  32. package/dist/cjs/src/controller.js +11 -6
  33. package/dist/cjs/src/debugTools.js +61 -34
  34. package/dist/cjs/src/env.js +7 -4
  35. package/dist/cjs/src/extModules/bustle.js +35 -45
  36. package/dist/cjs/src/extModules/flexapi/src/help.js +16 -8
  37. package/dist/cjs/src/extModules/flexapi/src/index.js +39 -18
  38. package/dist/cjs/src/extModules/flexapi/src/validate.js +129 -87
  39. package/dist/cjs/src/extModules/geohasher.js +7 -7
  40. package/dist/cjs/src/extModules/log.js +20 -22
  41. package/dist/cjs/src/historyManager.js +2 -2
  42. package/dist/cjs/src/utils/bounds.js +6 -6
  43. package/dist/cjs/src/utils/buildStructureLookup.js +3 -3
  44. package/dist/cjs/src/utils/configUtils.js +14 -18
  45. package/dist/cjs/src/utils/dom.js +12 -18
  46. package/dist/cjs/src/utils/funcs.js +12 -15
  47. package/dist/cjs/src/utils/geodesy.js +7 -9
  48. package/dist/cjs/src/utils/geom.js +52 -40
  49. package/dist/cjs/src/utils/i18n.js +47 -36
  50. package/dist/cjs/src/utils/location.js +12 -13
  51. package/dist/cjs/src/utils/observable.js +27 -28
  52. package/dist/cjs/src/utils/rand.js +9 -10
  53. package/dist/package.json.js +1 -1
  54. package/package.json +1 -1
package/LICENSE.md CHANGED
@@ -1,5 +1,4 @@
1
- License and Terms of Service
2
- ============================
1
+ # License and Terms of Service
3
2
 
4
3
  The License and Terms of Service for the atriusmaps-node-sdk library is located at https://www.acuitybrands.com/-/media/abl/acuitybrands/files/support/customer-support/terms-and-conditions/acuity-saas-agreement.pdf?forceBehavior=open. The text is copied here for reference, please visit the link for official terms.
5
4
 
package/README.md CHANGED
@@ -22,7 +22,7 @@ The Init object contains 3 methods:
22
22
 
23
23
  - `Init.setLogging(boolean logging)` : To turn on/off the logging
24
24
  - `Init.getVersion()` : Returns the current version of the library
25
- - `Init.newMap(Object configuration)` : This is how your initialize a new map. This returns a Promise that resolves to your map.
25
+ - `Init.newMap(Object configuration)` : This is how your initialize a new map. This returns a Promise that resolves to your map.
26
26
 
27
27
  The configuration object recognizes the following properties:
28
28
 
@@ -35,28 +35,28 @@ At a minimum, a configuration would contain an accountId and a venueId:
35
35
 
36
36
  ```js
37
37
  const config = {
38
- venueId: '<venueId>',
39
- accountId: '<accountId>'
40
- }
38
+ venueId: '<venueId>',
39
+ accountId: '<accountId>',
40
+ };
41
41
  ```
42
42
 
43
43
  An example of utilizing a proxy:
44
44
 
45
45
  ```js
46
46
  const config = {
47
- venueId: '<venueId>',
48
- accountId: '<accountId>',
49
- proxy: {
50
- host: 'example.com',
51
- port: 9108
52
- }
53
- }
47
+ venueId: '<venueId>',
48
+ accountId: '<accountId>',
49
+ proxy: {
50
+ host: 'example.com',
51
+ port: 9108,
52
+ },
53
+ };
54
54
  ```
55
55
 
56
56
  You then initialize your map:
57
57
 
58
58
  ```js
59
- const map = await Init.newMap(config)
59
+ const map = await Init.newMap(config);
60
60
  ```
61
61
 
62
62
  Your map function is ready to receive commands – of which the following are currently supported:
@@ -76,15 +76,14 @@ Note that all these commands are asynchronous, and return a promise. So use them
76
76
  Examples:
77
77
 
78
78
  ```js
79
- const poi = await map.getPOIDetails(11)
80
- console.log(`Got POI details for ${poi.name}.`)
79
+ const poi = await map.getPOIDetails(11);
80
+ console.log(`Got POI details for ${poi.name}.`);
81
81
  ```
82
82
 
83
83
  Or
84
84
 
85
85
  ```js
86
- map.getPOIDetails(11)
87
- .then(poi => console.log(`Got POI Details for ${poi.name}.`))
86
+ map.getPOIDetails(11).then(poi => console.log(`Got POI Details for ${poi.name}.`));
88
87
  ```
89
88
 
90
89
  For example:
@@ -4,45 +4,68 @@ var postprocMolUrlParms = require('../src/configs/postproc-mol-url-parms.js');
4
4
  var postprocStateTracking = require('../src/configs/postproc-stateTracking.js');
5
5
  var funcs = require('../src/utils/funcs.js');
6
6
 
7
- function prepareSDKConfig (sc) {
7
+ function prepareSDKConfig(sc) {
8
8
  const {
9
- name, debug, headless, theme, defaultSearchTerms, venueId, accountId,
10
- poiCategories, preserveStateInURL, supportURLDeepLinks, initState,
11
- deepLinkParms, uiHide, renderDiv, parentConfig, desktopViewMinWidth,
12
- forceDesktop, hostAppId, hostAppVersion, hostAppProperties, logFilter,
13
- searchPlaceholder, dataFetch, engineName, dynamicPoisUrlBaseV1, plugins,
14
- anaytics2ActiveFlag, enablePoiSelection, minZoom, maxZoom, noLangOptions,
15
- pinnedLocation, pinnedLocationZoom, pinnedLocationFocusAtStart
9
+ name,
10
+ debug,
11
+ headless,
12
+ theme,
13
+ defaultSearchTerms,
14
+ venueId,
15
+ accountId,
16
+ poiCategories,
17
+ preserveStateInURL,
18
+ supportURLDeepLinks,
19
+ initState,
20
+ deepLinkParms,
21
+ uiHide,
22
+ renderDiv,
23
+ parentConfig,
24
+ desktopViewMinWidth,
25
+ forceDesktop,
26
+ hostAppId,
27
+ hostAppVersion,
28
+ hostAppProperties,
29
+ logFilter,
30
+ searchPlaceholder,
31
+ dataFetch,
32
+ engineName,
33
+ dynamicPoisUrlBaseV1,
34
+ plugins,
35
+ anaytics2ActiveFlag,
36
+ enablePoiSelection,
37
+ minZoom,
38
+ maxZoom,
39
+ noLangOptions,
40
+ pinnedLocation,
41
+ pinnedLocationZoom,
42
+ pinnedLocationFocusAtStart,
16
43
  } = sc;
17
44
 
18
- const extendsConfig = parentConfig ? [parentConfig] : (headless ? ['sdkHeadless'] : ['sdkVisual']);
45
+ const extendsConfig = parentConfig ? [parentConfig] : headless ? ['sdkHeadless'] : ['sdkVisual'];
19
46
 
20
- const trunc = (str, len) => str && str.length > len ? str.substring(0, len) : str;
47
+ const trunc = (str, len) => (str && str.length > len ? str.substring(0, len) : str);
21
48
 
22
- const validateHostAppId = hostAppId => hostAppId ? trunc(hostAppId.toString(), 128) : undefined;
23
- const validateHostAppVersion = hostAppVersion => hostAppVersion ? trunc(hostAppVersion.toString(), 128) : undefined;
49
+ const validateHostAppId = hostAppId => (hostAppId ? trunc(hostAppId.toString(), 128) : undefined);
50
+ const validateHostAppVersion = hostAppVersion => (hostAppVersion ? trunc(hostAppVersion.toString(), 128) : undefined);
24
51
  const validateHostAppProperties = hostAppProperties => {
25
- if (!hostAppProperties || typeof hostAppProperties !== 'object')
26
- return undefined
52
+ if (!hostAppProperties || typeof hostAppProperties !== 'object') return undefined;
27
53
 
28
- const ret = { }; // lets build this back up ourselves to ensure its purity
54
+ const ret = {}; // lets build this back up ourselves to ensure its purity
29
55
  const keys = Object.keys(hostAppProperties);
30
56
 
31
- if (keys.length > 10)
32
- keys.length = 10;
57
+ if (keys.length > 10) keys.length = 10;
33
58
 
34
59
  keys.forEach(key => {
35
60
  let cleanKey = trunc(key.toString().replaceAll(/[^a-zA-Z0-9_]/g, ''), 128);
36
- if (!cleanKey.match(/^[a-zA-Z]+/))
37
- cleanKey = 'X' + cleanKey; // force to start with alpha char
61
+ if (!cleanKey.match(/^[a-zA-Z]+/)) cleanKey = 'X' + cleanKey; // force to start with alpha char
38
62
  let cleanVal = hostAppProperties[key];
39
- if (cleanVal === null || cleanVal === undefined)
40
- cleanVal = '';
63
+ if (cleanVal === null || cleanVal === undefined) cleanVal = '';
41
64
  cleanVal = trunc(cleanVal.toString(), 128);
42
65
  ret[cleanKey] = cleanVal;
43
66
  });
44
67
 
45
- return ret
68
+ return ret;
46
69
  };
47
70
 
48
71
  const config = {
@@ -59,26 +82,25 @@ function prepareSDKConfig (sc) {
59
82
  venueDataLoader: {
60
83
  dataFetch,
61
84
  venueId,
62
- accountId
85
+ accountId,
63
86
  },
64
87
  sdkServer: {
65
- headless
88
+ headless,
66
89
  },
67
90
  analytics2: {
68
91
  hostAppId: validateHostAppId(hostAppId),
69
92
  hostAppVersion: validateHostAppVersion(hostAppVersion),
70
- hostAppProperties: validateHostAppProperties(hostAppProperties)
71
- }
93
+ hostAppProperties: validateHostAppProperties(hostAppProperties),
94
+ },
72
95
  },
73
- uuid: typeof (document) !== 'undefined' && document && document.location ? document.location.host : 'unknown' // used in analytics
96
+ uuid: typeof document !== 'undefined' && document && document.location ? document.location.host : 'unknown', // used in analytics
74
97
  };
75
98
 
76
- if (anaytics2ActiveFlag !== undefined)
77
- config.plugins.analytics2.active = anaytics2ActiveFlag;
99
+ if (anaytics2ActiveFlag !== undefined) config.plugins.analytics2.active = anaytics2ActiveFlag;
78
100
 
79
101
  // return an object with the named property set to the specified value, unless the
80
102
  // value is undefined, then return an empty object
81
- const setIfDef = (name, value) => value !== undefined ? { [name]: value } : { };
103
+ const setIfDef = (name, value) => (value !== undefined ? { [name]: value } : {});
82
104
 
83
105
  if (!headless) {
84
106
  config.plugins['online/headerOnline'] = { searchPlaceholder };
@@ -86,39 +108,38 @@ function prepareSDKConfig (sc) {
86
108
  ...setIfDef('enablePoiSelection', enablePoiSelection),
87
109
  viewLimits: {
88
110
  ...setIfDef('maxZoom', maxZoom),
89
- ...setIfDef('minZoom', minZoom)
90
- }
111
+ ...setIfDef('minZoom', minZoom),
112
+ },
91
113
  };
92
114
  config.plugins.userMenu = { noLangOptions };
93
115
  if (pinnedLocation)
94
- config.plugins['online/pinnedLocation'] = { location: pinnedLocation, zoom: pinnedLocationZoom, focusAtStart: pinnedLocationFocusAtStart };
116
+ config.plugins['online/pinnedLocation'] = {
117
+ location: pinnedLocation,
118
+ zoom: pinnedLocationZoom,
119
+ focusAtStart: pinnedLocationFocusAtStart,
120
+ };
95
121
  }
96
122
 
97
- config.plugins.searchService = defaultSearchTerms
98
- ? { defaultSearchTerms }
99
- : { };
123
+ config.plugins.searchService = defaultSearchTerms ? { defaultSearchTerms } : {};
100
124
  handleI18NParm(sc, 'defaultSearchTerms', config.plugins.searchService);
101
125
 
102
126
  if (extendsConfig.includes('sdkVisual')) {
103
- if (poiCategories)
104
- config.plugins['online/homeView'] = { poiCategories };
105
- else
106
- config.plugins['online/homeView'] = { };
127
+ if (poiCategories) config.plugins['online/homeView'] = { poiCategories };
128
+ else config.plugins['online/homeView'] = {};
107
129
  handleI18NParm(sc, 'poiCategories', config.plugins['online/homeView']);
108
130
  }
109
131
  // Allow *specific* additional plugins
110
132
  // for now, this is just for internal use
111
133
  if (plugins) {
112
- if (plugins.draw)
113
- config.plugins.draw = plugins.draw;
134
+ if (plugins.draw) config.plugins.draw = plugins.draw;
114
135
  // To get flight status working, one needs 3 plugins. This is a bad design, there should just be one and it provides
115
136
  // all 3 of these services. Lets migrate to a single plugin at some point - but until then, lets at least make it look
116
137
  // like a single plugin for SDK users. The only plugin that currently has configurable properties is "flightStatus" - so
117
138
  // lets let SDK users define that one and its single property (apiKey) and we'll just create the other two by default.
118
139
  if (plugins.flightStatus) {
119
140
  config.plugins.flightStatus = plugins.flightStatus;
120
- config.plugins['online/flightDetails'] = { }; // these really shouldn't be separate plugins (!)
121
- config.plugins['online/flightDetailsSearch'] = { }; // these really shouldn't be separate plugins (!)
141
+ config.plugins['online/flightDetails'] = {}; // these really shouldn't be separate plugins (!)
142
+ config.plugins['online/flightDetailsSearch'] = {}; // these really shouldn't be separate plugins (!)
122
143
  }
123
144
  }
124
145
 
@@ -127,31 +148,26 @@ function prepareSDKConfig (sc) {
127
148
  config.plugins.deepLinking = { trackURL: true };
128
149
  }
129
150
 
130
- if (supportURLDeepLinks)
131
- config.configPostProc.push('mol-url-parms');
151
+ if (supportURLDeepLinks) config.configPostProc.push('mol-url-parms');
132
152
 
133
- if (initState)
134
- postprocStateTracking.setStateFromStateString(config, atob(initState), true);
153
+ if (initState) postprocStateTracking.setStateFromStateString(config, atob(initState), true);
135
154
 
136
- if (deepLinkParms)
137
- postprocMolUrlParms.setDeepLinksForParms(config, new URLSearchParams(deepLinkParms), true);
155
+ if (deepLinkParms) postprocMolUrlParms.setDeepLinksForParms(config, new URLSearchParams(deepLinkParms), true);
138
156
 
139
- if (desktopViewMinWidth !== undefined)
140
- config.desktopViewMinWidth = desktopViewMinWidth;
157
+ if (desktopViewMinWidth !== undefined) config.desktopViewMinWidth = desktopViewMinWidth;
141
158
 
142
- if (forceDesktop)
143
- config.desktopViewMinWidth = 0;
159
+ if (forceDesktop) config.desktopViewMinWidth = 0;
144
160
 
145
161
  if (dynamicPoisUrlBaseV1) {
146
162
  config.plugins.dynamicPois = {
147
- urlBaseV1: dynamicPoisUrlBaseV1
163
+ urlBaseV1: dynamicPoisUrlBaseV1,
148
164
  };
149
165
  }
150
166
 
151
- return funcs.filterOb((k, v) => v !== undefined, config) // remove any undefined values
167
+ return funcs.filterOb((k, v) => v !== undefined, config); // remove any undefined values
152
168
  }
153
169
 
154
- function handleI18NParm (sdkConfig, prefix, configDest) {
170
+ function handleI18NParm(sdkConfig, prefix, configDest) {
155
171
  Object.keys(sdkConfig)
156
172
  .filter(key => key.startsWith(prefix + '-'))
157
173
  .forEach(key => (configDest[key] = sdkConfig[key]));
@@ -12,7 +12,7 @@ var observable = require('../src/utils/observable.js');
12
12
  const version = _package.default.version;
13
13
  const LIB_NAME = 'Atrius Maps JS SDK Client';
14
14
 
15
- function setupFetch (config) {
15
+ function setupFetch(config) {
16
16
  const httpAgent = new http.Agent({ keepAlive: true });
17
17
  const httpsAgent = new https.Agent({ keepAlive: true });
18
18
 
@@ -20,42 +20,45 @@ function setupFetch (config) {
20
20
  const proxyAgent = config.proxy ? new httpsProxyAgent.HttpsProxyAgent(`http://${config.proxy.host}:${config.proxy.port}`) : null;
21
21
 
22
22
  // Support a user defined agent - or a proxy agent - else we specify our own, forcing keepAlive to true (which is default in Node >= 19)
23
- const agent = config.agent || proxyAgent || (url => url.protocol === 'http:' ? httpAgent : httpsAgent);
23
+ const agent = config.agent || proxyAgent || (url => (url.protocol === 'http:' ? httpAgent : httpsAgent));
24
24
 
25
25
  global.fetch = async (url, options) => fetch(url, { ...options, agent });
26
26
  }
27
27
 
28
28
  // logging setup
29
29
  let sdkLogging = false;
30
- const pad2 = x => x.toString().length < 2 ? '0' + x : x;
31
- const ts = () => { const d = new Date(); return `${d.getHours()}:${pad2(d.getMinutes())}:${pad2(d.getSeconds())}.${d.getMilliseconds()}` };
30
+ const pad2 = x => (x.toString().length < 2 ? '0' + x : x);
31
+ const ts = () => {
32
+ const d = new Date();
33
+ return `${d.getHours()}:${pad2(d.getMinutes())}:${pad2(d.getSeconds())}.${d.getMilliseconds()}`;
34
+ };
32
35
  const logPre = () => `AtriusMaps Node SDK (${ts()}): `;
33
36
  const log = function () {
34
37
  if (sdkLogging) {
35
- let msg = logPre() + Array.from(arguments).map(arg => typeof arg === 'object' ? JSON.stringify(arg) : arg).join(' ');
38
+ let msg =
39
+ logPre() +
40
+ Array.from(arguments)
41
+ .map(arg => (typeof arg === 'object' ? JSON.stringify(arg) : arg))
42
+ .join(' ');
36
43
  const lines = msg.split('\n');
37
- if (lines.length > 1)
38
- msg = lines[0] + `… (+ ${lines.length - 1} lines)`;
39
- else
40
- if (msg.length > 256)
41
- msg = msg.substring(0, 255) + `… (length: ${msg.length} chars)`;
44
+ if (lines.length > 1) msg = lines[0] + `… (+ ${lines.length - 1} lines)`;
45
+ else if (msg.length > 256) msg = msg.substring(0, 255) + `… (length: ${msg.length} chars)`;
42
46
  console.log(msg);
43
47
  }
44
48
  };
45
49
 
46
50
  // this iterates through available commands and makes them member functions of map
47
- function addCommands (map, commands) {
51
+ function addCommands(map, commands) {
48
52
  commands.forEach(sig => {
49
53
  map[sig.command] = function () {
50
54
  const cob = { command: sig.command };
51
- for (let i = 0; i < arguments.length; i++)
52
- cob[sig.args[i].name] = arguments[i];
53
- return map(cob)
55
+ for (let i = 0; i < arguments.length; i++) cob[sig.args[i].name] = arguments[i];
56
+ return map(cob);
54
57
  };
55
58
  });
56
59
  }
57
60
 
58
- async function newMap (sdkConfig) {
61
+ async function newMap(sdkConfig) {
59
62
  return new Promise((resolve, reject) => {
60
63
  sdkConfig.headless = true;
61
64
 
@@ -63,41 +66,45 @@ async function newMap (sdkConfig) {
63
66
 
64
67
  const config = prepareSDKConfig(sdkConfig);
65
68
 
66
- controller.create(config)
67
- .then(app => {
68
- const map = (payload, arg2) => {
69
- if (typeof payload === 'string')
70
- payload = { ...arg2, command: payload };
71
- log('Sending command object: ', payload);
72
- return app.bus.get('clientAPI/execute', payload)
73
- .then(result => {
74
- log('Received Message: ', result);
75
- return result
76
- })
77
- .catch(e => {
78
- log('Error: ', e.message); // doesn't seem to ever get called?? WTF?
79
- throw e
80
- })
81
- };
82
- // map._app = app
83
-
84
- observable(map); // make map handle events pub/sub
85
- app.eventListener.observe(function () { map.fire.apply(map, arguments); }); // pass it on...
86
-
87
- map.on('ready', (eName, data) => {
88
- const { commands/*, customTypes */ } = data.commandJSON;
89
- addCommands(map, commands);
90
- resolve(map);
91
- log('map ready');
92
- });
69
+ controller.create(config).then(app => {
70
+ const map = (payload, arg2) => {
71
+ if (typeof payload === 'string') payload = { ...arg2, command: payload };
72
+ log('Sending command object: ', payload);
73
+ return app.bus
74
+ .get('clientAPI/execute', payload)
75
+ .then(result => {
76
+ log('Received Message: ', result);
77
+ return result;
78
+ })
79
+ .catch(e => {
80
+ log('Error: ', e.message); // doesn't seem to ever get called?? WTF?
81
+ throw e;
82
+ });
83
+ };
84
+ // map._app = app
85
+
86
+ observable(map); // make map handle events pub/sub
87
+ app.eventListener.observe(function () {
88
+ map.fire.apply(map, arguments);
89
+ }); // pass it on...
90
+
91
+ map.on('ready', (eName, data) => {
92
+ const { commands /*, customTypes */ } = data.commandJSON;
93
+ addCommands(map, commands);
94
+ resolve(map);
95
+ log('map ready');
93
96
  });
94
- })
97
+ });
98
+ });
95
99
  }
96
100
 
97
101
  const Init = {
98
102
  getVersion: () => version,
99
103
  newMap: config => newMap(config),
100
- setLogging: flag => { sdkLogging = flag; if (flag) log(`${LIB_NAME} v${version} Logging enabled.`); }
104
+ setLogging: flag => {
105
+ sdkLogging = flag;
106
+ if (flag) log(`${LIB_NAME} v${version} Logging enabled.`);
107
+ },
101
108
  };
102
109
 
103
110
  module.exports = Init;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var name = "web-engine";
6
- var version = "3.3.632";
6
+ var version = "3.3.633";
7
7
  var license = "UNLICENSED";
8
8
  var type = "module";
9
9
  var main = "src/main.js";
@@ -24,6 +24,7 @@ var scripts = {
24
24
  "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'",
25
25
  demo: "cd demo/ && yarn start",
26
26
  dev: "yarn mol e2e",
27
+ "format:check": "prettier . --check",
27
28
  goProd: "cd deploy && scripts/goProd.sh",
28
29
  goStaging: "deploy/scripts/goStaging.sh",
29
30
  lint: "eslint .",
@@ -141,6 +142,7 @@ var devDependencies = {
141
142
  cypress: "^14.2.0",
142
143
  "cypress-wait-until": "^3.0.2",
143
144
  eslint: "^8.57.1",
145
+ "eslint-config-prettier": "^10.1.8",
144
146
  "eslint-config-standard": "^17.1.0",
145
147
  "eslint-import-resolver-typescript": "^3.9.1",
146
148
  "eslint-plugin-cypress": "^2.15.2",
@@ -163,6 +165,7 @@ var devDependencies = {
163
165
  nx: "19.8.14",
164
166
  "nx-remotecache-azure": "^19.0.0",
165
167
  "os-browserify": "^0.3.0",
168
+ prettier: "3.7.4",
166
169
  "start-server-and-test": "^2.0.11",
167
170
  typescript: "^5.8.2",
168
171
  vite: "^4.3.9",
@@ -2,15 +2,17 @@
2
2
 
3
3
  var index = require('../../../src/extModules/flexapi/src/index.js');
4
4
 
5
- function create (app, config) {
5
+ function create(app, config) {
6
6
  const api = index();
7
- app.bus.on('clientAPI/registerCommand', ob => api.registerCommand(ob, cob => app.bus.get(`clientAPI/${cob.command}`, cob)));
7
+ app.bus.on('clientAPI/registerCommand', ob =>
8
+ api.registerCommand(ob, cob => app.bus.get(`clientAPI/${cob.command}`, cob)),
9
+ );
8
10
  app.bus.on('clientAPI/registerCustomType', ({ name, spec }) => api.registerCustomType(name, spec));
9
11
  app.bus.on('clientAPI/execute', cob => api.execute(cob));
10
12
 
11
13
  return {
12
- init: () => {} // nothing more to do
13
- }
14
+ init: () => {}, // nothing more to do
15
+ };
14
16
  }
15
17
 
16
18
  exports.create = create;
@@ -36,15 +36,14 @@ const MAX_FETCH_FAILS = 3; // 3 strikes and you're out!
36
36
 
37
37
  const ACCOUNT_ID_HEADER = 'x-account-id';
38
38
 
39
- function create (app, config = {}) {
39
+ function create(app, config = {}) {
40
40
  const state = {
41
- dynamicDataNotPending: new Zousan()
41
+ dynamicDataNotPending: new Zousan(),
42
42
  };
43
43
  const T = app.gt();
44
44
 
45
45
  // used in testing
46
- if (config._overrideRefreshFrequency)
47
- REFRESH_FREQUENCY = config._overrideRefreshFrequency;
46
+ if (config._overrideRefreshFrequency) REFRESH_FREQUENCY = config._overrideRefreshFrequency;
48
47
 
49
48
  // by returning this dynamicDataLoaded promise, we hold sdkReady event until this is resolved
50
49
  app.bus.on('system/readywhenyouare', () => state.dynamicDataNotPending);
@@ -52,7 +51,7 @@ function create (app, config = {}) {
52
51
  const init = async () => {
53
52
  const [accountId, venueId] = await Promise.all([
54
53
  app.bus.get('venueData/getAccountId'),
55
- app.bus.get('venueData/getVenueId')
54
+ app.bus.get('venueData/getVenueId'),
56
55
  ]);
57
56
 
58
57
  const dynamicPoisUrl = `${MARKETPLACE_URL_BASE}/venueId/${venueId}/dynamic-poi`;
@@ -61,12 +60,18 @@ function create (app, config = {}) {
61
60
  let fetchSuccessCount = 0;
62
61
  let fetchIntervalHandle;
63
62
  const updateFromAPI = async () => {
64
- const response = await fetch(dynamicPoisUrl, { headers: { [ACCOUNT_ID_HEADER]: accountId } });
65
- if (response.ok) // 404 if customer does not have dynamic POIs
66
- return response.json()
63
+ const response = await fetch(dynamicPoisUrl, {
64
+ headers: { [ACCOUNT_ID_HEADER]: accountId },
65
+ });
66
+ if (response.ok)
67
+ // 404 if customer does not have dynamic POIs
68
+ return response
69
+ .json()
67
70
  .then(({ data }) => processDynamicPois(data))
68
- .then(() => { fetchSuccessCount++; })
69
- .catch(console.error)
71
+ .then(() => {
72
+ fetchSuccessCount++;
73
+ })
74
+ .catch(console.error);
70
75
  else {
71
76
  console.warn('dynamicPois: fetch response status not ok', response);
72
77
  fetchFailuresCount++;
@@ -79,38 +84,36 @@ function create (app, config = {}) {
79
84
  return updateFromAPI()
80
85
  .then(() => {
81
86
  fetchIntervalHandle = setInterval(updateFromAPI, REFRESH_FREQUENCY);
82
- if (typeof fetchIntervalHandle.unref === 'function')
83
- fetchIntervalHandle.unref(); // Node only - do not keep-alive Lambda or other short-term environments
87
+ if (typeof fetchIntervalHandle.unref === 'function') fetchIntervalHandle.unref(); // Node only - do not keep-alive Lambda or other short-term environments
84
88
  })
85
- .finally(() => state.dynamicDataNotPending.resolve(true)) // even in case of failure, we don't want to hold up the UI
89
+ .finally(() => state.dynamicDataNotPending.resolve(true)); // even in case of failure, we don't want to hold up the UI
86
90
  };
87
91
 
88
- async function processDynamicPois (pois) {
92
+ async function processDynamicPois(pois) {
89
93
  processParkingPOIS(pois);
90
94
  processOpenClosedPois(pois);
91
95
  processSecurityWaitTimes(pois);
92
96
  processDynamicRouting(pois);
93
97
  }
94
98
 
95
- function processParkingPOIS (poiMap) {
99
+ function processParkingPOIS(poiMap) {
96
100
  const idValuesMap = processors.processParkingPOIS(poiMap);
97
101
  app.bus.send('poi/setDynamicData', { plugin: 'parking', idValuesMap });
98
102
  }
99
103
 
100
104
  const getPOILabels = async idArray => {
101
- const nameMap = { };
105
+ const nameMap = {};
102
106
  for (const poiId of idArray) {
103
107
  const poi = await app.bus.get('poi/getById', { id: poiId });
104
- if (poi)
105
- nameMap[poiId] = poi.name;
108
+ if (poi) nameMap[poiId] = poi.name;
106
109
  }
107
- return nameMap
110
+ return nameMap;
108
111
  };
109
112
 
110
113
  /*
111
114
  API response: https://gitlab.com/locuslabs/core-data-team/json-schemas/-/blob/develop/src/api-marketplace/dynamic-queue-data.json
112
115
  */
113
- async function processSecurityWaitTimes (poiMap) {
116
+ async function processSecurityWaitTimes(poiMap) {
114
117
  const idValuesMap = processors.processSecurityWaitTimes(poiMap);
115
118
 
116
119
  app.bus.send('poi/setDynamicData', { plugin: 'security', idValuesMap });
@@ -118,23 +121,26 @@ function create (app, config = {}) {
118
121
  const labels = await getPOILabels(Object.keys(idValuesMap)); // get a map of labels for the POIs - used in wait time labeling
119
122
 
120
123
  app.bus.send('map/mutateFeature', {
121
- functor: processors.mutateSecurityCheckpointLabel(T, idValuesMap, labels)
124
+ functor: processors.mutateSecurityCheckpointLabel(T, idValuesMap, labels),
122
125
  });
123
126
  }
124
127
 
125
- function processOpenClosedPois (poiMap) {
128
+ function processOpenClosedPois(poiMap) {
126
129
  const idValuesMap = processors.processOpenClosedPois(poiMap);
127
- app.bus.send('poi/setDynamicData', { plugin: 'open-closed-status', idValuesMap });
130
+ app.bus.send('poi/setDynamicData', {
131
+ plugin: 'open-closed-status',
132
+ idValuesMap,
133
+ });
128
134
  }
129
135
 
130
- async function processDynamicRouting (poiMap) {
136
+ async function processDynamicRouting(poiMap) {
131
137
  const idValuesMap = await processors.processRoutingPois(poiMap);
132
138
  app.bus.send('poi/setDynamicRouting', { plugin: 'routing', idValuesMap });
133
139
  }
134
140
 
135
141
  return {
136
- init
137
- }
142
+ init,
143
+ };
138
144
  }
139
145
 
140
146
  exports.create = create;