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.
- package/dist/cjs/_virtual/_empty_module_placeholder.js +2 -2
- package/dist/cjs/deploy/prepareSDKConfig.js +152 -2
- package/dist/cjs/nodesdk/nodeEntry.js +109 -0
- package/dist/cjs/package.json.js +190 -14
- package/dist/cjs/plugins/clientAPI/src/clientAPI.js +11 -2
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +218 -21
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +292 -21
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +99 -20
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +219 -2
- package/dist/cjs/plugins/sdkServer/src/util.js +16 -3
- package/dist/cjs/plugins/searchService/src/poiSearch.js +57 -19
- package/dist/cjs/plugins/searchService/src/searchService.js +246 -21
- package/dist/cjs/plugins/searchService/src/searchTypeahead.js +60 -3
- package/dist/cjs/plugins/searchService/src/utils.js +23 -4
- package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +472 -21
- package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +191 -23
- package/dist/cjs/plugins/wayfinder/src/findRoute.js +147 -19
- package/dist/cjs/plugins/wayfinder/src/minPriorityQueue.js +88 -2
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +393 -5
- package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +110 -20
- package/dist/cjs/plugins/wayfinder/src/segmentBadges.js +28 -2
- package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +257 -19
- package/dist/cjs/plugins/wayfinder/src/segmentCategories.js +29 -2
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +238 -3
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +597 -22
- package/dist/cjs/src/app.js +191 -25
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +58 -2
- package/dist/cjs/src/configs/postproc-stateTracking.js +53 -19
- package/dist/cjs/src/controller.js +43 -4
- package/dist/cjs/src/debugTools.js +128 -23
- package/dist/cjs/src/env.js +17 -2
- package/dist/cjs/src/extModules/bustle.js +128 -4
- package/dist/cjs/src/extModules/flexapi/src/help.js +23 -4
- package/dist/cjs/src/extModules/flexapi/src/index.js +65 -4
- package/dist/cjs/src/extModules/flexapi/src/validate.js +133 -5
- package/dist/cjs/src/extModules/geohasher.js +90 -3
- package/dist/cjs/src/extModules/log.js +69 -2
- package/dist/cjs/src/historyManager.js +29 -2
- package/dist/cjs/src/utils/bounds.js +22 -4
- package/dist/cjs/src/utils/buildStructureLookup.js +31 -19
- package/dist/cjs/src/utils/configUtils.js +71 -3
- package/dist/cjs/src/utils/dom.js +48 -5
- package/dist/cjs/src/utils/funcs.js +30 -3
- package/dist/cjs/src/utils/geodesy.js +35 -3
- package/dist/cjs/src/utils/geom.js +209 -27
- package/dist/cjs/src/utils/i18n.js +69 -5
- package/dist/cjs/src/utils/observable.js +73 -2
- package/dist/cjs/src/utils/rand.js +82 -3
- package/dist/nodesdk/nodeEntry.js +1 -0
- package/dist/package.json.js +1 -0
- package/dist/plugins/searchService/src/searchService.js +1 -0
- package/dist/plugins/venueDataLoader/src/venueDataLoader.js +1 -0
- package/dist/plugins/venueDataLoader/src/venueLoadingUtils.js +1 -0
- package/dist/src/app.js +1 -0
- package/package.json +13 -9
- package/.yarnrc.yml +0 -1
- package/config/rollup.config.cjs.js +0 -31
- package/dist/cjs/deploy/nodeEntry.js +0 -20
- package/dist/cjs/src/auth/Auth.js +0 -23
- package/lib/deploy/nodeEntry.js +0 -1
- package/lib/package.json.js +0 -1
- package/lib/plugins/searchService/src/searchService.js +0 -1
- package/lib/plugins/venueDataLoader/src/venueDataLoader.js +0 -1
- package/lib/plugins/venueDataLoader/src/venueLoadingUtils.js +0 -1
- package/lib/src/app.js +0 -1
- package/lib/src/configs/sdkHeadless.json +0 -28
- /package/{lib → dist}/_virtual/_empty_module_placeholder.js +0 -0
- /package/{lib → dist}/deploy/prepareSDKConfig.js +0 -0
- /package/{lib → dist}/plugins/clientAPI/src/clientAPI.js +0 -0
- /package/{lib → dist}/plugins/dynamicPois/src/dynamicPois.js +0 -0
- /package/{lib → dist}/plugins/poiDataManager/src/poiDataManager.js +0 -0
- /package/{lib → dist}/plugins/sdkServer/src/sdkHeadless.js +0 -0
- /package/{lib → dist}/plugins/sdkServer/src/sdkServer.js +0 -0
- /package/{lib → dist}/plugins/sdkServer/src/util.js +0 -0
- /package/{lib → dist}/plugins/searchService/src/poiSearch.js +0 -0
- /package/{lib → dist}/plugins/searchService/src/searchTypeahead.js +0 -0
- /package/{lib → dist}/plugins/searchService/src/utils.js +0 -0
- /package/{lib → dist}/plugins/wayfinder/src/findRoute.js +0 -0
- /package/{lib → dist}/plugins/wayfinder/src/minPriorityQueue.js +0 -0
- /package/{lib → dist}/plugins/wayfinder/src/navGraph.js +0 -0
- /package/{lib → dist}/plugins/wayfinder/src/navGraphDebug.js +0 -0
- /package/{lib → dist}/plugins/wayfinder/src/segmentBadges.js +0 -0
- /package/{lib → dist}/plugins/wayfinder/src/segmentBuilder.js +0 -0
- /package/{lib → dist}/plugins/wayfinder/src/segmentCategories.js +0 -0
- /package/{lib → dist}/plugins/wayfinder/src/stepBuilder.js +0 -0
- /package/{lib → dist}/plugins/wayfinder/src/wayfinder.js +0 -0
- /package/{lib → dist}/src/configs/postproc-mol-url-parms.js +0 -0
- /package/{lib → dist}/src/configs/postproc-stateTracking.js +0 -0
- /package/{lib → dist}/src/configs/sdkHeadless.json.js +0 -0
- /package/{lib → dist}/src/controller.js +0 -0
- /package/{lib → dist}/src/debugTools.js +0 -0
- /package/{lib → dist}/src/env.js +0 -0
- /package/{lib → dist}/src/extModules/bustle.js +0 -0
- /package/{lib → dist}/src/extModules/flexapi/src/help.js +0 -0
- /package/{lib → dist}/src/extModules/flexapi/src/index.js +0 -0
- /package/{lib → dist}/src/extModules/flexapi/src/validate.js +0 -0
- /package/{lib → dist}/src/extModules/geohasher.js +0 -0
- /package/{lib → dist}/src/extModules/log.js +0 -0
- /package/{lib → dist}/src/historyManager.js +0 -0
- /package/{lib → dist}/src/utils/bounds.js +0 -0
- /package/{lib → dist}/src/utils/buildStructureLookup.js +0 -0
- /package/{lib → dist}/src/utils/configUtils.js +0 -0
- /package/{lib → dist}/src/utils/dom.js +0 -0
- /package/{lib → dist}/src/utils/funcs.js +0 -0
- /package/{lib → dist}/src/utils/geodesy.js +0 -0
- /package/{lib → dist}/src/utils/geom.js +0 -0
- /package/{lib → dist}/src/utils/i18n.js +0 -0
- /package/{lib → dist}/src/utils/observable.js +0 -0
- /package/{lib → dist}/src/utils/rand.js +0 -0
package/dist/cjs/src/app.js
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
|
39
|
-
var
|
|
40
|
-
var
|
|
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
|
|
43
|
+
const isBrowser = typeof window !== 'undefined';
|
|
43
44
|
|
|
44
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
6
|
+
var R = require('ramda');
|
|
7
7
|
require('zousan');
|
|
8
8
|
|
|
9
9
|
function _interopNamespace(e) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
27
|
+
var R__namespace = /*#__PURE__*/_interopNamespace(R);
|
|
28
28
|
|
|
29
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
10
|
+
var IObject__default = /*#__PURE__*/_interopDefaultLegacy(IObject);
|
|
11
11
|
|
|
12
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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;
|
package/dist/cjs/src/env.js
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
function
|
|
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
|
-
|
|
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;
|