atriusmaps-node-sdk 3.3.196 → 3.3.225

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 (109) hide show
  1. package/dist/cjs/_virtual/_empty_module_placeholder.js +2 -2
  2. package/dist/cjs/deploy/prepareSDKConfig.js +152 -2
  3. package/dist/cjs/nodesdk/nodeEntry.js +109 -0
  4. package/dist/cjs/package.json.js +190 -14
  5. package/dist/cjs/plugins/clientAPI/src/clientAPI.js +11 -2
  6. package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +218 -21
  7. package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +292 -21
  8. package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +99 -20
  9. package/dist/cjs/plugins/sdkServer/src/sdkServer.js +219 -2
  10. package/dist/cjs/plugins/sdkServer/src/util.js +16 -3
  11. package/dist/cjs/plugins/searchService/src/poiSearch.js +57 -19
  12. package/dist/cjs/plugins/searchService/src/searchService.js +246 -21
  13. package/dist/cjs/plugins/searchService/src/searchTypeahead.js +60 -3
  14. package/dist/cjs/plugins/searchService/src/utils.js +23 -4
  15. package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +472 -21
  16. package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +191 -23
  17. package/dist/cjs/plugins/wayfinder/src/findRoute.js +147 -19
  18. package/dist/cjs/plugins/wayfinder/src/minPriorityQueue.js +88 -2
  19. package/dist/cjs/plugins/wayfinder/src/navGraph.js +393 -5
  20. package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +110 -20
  21. package/dist/cjs/plugins/wayfinder/src/segmentBadges.js +28 -2
  22. package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +257 -19
  23. package/dist/cjs/plugins/wayfinder/src/segmentCategories.js +29 -2
  24. package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +238 -3
  25. package/dist/cjs/plugins/wayfinder/src/wayfinder.js +597 -22
  26. package/dist/cjs/src/app.js +191 -25
  27. package/dist/cjs/src/configs/postproc-mol-url-parms.js +58 -2
  28. package/dist/cjs/src/configs/postproc-stateTracking.js +53 -19
  29. package/dist/cjs/src/controller.js +43 -4
  30. package/dist/cjs/src/debugTools.js +128 -23
  31. package/dist/cjs/src/env.js +17 -2
  32. package/dist/cjs/src/extModules/bustle.js +128 -4
  33. package/dist/cjs/src/extModules/flexapi/src/help.js +23 -4
  34. package/dist/cjs/src/extModules/flexapi/src/index.js +65 -4
  35. package/dist/cjs/src/extModules/flexapi/src/validate.js +133 -5
  36. package/dist/cjs/src/extModules/geohasher.js +90 -3
  37. package/dist/cjs/src/extModules/log.js +69 -2
  38. package/dist/cjs/src/historyManager.js +29 -2
  39. package/dist/cjs/src/utils/bounds.js +22 -4
  40. package/dist/cjs/src/utils/buildStructureLookup.js +31 -19
  41. package/dist/cjs/src/utils/configUtils.js +71 -3
  42. package/dist/cjs/src/utils/dom.js +48 -5
  43. package/dist/cjs/src/utils/funcs.js +30 -3
  44. package/dist/cjs/src/utils/geodesy.js +35 -3
  45. package/dist/cjs/src/utils/geom.js +209 -27
  46. package/dist/cjs/src/utils/i18n.js +69 -5
  47. package/dist/cjs/src/utils/observable.js +73 -2
  48. package/dist/cjs/src/utils/rand.js +82 -3
  49. package/dist/nodesdk/nodeEntry.js +1 -0
  50. package/dist/package.json.js +1 -0
  51. package/dist/plugins/searchService/src/searchService.js +1 -0
  52. package/dist/plugins/venueDataLoader/src/venueDataLoader.js +1 -0
  53. package/dist/plugins/venueDataLoader/src/venueLoadingUtils.js +1 -0
  54. package/dist/src/app.js +1 -0
  55. package/package.json +13 -9
  56. package/.yarnrc.yml +0 -1
  57. package/config/rollup.config.cjs.js +0 -31
  58. package/dist/cjs/deploy/nodeEntry.js +0 -20
  59. package/dist/cjs/src/auth/Auth.js +0 -23
  60. package/lib/deploy/nodeEntry.js +0 -1
  61. package/lib/package.json.js +0 -1
  62. package/lib/plugins/searchService/src/searchService.js +0 -1
  63. package/lib/plugins/venueDataLoader/src/venueDataLoader.js +0 -1
  64. package/lib/plugins/venueDataLoader/src/venueLoadingUtils.js +0 -1
  65. package/lib/src/app.js +0 -1
  66. package/lib/src/configs/sdkHeadless.json +0 -28
  67. /package/{lib → dist}/_virtual/_empty_module_placeholder.js +0 -0
  68. /package/{lib → dist}/deploy/prepareSDKConfig.js +0 -0
  69. /package/{lib → dist}/plugins/clientAPI/src/clientAPI.js +0 -0
  70. /package/{lib → dist}/plugins/dynamicPois/src/dynamicPois.js +0 -0
  71. /package/{lib → dist}/plugins/poiDataManager/src/poiDataManager.js +0 -0
  72. /package/{lib → dist}/plugins/sdkServer/src/sdkHeadless.js +0 -0
  73. /package/{lib → dist}/plugins/sdkServer/src/sdkServer.js +0 -0
  74. /package/{lib → dist}/plugins/sdkServer/src/util.js +0 -0
  75. /package/{lib → dist}/plugins/searchService/src/poiSearch.js +0 -0
  76. /package/{lib → dist}/plugins/searchService/src/searchTypeahead.js +0 -0
  77. /package/{lib → dist}/plugins/searchService/src/utils.js +0 -0
  78. /package/{lib → dist}/plugins/wayfinder/src/findRoute.js +0 -0
  79. /package/{lib → dist}/plugins/wayfinder/src/minPriorityQueue.js +0 -0
  80. /package/{lib → dist}/plugins/wayfinder/src/navGraph.js +0 -0
  81. /package/{lib → dist}/plugins/wayfinder/src/navGraphDebug.js +0 -0
  82. /package/{lib → dist}/plugins/wayfinder/src/segmentBadges.js +0 -0
  83. /package/{lib → dist}/plugins/wayfinder/src/segmentBuilder.js +0 -0
  84. /package/{lib → dist}/plugins/wayfinder/src/segmentCategories.js +0 -0
  85. /package/{lib → dist}/plugins/wayfinder/src/stepBuilder.js +0 -0
  86. /package/{lib → dist}/plugins/wayfinder/src/wayfinder.js +0 -0
  87. /package/{lib → dist}/src/configs/postproc-mol-url-parms.js +0 -0
  88. /package/{lib → dist}/src/configs/postproc-stateTracking.js +0 -0
  89. /package/{lib → dist}/src/configs/sdkHeadless.json.js +0 -0
  90. /package/{lib → dist}/src/controller.js +0 -0
  91. /package/{lib → dist}/src/debugTools.js +0 -0
  92. /package/{lib → dist}/src/env.js +0 -0
  93. /package/{lib → dist}/src/extModules/bustle.js +0 -0
  94. /package/{lib → dist}/src/extModules/flexapi/src/help.js +0 -0
  95. /package/{lib → dist}/src/extModules/flexapi/src/index.js +0 -0
  96. /package/{lib → dist}/src/extModules/flexapi/src/validate.js +0 -0
  97. /package/{lib → dist}/src/extModules/geohasher.js +0 -0
  98. /package/{lib → dist}/src/extModules/log.js +0 -0
  99. /package/{lib → dist}/src/historyManager.js +0 -0
  100. /package/{lib → dist}/src/utils/bounds.js +0 -0
  101. /package/{lib → dist}/src/utils/buildStructureLookup.js +0 -0
  102. /package/{lib → dist}/src/utils/configUtils.js +0 -0
  103. /package/{lib → dist}/src/utils/dom.js +0 -0
  104. /package/{lib → dist}/src/utils/funcs.js +0 -0
  105. /package/{lib → dist}/src/utils/geodesy.js +0 -0
  106. /package/{lib → dist}/src/utils/geom.js +0 -0
  107. /package/{lib → dist}/src/utils/i18n.js +0 -0
  108. /package/{lib → dist}/src/utils/observable.js +0 -0
  109. /package/{lib → dist}/src/utils/rand.js +0 -0
@@ -2,11 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var e = require('IObject');
6
- var t = require('query-string');
7
- var e$1 = require('ramda');
8
- var i = require('zousan-plus');
9
- var package_json = require('../package.json.js');
5
+ var applicationinsightsWeb = require('@microsoft/applicationinsights-web');
6
+ var IObject = require('IObject');
7
+ var queryString = require('query-string');
8
+ var R = require('ramda');
9
+ var Zousan = require('zousan-plus');
10
+ var _package = require('../package.json.js');
10
11
  var debugTools = require('./debugTools.js');
11
12
  var env = require('./env.js');
12
13
  var bustle = require('./extModules/bustle.js');
@@ -18,27 +19,192 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
18
19
  function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: null, 'default': e }); }
19
20
 
20
21
  function _interopNamespace(e) {
21
- if (e && e.__esModule) return e;
22
- var n = Object.create(null);
23
- if (e) {
24
- Object.keys(e).forEach(function (k) {
25
- if (k !== 'default') {
26
- var d = Object.getOwnPropertyDescriptor(e, k);
27
- Object.defineProperty(n, k, d.get ? d : {
28
- enumerable: true,
29
- get: function () { return e[k]; }
30
- });
31
- }
32
- });
33
- }
34
- n["default"] = e;
35
- return Object.freeze(n);
22
+ if (e && e.__esModule) return e;
23
+ var n = Object.create(null);
24
+ if (e) {
25
+ Object.keys(e).forEach(function (k) {
26
+ if (k !== 'default') {
27
+ var d = Object.getOwnPropertyDescriptor(e, k);
28
+ Object.defineProperty(n, k, d.get ? d : {
29
+ enumerable: true,
30
+ get: function () { return e[k]; }
31
+ });
32
+ }
33
+ });
34
+ }
35
+ n["default"] = e;
36
+ return Object.freeze(n);
36
37
  }
37
38
 
38
- var e__default = /*#__PURE__*/_interopDefaultLegacy(e);
39
- var t__default = /*#__PURE__*/_interopDefaultLegacy(t);
40
- var i__default = /*#__PURE__*/_interopDefaultLegacy(i);
39
+ var IObject__default = /*#__PURE__*/_interopDefaultLegacy(IObject);
40
+ var queryString__default = /*#__PURE__*/_interopDefaultLegacy(queryString);
41
+ var Zousan__default = /*#__PURE__*/_interopDefaultLegacy(Zousan);
41
42
 
42
- const g="undefined"!=typeof window;async function p(e,t,n){let o=t;if(o.includes("/")){const e=o.split("/");o=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):(function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(`../plugins/${t}/src/${o}.js`).then((o=>(e.log.info(`Creating plugin ${t}`),o.create(e,n))))}async function d(e){return g?(function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(`./configs/${e}.json`):(function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(`./configs/${e}.json.js`)}async function m(e,t){let n={};const i=await Promise.all(t.map(d));for(const e of i){let t=e.default;t=t.extends?await m(t,t.extends):t,n=e$1.mergeDeepRight(n,t);}return n=e$1.mergeDeepRight(n,e),n}const f=e=>t=>(function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(`./configs/postproc-${e}.js`).then((e=>e.process(t)));async function w(o){const d=Object.create(null);let w=o.extends?await m(o,o.extends):o;w.plugins.monitoring&&Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }).then((e=>e.activate(w))),w=await(async e=>e.configPostProc?i__default["default"].series(e,...e.configPostProc.map(f)):e)(w);const y=(e=>{const n=e.supportedLanguages||["ar","en","es","fr","ja","ko","zh-Hans","zh-Hant"];if("undefined"!=typeof window){let e=t__default["default"].parse(location.search).lang||navigator.language;for(;e;){if(e&&n.includes(e))return e;e=e.substring(0,e.lastIndexOf("-"));}}return e.defaultLanguage||"en"})(w),h=await i18n["default"](y,{debug:w.debug});d.i18n=()=>h,d.gt=()=>h.t.bind(h),d.config=w,d.plugins=new e__default["default"];const j=log.initLog("web-engine",{enabled:!!w.debug,isBrowser:g,color:"cyan",logFilter:w.logFilter,truncateObjects:!g});if(d.log=j.sublog(w.name),d.bus=bustle.create({trace:!1,showEvents:!0,reportAllErrors:!0,log:j}),d.info={wePkg:package_json["default"]},"undefined"!=typeof window&&(w.debug?(d.debug=e$1.map((e=>e.bind(d)),debugTools),debugTools.dndGo.call(d)):d.debug={},window._app=d,window.document&&window.document.title&&w.setWindowTitle&&(document.title=w.name)),d.env=env.buildEnv(d),w.theme?await i__default["default"].evaluate({name:"ThemeManagerModule",value:Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); })},{name:"HistoryManager",value:Promise.resolve().then(function () { return require('./historyManager.js'); })},{name:"LayerManager",value:Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); })}).then((async({LayerManager:e,HistoryManager:t,ThemeManagerModule:n})=>{const o=n.initThemeManager(d);d.themePack=await o.buildTheme(w.theme,w.defaultTheme),e.initLayerManager(d),t.initHistoryManager(d),d.destroy=()=>e.destroy(d);})):d.destroy=()=>{},w.plugins){for(const e in w.plugins)try{const t=w.plugins[e];if(d.plugins[e])throw Error(`Duplicate plugin name "${e}"`);const n=await p(d,e,t);n&&(d.plugins=d.plugins.set(e,n));}catch(t){j.error("Error instantiating plugin "+e),j.error(t);}for(const e in d.plugins)d.plugins[e].init();}return d}
43
+ const isBrowser = typeof window !== 'undefined';
43
44
 
44
- exports.create = w;
45
+ async function setupPlugin (app, id, config) {
46
+ let name = id;
47
+ if (name.includes('/')) {
48
+ const split = name.split('/');
49
+ name = split[split.length - 1];
50
+ }
51
+
52
+ if (config.active !== undefined) {
53
+ if ((config.active === false) || (config.active === 'notLocalhost' && app.env.isLocalhost())) {
54
+ app.log.info(`Plugin ${id} explicitly deativated`);
55
+ return null
56
+ }
57
+ }
58
+
59
+ return (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(`../plugins/${id}/src/${name}.js`)
60
+ .then(pluginModule => {
61
+ app.log.info(`Creating plugin ${id}`);
62
+ return pluginModule.create(app, config)
63
+ })
64
+ }
65
+
66
+ // takes the `lang` query parameter and returns the most specific supported language
67
+ // Recognizes the following optional configuration parameters:
68
+ // supportedLanguages : array of supported language strings. i.e. [ "en", "en-US", "fr", "ja" ]
69
+ // defaultLanguage : if all fails, use this language. default = "en"
70
+ const getLang = config => {
71
+ const supportedLanguages = config.supportedLanguages || ['ar', 'en', 'es', 'fr', 'ja', 'ko', 'zh-Hans', 'zh-Hant'];
72
+
73
+ if (typeof window !== 'undefined') { // if this is a browser...
74
+ const queryParms = queryString__default["default"].parse(location.search);
75
+ // eslint-disable-next-line no-constant-condition
76
+ let lang = queryParms.lang || (typeof navigator ? navigator.language : null);
77
+ while (lang)
78
+ if (lang && supportedLanguages.includes(lang))
79
+ return lang
80
+ else
81
+ lang = lang.substring(0, lang.lastIndexOf('-'));
82
+ }
83
+
84
+ return config.defaultLanguage || 'en'
85
+ };
86
+
87
+ async function loadConfig (name) {
88
+ return isBrowser
89
+ ? (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(`./configs/${name}.json`)
90
+ : (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(`./configs/${name}.json.js`) // bit of a hack - but supports all versions of node. See https://gitlab.com/locuslabspublic/node-sdk/-/merge_requests/1
91
+ }
92
+
93
+ async function extendConfig (config, extendsConfigs) {
94
+ let newConfig = {};
95
+ const extConfigFiles = await Promise.all(extendsConfigs.map(loadConfig));
96
+ for (const extendsConfigMod of extConfigFiles) {
97
+ let extendsConfig = extendsConfigMod.default;
98
+ extendsConfig = extendsConfig.extends ? await extendConfig(extendsConfig, extendsConfig.extends) : extendsConfig; // enable recursive extends
99
+ newConfig = R.mergeDeepRight(newConfig, extendsConfig); // default is JSON data in ES6 modules import
100
+ }
101
+ newConfig = R.mergeDeepRight(newConfig, config);
102
+ return newConfig
103
+ }
104
+
105
+ // const isSimpleName = name => /^[-a-zA-Z0-9]+$/.test(name) // composed of only alphanumeric and dash
106
+
107
+ const createPostProcessor = name =>
108
+ config => (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(`./configs/postproc-${name}.js`)
109
+ .then(pp => pp.process(config));
110
+
111
+ const handleConfigPostProcess = async config =>
112
+ config.configPostProc
113
+ ? Zousan__default["default"].series(config, ...config.configPostProc.map(createPostProcessor))
114
+ : config;
115
+
116
+ async function create (rawConfig) {
117
+ const appInstance = Object.create(null);
118
+
119
+ let config = rawConfig.extends ? await extendConfig(rawConfig, rawConfig.extends) : rawConfig;
120
+
121
+ if (config.plugins.monitoring)
122
+ Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }).then(mon => mon.activate(config));
123
+
124
+ config = await handleConfigPostProcess(config);
125
+
126
+ const lang = getLang(config);
127
+ const i18n$1 = await i18n["default"](lang, { debug: config.debug });
128
+ appInstance.i18n = () => i18n$1;
129
+ appInstance.gt = () => i18n$1.t.bind(i18n$1); // get translation function - don't hold this, it is bound to current lang
130
+ appInstance.config = config;
131
+
132
+ appInstance.plugins = new IObject__default["default"]();
133
+ const appLog = log.initLog('web-engine', { enabled: !!config.debug, isBrowser, color: 'cyan', logFilter: config.logFilter, truncateObjects: !isBrowser });
134
+
135
+ appInstance.log = appLog.sublog(config.name);
136
+ appInstance.bus = bustle.create({ trace: false, showEvents: true, reportAllErrors: true, log: appLog });
137
+
138
+ appInstance.info = { wePkg: _package["default"] }; // web-engine package
139
+
140
+ if (process.env.APP_INSIGHTS) {
141
+ const appInsights = new applicationinsightsWeb.ApplicationInsights({
142
+ config: {
143
+ connectionString: process.env.APP_INSIGHTS,
144
+ disableAjaxTracking: true,
145
+ disableFetchTracking: true
146
+ }
147
+ });
148
+ appInsights.loadAppInsights();
149
+
150
+ appInstance.bus.on('appInsights/log', (log) => {
151
+ log.properties.location = window.location.origin;
152
+ appInsights.trackEvent({ ...log });
153
+ appInsights.flush();
154
+ });
155
+ }
156
+
157
+ if (typeof window !== 'undefined') { // Prepare for non-browser environments
158
+ if (config.debug) {
159
+ appInstance.debug = R.map(fn => fn.bind(appInstance), debugTools);
160
+ debugTools.dndGo.call(appInstance); // setup DnD by default...
161
+ } else
162
+ appInstance.debug = { }; // no tools unless in debug mode.. (good idea?)
163
+
164
+ window._app = appInstance;
165
+ if (window.document && window.document.title && config.setWindowTitle)
166
+ document.title = config.name;
167
+ }
168
+
169
+ appInstance.env = env.buildEnv(appInstance);
170
+
171
+ if (config.theme) { // the following is only needed when UI is active - which requires a theme
172
+ await Zousan__default["default"].evaluate(
173
+ { name: 'ThemeManagerModule', value: Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }) },
174
+ { name: 'HistoryManager', value: Promise.resolve().then(function () { return require('./historyManager.js'); }) },
175
+ { name: 'LayerManager', value: Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }) }
176
+ ).then(async ({ LayerManager, HistoryManager, ThemeManagerModule }) => {
177
+ const ThemeManager = ThemeManagerModule.initThemeManager(appInstance);
178
+ appInstance.themePack = await ThemeManager.buildTheme(config.theme, config.defaultTheme);
179
+
180
+ LayerManager.initLayerManager(appInstance);
181
+ HistoryManager.initHistoryManager(appInstance);
182
+
183
+ appInstance.destroy = () => LayerManager.destroy(appInstance);
184
+ });
185
+ } else
186
+ appInstance.destroy = () => { }; // noop
187
+
188
+ if (config.plugins) {
189
+ for (const id in config.plugins) {
190
+ try {
191
+ const pluginConfig = config.plugins[id];
192
+ if (appInstance.plugins[id]) { throw Error(`Duplicate plugin name "${id}"`) }
193
+ const plugin = await setupPlugin(appInstance, id, pluginConfig);
194
+ if (plugin)
195
+ appInstance.plugins = appInstance.plugins.set(id, plugin);
196
+ } catch (e) {
197
+ appLog.error('Error instantiating plugin ' + id);
198
+ appLog.error(e);
199
+ }
200
+ }
201
+
202
+ for (const id in appInstance.plugins) {
203
+ appInstance.plugins[id].init();
204
+ }
205
+ }
206
+
207
+ return appInstance
208
+ }
209
+
210
+ exports.create = create;
@@ -4,6 +4,62 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('query-string');
6
6
 
7
- const e={navFrom:"online/getDirectionsFromTo",navTo:"online/getDirectionsFromTo",waypoints:"online/getDirectionsFromTo",accessible:"online/getDirectionsFromTo",showNav:"online/getDirectionsFromTo",poiId:["online/getDirectionsFromTo","online/poiView"],vid:"venueDataLoader",stage:"venueDataLoader",contentStage:"venueDataLoader",accountId:"venueDataLoader",search:"online/headerOnline",ho:["online/getDirectionsFromTo","analytics2"],home:"online/homeView",zoom:"mapRenderer",pitch:"mapRenderer",bearing:"mapRenderer",lat:"mapRenderer",lng:"mapRenderer",radius:"mapRenderer",buildingId:"mapRenderer",floorId:"mapRenderer",refInstallId:"analytics2",multipointRouting:["online/getDirectionsFromTo","online/poiView"]};function n(n,o,i){if(void 0!==o.lldebug)try{n.debug=JSON.parse(o.lldebug),null===n.debug&&(n.debug={});}catch(e){n.debug=!0;}return Object.keys(e).forEach((r=>{if(void 0!==o[r]){let t=e[r];Array.isArray(t)||(t=[t]),t.forEach((e=>{let t=n.plugins[e];!t&&i&&(t=n.plugins[e]={}),t.deepLinkProps={...t.deepLinkProps,[r]:o[r]};}));}})),o.poiId&&o.showNav&&delete n.plugins["online/poiView"].deepLinkProps.poiId,n}
7
+ const parmToPlugin = {
8
+ navFrom: 'online/getDirectionsFromTo',
9
+ navTo: 'online/getDirectionsFromTo',
10
+ waypoints: 'online/getDirectionsFromTo',
11
+ accessible: 'online/getDirectionsFromTo',
12
+ showNav: 'online/getDirectionsFromTo',
13
+ poiId: ['online/getDirectionsFromTo', 'online/poiView'],
14
+ vid: 'venueDataLoader',
15
+ stage: 'venueDataLoader',
16
+ contentStage: 'venueDataLoader',
17
+ accountId: 'venueDataLoader',
18
+ search: 'online/headerOnline',
19
+ ho: ['online/getDirectionsFromTo', 'analytics2'], // handoff indicator (used in analytics)
20
+ home: 'online/homeView', // doing a handoff to home view
21
+ zoom: 'mapRenderer',
22
+ pitch: 'mapRenderer',
23
+ bearing: 'mapRenderer',
24
+ lat: 'mapRenderer',
25
+ lng: 'mapRenderer',
26
+ radius: 'mapRenderer',
27
+ buildingId: 'mapRenderer',
28
+ floorId: 'mapRenderer',
29
+ refInstallId: 'analytics2',
30
+ multipointRouting: ['online/getDirectionsFromTo', 'online/poiView']
31
+ };
8
32
 
9
- exports.setDeepLinksForParms = n;
33
+ // Note: see note about security for forceCreate on postproc-stateTracking - same thing
34
+ // applies here!
35
+ function setDeepLinksForParms (config, parms, forceCreate) {
36
+ // allow for lldebug on the URL to set debug mode. I made it "lldebug" just so it wasn't SO easy to guess. ;-)
37
+ if (parms.lldebug !== undefined) {
38
+ try {
39
+ config.debug = JSON.parse(parms.lldebug);
40
+ if (config.debug === null) // allow for a URL parm of just `lldebug` (no value = null)
41
+ config.debug = { };
42
+ } catch (e) { config.debug = true; }
43
+ }
44
+ Object.keys(parmToPlugin)
45
+ .forEach(key => {
46
+ if (parms[key] !== undefined) {
47
+ let plugins = parmToPlugin[key];
48
+ if (!Array.isArray(plugins))
49
+ plugins = [plugins];
50
+ plugins.forEach(plugin => {
51
+ let pc = config.plugins[plugin]; // config for this plugin
52
+ if (!pc && forceCreate)
53
+ pc = config.plugins[plugin] = { };
54
+ pc.deepLinkProps = { ...pc.deepLinkProps, [key]: parms[key] };
55
+ });
56
+ }
57
+ });
58
+
59
+ if (parms.poiId && parms.showNav) // poiId doubles as a parm for both - if showNav is defined, it should target getDirectionsFromTo only
60
+ delete config.plugins['online/poiView'].deepLinkProps.poiId;
61
+
62
+ return config
63
+ }
64
+
65
+ exports.setDeepLinksForParms = setDeepLinksForParms;
@@ -3,29 +3,63 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('query-string');
6
- var e = require('ramda');
6
+ var R = require('ramda');
7
7
  require('zousan');
8
8
 
9
9
  function _interopNamespace(e) {
10
- if (e && e.__esModule) return e;
11
- var n = Object.create(null);
12
- if (e) {
13
- Object.keys(e).forEach(function (k) {
14
- if (k !== 'default') {
15
- var d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: function () { return e[k]; }
19
- });
20
- }
21
- });
22
- }
23
- n["default"] = e;
24
- return Object.freeze(n);
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n["default"] = e;
24
+ return Object.freeze(n);
25
25
  }
26
26
 
27
- var e__namespace = /*#__PURE__*/_interopNamespace(e);
27
+ var R__namespace = /*#__PURE__*/_interopNamespace(R);
28
28
 
29
- function r(r,o,t){const n=JSON.parse(o);return Object.keys(n).forEach((o=>{const p=n[o];let s=r.plugins[o];if(!s&&t&&(s=r.plugins[o]={}),s){const r=s.deepLinkProps;s.deepLinkProps=r?e__namespace.mergeDeepRight(r,p):p;}})),r}
29
+ /**
30
+ * Given a state string (JSON representation of latestState above) this will
31
+ * update the app state (via calling all plugins with their state)
32
+ *
33
+ * Note: forceCreate is a potential security risk. It is used by the SDK BEFORE the extends
34
+ * is processed, so needed here - but a user could prepare a stateString that included
35
+ * some plugin they aren't supposed to have activated. Lets revisit this soon and
36
+ * instead have a way to tell this postprocessor to look for state somewhere BESIDES
37
+ * the location.search - then we can remove dangerous flag. (of course it would take someone
38
+ * incredibly familiar with our source code to exploit this - and currently there is nothing
39
+ * they could gain from it)
40
+ * @param {Object} app App object created in App.js
41
+ * @param {string} stateString stringified JSON object representing state
42
+ * @param {boolean} forceCreate if true, create any plugin entries if not found
43
+ */
44
+ function setStateFromStateString (config, stateString, forceCreate) {
45
+ const state = JSON.parse(stateString);
30
46
 
31
- exports.setStateFromStateString = r;
47
+ // Iterate through each state object, which has a plugin id and key/value state props
48
+ Object.keys(state).forEach(id => {
49
+ const so = state[id];
50
+ let pluginConf = config.plugins[id];
51
+ if (!pluginConf && forceCreate)
52
+ pluginConf = config.plugins[id] = { };
53
+ if (pluginConf) {
54
+ const curDLP = pluginConf.deepLinkProps;
55
+ if (!curDLP)
56
+ pluginConf.deepLinkProps = so;
57
+ else
58
+ pluginConf.deepLinkProps = R__namespace.mergeDeepRight(curDLP, so);
59
+ }
60
+ });
61
+
62
+ return config
63
+ }
64
+
65
+ exports.setStateFromStateString = setStateFromStateString;
@@ -2,13 +2,52 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var e = require('IObject');
5
+ var IObject = require('IObject');
6
6
  var app = require('./app.js');
7
7
 
8
8
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
9
 
10
- var e__default = /*#__PURE__*/_interopDefaultLegacy(e);
10
+ var IObject__default = /*#__PURE__*/_interopDefaultLegacy(IObject);
11
11
 
12
- let r=new e__default["default"];const n=new e__default["default"],a=e=>"undefined"!=typeof window?window.alert(e):console.error(e);async function o(o){if(!o)throw Error("Attempt to create App instance with no configuration");let s=new e__default["default"](Object.assign({},n,o));const c=s.appName||"Instance"+(Object.keys(r).length+1);s=s.set("appName",c);try{const e=await app.create(s);return r=r.set(c,e),e}catch(e){console.error(e),e.message?a(e.message):a("Error creating map. Please try again later.");}}
12
+ /**
13
+ * This manages the creation and organization of your App instances.
14
+ * Each instance is created via the create function - passing in a configuration
15
+ * object, which extends any existing configuration template.
16
+ */
13
17
 
14
- exports.create = o;
18
+ // IObject.freeze = 'DEEP'
19
+
20
+ // This is a list of "instances" of your full app stack. Often this will be only one.
21
+ // If you wish to give it a name, use the appName property. Else one will be assigned.
22
+ let apps = new IObject__default["default"]();
23
+
24
+ // The configuration template is used as the base configurationx for all app
25
+ // instances. It can be set with setConfigTemplate
26
+ const configTemplate = new IObject__default["default"]();
27
+
28
+ const sendAlert = msg => typeof window !== 'undefined' ? window.alert(msg) : console.error(msg);
29
+
30
+ /**
31
+ * Create a new instance of the engine. Pass in a configuration object which will
32
+ * extend the config template.
33
+ * @param {} config Configuration for this instance. Will be shallow copied.
34
+ */
35
+ async function create (config) {
36
+ if (!config) { throw Error('Attempt to create App instance with no configuration') }
37
+
38
+ // Create a new immutable configuration based on the configuration template
39
+ let myConfig = new IObject__default["default"](Object.assign({}, configTemplate, config));
40
+
41
+ // If no name was defined for this instance, create one.
42
+ const appName = myConfig.appName || 'Instance' + (Object.keys(apps).length + 1);
43
+ myConfig = myConfig.set('appName', appName);
44
+
45
+ try {
46
+ const app$1 = await app.create(myConfig);
47
+ // console.log('Got appInstance: ', app)
48
+ apps = apps.set(appName, app$1);
49
+ return app$1
50
+ } catch (e) { console.error(e); e.message ? sendAlert(e.message) : sendAlert('Error creating map. Please try again later.'); }
51
+ }
52
+
53
+ exports.create = create;
@@ -1,30 +1,135 @@
1
1
  'use strict';
2
2
 
3
- var e = require('ramda');
3
+ var R = require('ramda');
4
4
  var navGraphDebug = require('../plugins/wayfinder/src/navGraphDebug.js');
5
5
  var dom = require('./utils/dom.js');
6
6
  var funcs = require('./utils/funcs.js');
7
7
 
8
8
  function _interopNamespace(e) {
9
- if (e && e.__esModule) return e;
10
- var n = Object.create(null);
11
- if (e) {
12
- Object.keys(e).forEach(function (k) {
13
- if (k !== 'default') {
14
- var d = Object.getOwnPropertyDescriptor(e, k);
15
- Object.defineProperty(n, k, d.get ? d : {
16
- enumerable: true,
17
- get: function () { return e[k]; }
18
- });
19
- }
20
- });
21
- }
22
- n["default"] = e;
23
- return Object.freeze(n);
24
- }
25
-
26
- var e__namespace = /*#__PURE__*/_interopNamespace(e);
27
-
28
- "undefined"!=typeof window&&(window.R=e__namespace);const r=(e,n)=>{const s=n.monitor("homeview/performSearch",(({term:t})=>{t||(n.send(e),s());}));};var i={showIcons:()=>{dom.$("#mapRenderDiv").innerHTML="<style> div { display: inline-block; text-align: center; border: 1px solid lightblue; }</style>"+dom.$$("svg symbol").map((e=>`<div><svg><use xlink:href="#${e.id}"/></svg><br/>${e.id}</div>`)).join("");},poisByCategory:function(){return this.bus.send("poi/getAll").then((e=>e[0])).then((e=>Object.values(e))).then(e__namespace.groupBy((e=>e.category)))},highlightNodes:()=>dom.ad({tag:"style",html:"* { background-color: rgba(255,0,0,.2); } * * { background-color: rgba(0,255,0,.2); } * * * { background-color: rgba(0,0,255,.2); } * * * * { background-color: rgba(255,0,255,.2); } * * * * * { background-color: rgba(0,255,255,.2); } * * * * * * { background-color: rgba(255,255,0,.2); } * * * * * * * { background-color: rgba(255,0,0,.2); } * * * * * * * * { background-color: rgba(0,255,0,.2); } * * * * * * * * * { background-color: rgba(0,0,255,.2); }"},dom.$("head")),getPoiById:function(e){return this.bus.send("poi/getById",{id:e}).then((e=>e[0]))},orphanTest:navGraphDebug.orphanTest,showOrphaned:async function(){const e=await this.bus.get("wayfinder/_getNavGraph"),s=navGraphDebug.orphanTest(e._nodes);this.bus.send("map/showOrphanedGraphNodes",{orphanedNodes:s.orphaned});},showgraph:async function(){const e=await this.bus.get("wayfinder/getNavGraphFeatures");this.bus.send("map/showNavGraphFeatures",{navGraph:e}),r("map/resetNavGraphFeatures",this.bus);},dndGo:function(){const e=this.bus,n=(e,n)=>{e.preventDefault(),n?e.target.classList.add("dragover"):e.target.classList.remove("dragover");},s={drop:async function(s){n(s,!1);for(const n of s.dataTransfer.files){const s=n.name;if("application/json"===n.type||n.type.startsWith("text/")){const t=new FileReader;t.onload=funcs.singleFile((async t=>e.send("debugTools/fileDrop",{file:n,filename:s,content:t.target.result}))),t.readAsText(n);}}},dragover:function(e){n(e,!0);},dragleave:function(e){n(e,!1);}};Object.keys(s).forEach((function(e){document.body.addEventListener(e,s[e]);})),console.log("DnD Listeners installed");},bounds:async function(){const e=await this.bus.get("venueData/getVenueCenter"),{venueRadius:n,bounds:s}=await this.bus.get("venueData/getVenueData");this.bus.send("map/showVenueBounds",{venueCenter:e,venueRadius:n,bounds:s}),r("map/resetVenueBounds",this.bus);},buildingBounds:async function(e){this.bus.send("map/showBuildingBounds",{nameFilter:e}),r("map/resetVenueBounds",this.bus);},padding:async function(){this.bus.send("map/togglePadding"),r("map/togglePadding",this.bus);}};
29
-
30
- module.exports = i;
9
+ if (e && e.__esModule) return e;
10
+ var n = Object.create(null);
11
+ if (e) {
12
+ Object.keys(e).forEach(function (k) {
13
+ if (k !== 'default') {
14
+ var d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: function () { return e[k]; }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ n["default"] = e;
23
+ return Object.freeze(n);
24
+ }
25
+
26
+ var R__namespace = /*#__PURE__*/_interopNamespace(R);
27
+
28
+ if (typeof window !== 'undefined')
29
+ window.R = R__namespace; // helps use Rambda in console... probably don't want to do this once we integrate with customer content
30
+
31
+ // NOTE:
32
+ // The exported functions from this module all get placed into the app.debug (accessable from console via _app.debug) and bound to
33
+ // the app instance. So the `this` context will contain the app instance when these are run. This allows you to access objects like
34
+ // the bus via `this.bus` or configuration via `this.config`
35
+ // Update: these are now also available in MoL by searching for `debug:<funcname>` - such as `debug:showIcons`
36
+
37
+ const showIcons = () => { dom.$('#mapRenderDiv').innerHTML = '<style> div { display: inline-block; text-align: center; border: 1px solid lightblue; }</style>' + dom.$$('svg symbol').map(e => `<div><svg><use xlink:href="#${e.id}"/></svg><br/>${e.id}</div>`).join(''); };
38
+
39
+ function poisByCategory () {
40
+ return this.bus.send('poi/getAll')
41
+ .then(r => r[0])
42
+ .then(p => Object.values(p))
43
+ .then(R__namespace.groupBy(o => o.category))
44
+ }
45
+
46
+ const highlightNodes = () => dom.ad({ tag: 'style', html: '* { background-color: rgba(255,0,0,.2); } * * { background-color: rgba(0,255,0,.2); } * * * { background-color: rgba(0,0,255,.2); } * * * * { background-color: rgba(255,0,255,.2); } * * * * * { background-color: rgba(0,255,255,.2); } * * * * * * { background-color: rgba(255,255,0,.2); } * * * * * * * { background-color: rgba(255,0,0,.2); } * * * * * * * * { background-color: rgba(0,255,0,.2); } * * * * * * * * * { background-color: rgba(0,0,255,.2); }' }, dom.$('head'));
47
+
48
+ function getPoiById (id) {
49
+ return this.bus.send('poi/getById', { id })
50
+ .then(r => r[0])
51
+ }
52
+
53
+ async function showOrphaned () {
54
+ const navGraph = await this.bus.get('wayfinder/_getNavGraph');
55
+ const oob = navGraphDebug.orphanTest(navGraph._nodes);
56
+ this.bus.send('map/showOrphanedGraphNodes', { orphanedNodes: oob.orphaned });
57
+ }
58
+
59
+ async function showgraph () {
60
+ const navGraph = await this.bus.get('wayfinder/getNavGraphFeatures');
61
+ this.bus.send('map/showNavGraphFeatures', { navGraph });
62
+ monitorDebugFeaturesReset('map/resetNavGraphFeatures', this.bus);
63
+ }
64
+
65
+ async function bounds () {
66
+ const venueCenter = await this.bus.get('venueData/getVenueCenter');
67
+ const { venueRadius, bounds } = await this.bus.get('venueData/getVenueData');
68
+ this.bus.send('map/showVenueBounds', { venueCenter, venueRadius, bounds });
69
+ monitorDebugFeaturesReset('map/resetVenueBounds', this.bus);
70
+ }
71
+
72
+ async function buildingBounds (nameFilter) {
73
+ this.bus.send('map/showBuildingBounds', { nameFilter });
74
+ monitorDebugFeaturesReset('map/resetVenueBounds', this.bus);
75
+ }
76
+
77
+ async function padding () {
78
+ this.bus.send('map/togglePadding');
79
+ monitorDebugFeaturesReset('map/togglePadding', this.bus);
80
+ }
81
+
82
+ const monitorDebugFeaturesReset = (resetEventName, bus) => {
83
+ const unsubscribe = bus.monitor('homeview/performSearch', ({ term }) => {
84
+ if (!term) {
85
+ bus.send(resetEventName);
86
+ unsubscribe();
87
+ }
88
+ });
89
+ };
90
+
91
+ function dndGo () {
92
+ const bus = this.bus;
93
+ const toggleActive = (e, indicateDragVisual) => {
94
+ e.preventDefault();
95
+ if (indicateDragVisual)
96
+ e.target.classList.add('dragover');
97
+ else
98
+ e.target.classList.remove('dragover');
99
+ };
100
+
101
+ const handlers = {
102
+
103
+ drop: async function (e) {
104
+ toggleActive(e, false);
105
+
106
+ // Load the file into the player
107
+ for (const file of e.dataTransfer.files) {
108
+ const filename = file.name;
109
+ if (file.type === 'application/json' || (file.type.startsWith('text/'))) {
110
+ const reader = new FileReader();
111
+ reader.onload = funcs.singleFile(async e =>
112
+ bus.send(`debugTools/fileDrop`, { file, filename, content: e.target.result }));
113
+ reader.readAsText(file);
114
+ }
115
+ }
116
+ },
117
+
118
+ // Drag-over event
119
+ dragover: function (e) { toggleActive(e, true); },
120
+
121
+ // Drag-leave event
122
+ dragleave: function (e) { toggleActive(e, false); }
123
+
124
+ }; // end of handlers def
125
+
126
+ Object.keys(handlers).forEach(function (event) {
127
+ document.body.addEventListener(event, handlers[event]);
128
+ });
129
+
130
+ console.log('DnD Listeners installed');
131
+ } // end of function installDragNDrop
132
+
133
+ var debugTools = { showIcons, poisByCategory, highlightNodes, getPoiById, orphanTest: navGraphDebug.orphanTest, showOrphaned, showgraph, dndGo, bounds, buildingBounds, padding };
134
+
135
+ module.exports = debugTools;
@@ -2,6 +2,21 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function i(i){const t=i.config.desktopViewMinWidth||0,o="undefined"!=typeof window,s={isBrowser:o,isMobile:()=>o&&innerWidth<t,isLocalhost:()=>location.host.startsWith("localhost")||location.host.startsWith("127.0.0.1"),isDesktop:()=>o&&!s.isMobile()};return o&&window.addEventListener("resize",(()=>i.bus.send("env/resize"))),s}
5
+ function buildEnv (app) {
6
+ const desktopViewMinWidth = app.config.desktopViewMinWidth || 0; // default to desktop view for all sizes
7
+ const isBrowser = typeof window !== 'undefined';
6
8
 
7
- exports.buildEnv = i;
9
+ const env = {
10
+ isBrowser,
11
+ isMobile: () => isBrowser && innerWidth < desktopViewMinWidth,
12
+ isLocalhost: () => location.host.startsWith('localhost') || location.host.startsWith('127.0.0.1'),
13
+ isDesktop: () => isBrowser && !env.isMobile()
14
+ };
15
+
16
+ if (isBrowser)
17
+ window.addEventListener('resize', () => app.bus.send('env/resize'));
18
+
19
+ return env
20
+ }
21
+
22
+ exports.buildEnv = buildEnv;