atriusmaps-node-sdk 1.0.0 → 3.2.28
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/README.md +76 -0
- package/config/rollup.config.cjs.js +31 -0
- package/dist/cjs/_virtual/_empty_module_placeholder.js +5 -0
- package/dist/cjs/deploy/nodeEntry.js +15 -0
- package/dist/cjs/deploy/prepareSDKConfig.js +9 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/package.json.js +11 -0
- package/dist/cjs/plugins/clientAPI/src/clientAPI.js +9 -0
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +33 -0
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +36 -0
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +31 -0
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +13 -0
- package/dist/cjs/plugins/sdkServer/src/util.js +10 -0
- package/dist/cjs/plugins/searchService/src/poiSearch.js +28 -0
- package/dist/cjs/plugins/searchService/src/searchService.js +37 -0
- package/dist/cjs/plugins/searchService/src/searchTypeahead.js +8 -0
- package/dist/cjs/plugins/searchService/src/utils.js +13 -0
- package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +36 -0
- package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +34 -0
- package/dist/cjs/plugins/wayfinder/src/findRoute.js +30 -0
- package/dist/cjs/plugins/wayfinder/src/minPriorityQueue.js +5 -0
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +13 -0
- package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +30 -0
- package/dist/cjs/plugins/wayfinder/src/segmentBadges.js +5 -0
- package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +32 -0
- package/dist/cjs/plugins/wayfinder/src/segmentCategories.js +5 -0
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +10 -0
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +40 -0
- package/dist/cjs/src/app.js +44 -0
- package/dist/cjs/src/auth/Auth.js +23 -0
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +9 -0
- package/dist/cjs/src/configs/postproc-stateTracking.js +31 -0
- package/dist/cjs/src/configs/sdkHeadless.json.js +47 -0
- package/dist/cjs/src/controller.js +14 -0
- package/dist/cjs/src/debugTools.js +30 -0
- package/dist/cjs/src/env.js +7 -0
- package/dist/cjs/src/extModules/bustle.js +13 -0
- package/dist/cjs/src/extModules/flexapi/src/help.js +9 -0
- package/dist/cjs/src/extModules/flexapi/src/index.js +13 -0
- package/dist/cjs/src/extModules/flexapi/src/validate.js +10 -0
- package/dist/cjs/src/extModules/geohasher.js +8 -0
- package/dist/cjs/src/extModules/log.js +7 -0
- package/dist/cjs/src/historyManager.js +7 -0
- package/dist/cjs/src/utils/bounds.js +10 -0
- package/dist/cjs/src/utils/buildStructureLookup.js +29 -0
- package/dist/cjs/src/utils/configUtils.js +8 -0
- package/dist/cjs/src/utils/dom.js +10 -0
- package/dist/cjs/src/utils/funcs.js +15 -0
- package/dist/cjs/src/utils/geodesy.js +8 -0
- package/dist/cjs/src/utils/geom.js +35 -0
- package/dist/cjs/src/utils/i18n.js +14 -0
- package/dist/cjs/src/utils/observable.js +5 -0
- package/dist/cjs/src/utils/rand.js +8 -0
- package/lib/_virtual/_empty_module_placeholder.js +1 -0
- package/lib/deploy/nodeEntry.js +1 -58
- package/lib/deploy/prepareSDKConfig.js +1 -112
- package/lib/package.json.js +1 -143
- package/lib/plugins/clientAPI/src/clientAPI.js +1 -14
- package/lib/plugins/dynamicPois/src/dynamicPois.js +1 -131
- package/lib/plugins/poiDataManager/src/poiDataManager.js +1 -207
- package/lib/plugins/sdkServer/src/sdkHeadless.js +1 -53
- package/lib/plugins/sdkServer/src/sdkServer.js +1 -211
- package/lib/plugins/sdkServer/src/util.js +1 -18
- package/lib/plugins/searchService/src/poiSearch.js +1 -39
- package/lib/plugins/searchService/src/searchService.js +1 -234
- package/lib/plugins/searchService/src/searchTypeahead.js +1 -63
- package/lib/plugins/searchService/src/utils.js +1 -30
- package/lib/plugins/venueDataLoader/src/venueDataLoader.js +1 -465
- package/lib/plugins/venueDataLoader/src/venueLoadingUtils.js +1 -84
- package/lib/plugins/wayfinder/src/findRoute.js +1 -134
- package/lib/plugins/wayfinder/src/minPriorityQueue.js +1 -89
- package/lib/plugins/wayfinder/src/navGraph.js +1 -370
- package/lib/plugins/wayfinder/src/navGraphDebug.js +1 -95
- package/lib/plugins/wayfinder/src/segmentBadges.js +1 -29
- package/lib/plugins/wayfinder/src/segmentBuilder.js +1 -241
- package/lib/plugins/wayfinder/src/segmentCategories.js +1 -30
- package/lib/plugins/wayfinder/src/stepBuilder.js +1 -236
- package/lib/plugins/wayfinder/src/wayfinder.js +1 -452
- package/lib/src/app.js +1 -150
- package/lib/src/auth/Auth.js +1 -35
- package/lib/src/configs/postproc-mol-url-parms.js +1 -58
- package/lib/src/configs/postproc-stateTracking.js +1 -40
- package/lib/src/configs/sdkHeadless.json.js +1 -42
- package/lib/src/controller.js +1 -45
- package/lib/src/debugTools.js +1 -108
- package/lib/src/env.js +1 -17
- package/lib/src/extModules/bustle.js +1 -126
- package/lib/src/extModules/flexapi/src/help.js +1 -21
- package/lib/src/extModules/flexapi/src/index.js +1 -66
- package/lib/src/extModules/flexapi/src/validate.js +1 -131
- package/lib/src/extModules/geohasher.js +1 -90
- package/lib/src/extModules/log.js +1 -70
- package/lib/src/historyManager.js +1 -30
- package/lib/src/utils/bounds.js +1 -23
- package/lib/src/utils/buildStructureLookup.js +1 -17
- package/lib/src/utils/configUtils.js +1 -61
- package/lib/src/utils/dom.js +1 -46
- package/lib/src/utils/funcs.js +1 -50
- package/lib/src/utils/geodesy.js +1 -35
- package/lib/src/utils/geom.js +1 -141
- package/lib/src/utils/i18n.js +1 -70
- package/lib/src/utils/observable.js +1 -76
- package/lib/src/utils/rand.js +1 -82
- package/package.json +23 -6
- package/lib/_virtual/_empty_module_placeholder +0 -3
package/lib/deploy/nodeEntry.js
CHANGED
|
@@ -1,58 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import pkg from '../package.json.js';
|
|
3
|
-
import { create } from '../src/controller.js';
|
|
4
|
-
import create$1 from '../src/utils/observable.js';
|
|
5
|
-
import prepareSDKConfig from './prepareSDKConfig.js';
|
|
6
|
-
|
|
7
|
-
const version = pkg.version;
|
|
8
|
-
|
|
9
|
-
if (!globalThis.fetch) {
|
|
10
|
-
globalThis.fetch = fetch;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// this iterates through available commands and makes them member functions of map
|
|
14
|
-
function addCommands (map, commands) {
|
|
15
|
-
commands.forEach(sig => {
|
|
16
|
-
map[sig.command] = function () {
|
|
17
|
-
const cob = { command: sig.command };
|
|
18
|
-
for (let i = 0; i < arguments.length; i++)
|
|
19
|
-
cob[sig.args[i].name] = arguments[i];
|
|
20
|
-
return map(cob)
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async function newMap (sdkConfig) {
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
sdkConfig.headless = true ;
|
|
28
|
-
|
|
29
|
-
const config = prepareSDKConfig(sdkConfig);
|
|
30
|
-
|
|
31
|
-
create(config)
|
|
32
|
-
.then(app => {
|
|
33
|
-
const map = (payload, arg2) => {
|
|
34
|
-
if (typeof payload === 'string')
|
|
35
|
-
payload = { ...arg2, command: payload };
|
|
36
|
-
return app.bus.get('clientAPI/execute', payload)
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
create$1(map); // make map handle events pub/sub
|
|
40
|
-
app.eventListener.detachAll();
|
|
41
|
-
app.eventListener.observe(function () { map.fire.apply(map, arguments); }); // pass it on...
|
|
42
|
-
|
|
43
|
-
map.on('ready', (eName, data) => {
|
|
44
|
-
const { commands/*, customTypes */ } = data.commandJSON;
|
|
45
|
-
addCommands(map, commands);
|
|
46
|
-
resolve(map);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const Init = {
|
|
53
|
-
getVersion: () => version,
|
|
54
|
-
newMap: config => newMap(config),
|
|
55
|
-
setLogging: flag => { }
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export default Init;
|
|
1
|
+
import o from"node-fetch";import e from"../package.json.js";import{create as n}from"../src/controller.js";import t from"../src/utils/observable.js";import r from"./prepareSDKConfig.js";const s=e.version;globalThis.fetch||(globalThis.fetch=o);const c={getVersion:()=>s,newMap:o=>async function(o){return new Promise(((e,s)=>{o.headless=!0;const c=r(o);n(c).then((o=>{const n=(e,n)=>("string"==typeof e&&(e={...n,command:e}),o.bus.get("clientAPI/execute",e));t(n),o.eventListener.observe((function(){n.fire.apply(n,arguments)})),n.on("ready",((o,t)=>{const{commands:r}=t.commandJSON;!function(o,e){e.forEach((e=>{o[e.command]=function(){const n={command:e.command};for(let o=0;o<arguments.length;o++)n[e.args[o].name]=arguments[o];return o(n)}}))}(n,r),e(n)}))}))}))}(o)};export{c as default};
|
|
@@ -1,112 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { setStateFromStateString } from '../src/configs/postproc-stateTracking.js';
|
|
3
|
-
import { filterOb } from '../src/utils/funcs.js';
|
|
4
|
-
|
|
5
|
-
function prepareSDKConfig (sc) {
|
|
6
|
-
const {
|
|
7
|
-
name, debug, headless, theme, defaultSearchTerms, venueId, accountId,
|
|
8
|
-
poiCategories, preserveStateInURL, supportURLDeepLinks, initState,
|
|
9
|
-
deepLinkParms, uiHide, renderDiv, parentConfig, desktopViewMinWidth,
|
|
10
|
-
forceDesktop, hostAppId, hostAppVersion, hostAppProperties, logFilter
|
|
11
|
-
} = sc;
|
|
12
|
-
|
|
13
|
-
const extendsConfig = parentConfig ? [parentConfig] : (headless ? ['sdkHeadless'] : ['sdkVisual']);
|
|
14
|
-
|
|
15
|
-
const trunc = (str, len) => str && str.length > len ? str.substring(0, len) : str;
|
|
16
|
-
|
|
17
|
-
const validateHostAppId = hostAppId => hostAppId ? trunc(hostAppId.toString(), 128) : undefined;
|
|
18
|
-
const validateHostAppVersion = hostAppVersion => hostAppVersion ? trunc(hostAppVersion.toString(), 128) : undefined;
|
|
19
|
-
const validateHostAppProperties = hostAppProperties => {
|
|
20
|
-
if (!hostAppProperties || typeof hostAppProperties !== 'object')
|
|
21
|
-
return undefined
|
|
22
|
-
|
|
23
|
-
const ret = { }; // lets build this back up ourselves to ensure its purity
|
|
24
|
-
|
|
25
|
-
const keys = Object.keys(hostAppProperties);
|
|
26
|
-
|
|
27
|
-
if (keys.length > 10)
|
|
28
|
-
keys.length = 10;
|
|
29
|
-
|
|
30
|
-
keys.forEach(key => {
|
|
31
|
-
let cleanKey = trunc(key.toString().replaceAll(/[^a-zA-Z0-9_]/g, ''), 128);
|
|
32
|
-
if (!cleanKey.match(/^[a-zA-Z]+/))
|
|
33
|
-
cleanKey = 'X' + cleanKey; // force to start with alpha char
|
|
34
|
-
let cleanVal = hostAppProperties[key];
|
|
35
|
-
if (cleanVal === null || cleanVal === undefined)
|
|
36
|
-
cleanVal = '';
|
|
37
|
-
cleanVal = trunc(cleanVal.toString(), 128);
|
|
38
|
-
ret[cleanKey] = cleanVal;
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
return ret
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const config = {
|
|
45
|
-
name,
|
|
46
|
-
extends: extendsConfig,
|
|
47
|
-
debug,
|
|
48
|
-
logFilter,
|
|
49
|
-
theme,
|
|
50
|
-
uiHide,
|
|
51
|
-
renderDiv,
|
|
52
|
-
configPostProc: [],
|
|
53
|
-
plugins: {
|
|
54
|
-
venueDataLoader: {
|
|
55
|
-
venueId,
|
|
56
|
-
accountId
|
|
57
|
-
},
|
|
58
|
-
sdkServer: {
|
|
59
|
-
headless
|
|
60
|
-
},
|
|
61
|
-
analytics2: {
|
|
62
|
-
hostAppId: validateHostAppId(hostAppId),
|
|
63
|
-
hostAppVersion: validateHostAppVersion(hostAppVersion),
|
|
64
|
-
hostAppProperties: validateHostAppProperties(hostAppProperties)
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
uuid: typeof (document) !== 'undefined' && document && document.location ? document.location.host : 'unknown' // used in analytics
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
config.plugins.searchService = defaultSearchTerms
|
|
71
|
-
? { defaultSearchTerms }
|
|
72
|
-
: { };
|
|
73
|
-
handleI18NParm(sc, 'defaultSearchTerms', config.plugins.searchService);
|
|
74
|
-
|
|
75
|
-
if (extendsConfig.includes('sdkVisual')) {
|
|
76
|
-
if (poiCategories)
|
|
77
|
-
config.plugins['online/homeView'] = { poiCategories };
|
|
78
|
-
else
|
|
79
|
-
config.plugins['online/homeView'] = { };
|
|
80
|
-
handleI18NParm(sc, 'poiCategories', config.plugins['online/homeView']);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (preserveStateInURL) {
|
|
84
|
-
config.configPostProc.push('stateTracking');
|
|
85
|
-
config.plugins.deepLinking = { trackURL: true };
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (supportURLDeepLinks)
|
|
89
|
-
config.configPostProc.push('mol-url-parms');
|
|
90
|
-
|
|
91
|
-
if (initState)
|
|
92
|
-
setStateFromStateString(config, atob(initState), true);
|
|
93
|
-
|
|
94
|
-
if (deepLinkParms)
|
|
95
|
-
setDeepLinksForParms(config, deepLinkParms, true);
|
|
96
|
-
|
|
97
|
-
if (desktopViewMinWidth !== undefined)
|
|
98
|
-
config.desktopViewMinWidth = desktopViewMinWidth;
|
|
99
|
-
|
|
100
|
-
if (forceDesktop)
|
|
101
|
-
config.desktopViewMinWidth = 0;
|
|
102
|
-
|
|
103
|
-
return filterOb((k, v) => v !== undefined, config) // remove any undefined values
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function handleI18NParm (sdkConfig, prefix, configDest) {
|
|
107
|
-
Object.keys(sdkConfig)
|
|
108
|
-
.filter(key => key.startsWith(prefix + '-'))
|
|
109
|
-
.forEach(key => (configDest[key] = sdkConfig[key]));
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export default prepareSDKConfig;
|
|
1
|
+
import{setDeepLinksForParms as e}from"../src/configs/postproc-mol-url-parms.js";import{setStateFromStateString as t}from"../src/configs/postproc-stateTracking.js";import{filterOb as o}from"../src/utils/funcs.js";function i(i){const{name:s,debug:r,headless:a,theme:c,defaultSearchTerms:d,venueId:p,accountId:l,poiCategories:u,preserveStateInURL:h,supportURLDeepLinks:g,initState:m,deepLinkParms:f,uiHide:k,renderDiv:v,parentConfig:S,desktopViewMinWidth:P,forceDesktop:A,hostAppId:V,hostAppVersion:b,hostAppProperties:I,logFilter:L,searchPlaceholder:j,dataFetch:w,engineName:y}=i,D=S?[S]:a?["sdkHeadless"]:["sdkVisual"],T=(e,t)=>e&&e.length>t?e.substring(0,t):e,C={name:s,engineName:y,extends:D,debug:r,logFilter:L,theme:c,uiHide:k,renderDiv:v,configPostProc:[],plugins:{venueDataLoader:{dataFetch:w,venueId:p,accountId:l},sdkServer:{headless:a},analytics2:{hostAppId:(e=>e?T(e.toString(),128):void 0)(V),hostAppVersion:(e=>e?T(e.toString(),128):void 0)(b),hostAppProperties:(e=>{if(!e||"object"!=typeof e)return;const t={},o=Object.keys(e);return o.length>10&&(o.length=10),o.forEach((o=>{let i=T(o.toString().replaceAll(/[^a-zA-Z0-9_]/g,""),128);i.match(/^[a-zA-Z]+/)||(i="X"+i);let n=e[o];null==n&&(n=""),n=T(n.toString(),128),t[i]=n})),t})(I)}},uuid:"undefined"!=typeof document&&document&&document.location?document.location.host:"unknown"};return a||(C.plugins["online/headerOnline"]={searchPlaceholder:j}),C.plugins.searchService=d?{defaultSearchTerms:d}:{},n(i,"defaultSearchTerms",C.plugins.searchService),D.includes("sdkVisual")&&(C.plugins["online/homeView"]=u?{poiCategories:u}:{},n(i,"poiCategories",C.plugins["online/homeView"])),h&&(C.configPostProc.push("stateTracking"),C.plugins.deepLinking={trackURL:!0}),g&&C.configPostProc.push("mol-url-parms"),m&&t(C,atob(m),!0),f&&e(C,f,!0),void 0!==P&&(C.desktopViewMinWidth=P),A&&(C.desktopViewMinWidth=0),o(((e,t)=>void 0!==t),C)}function n(e,t,o){Object.keys(e).filter((e=>e.startsWith(t+"-"))).forEach((t=>o[t]=e[t]))}export{i as default};
|
package/lib/package.json.js
CHANGED
|
@@ -1,143 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
var version = "3.2.9";
|
|
3
|
-
var main = "src/main.js";
|
|
4
|
-
var type = "module";
|
|
5
|
-
var scripts = {
|
|
6
|
-
demo: "cd demo/ && yarn start",
|
|
7
|
-
e2eTest: "percy exec -- cypress run --browser chrome",
|
|
8
|
-
goProd: "cd deploy && scripts/goProd.sh",
|
|
9
|
-
goStaging: "deploy/scripts/goStaging.sh",
|
|
10
|
-
mod: "demo/startMod.sh",
|
|
11
|
-
mol: "demo/startMol.sh",
|
|
12
|
-
mos: "demo/startMos.sh",
|
|
13
|
-
prepare: "husky install",
|
|
14
|
-
test: "jest --no-cache --verbose",
|
|
15
|
-
"test-watch": "jest --verbose --watch"
|
|
16
|
-
};
|
|
17
|
-
var dependencies = {
|
|
18
|
-
"@aws-amplify/auth": "^4.1.2",
|
|
19
|
-
"@azure/event-hubs": "^5.6.0",
|
|
20
|
-
"@john-osullivan/react-window-dynamic-fork": "^1.9.0-alpha.1",
|
|
21
|
-
"@locus-labs/mod-badge": "^0.1.11",
|
|
22
|
-
"@locus-labs/mod-default-theme": "^0.0.27",
|
|
23
|
-
"@locus-labs/mod-footer": "^0.0.25",
|
|
24
|
-
"@locus-labs/mod-header": "^0.0.19",
|
|
25
|
-
"@locus-labs/mod-location-marker": "^0.0.18",
|
|
26
|
-
"@locus-labs/mod-map-legend": "^0.0.18",
|
|
27
|
-
"@locus-labs/mod-offscreen-indicator": "^0.0.18",
|
|
28
|
-
"@locus-labs/mod-pin": "^0.0.18",
|
|
29
|
-
"@locus-labs/mod-qr-code-card": "^0.0.18",
|
|
30
|
-
"@locus-labs/mod-qr-code-window": "^0.0.19",
|
|
31
|
-
"@locus-labs/mod-walk-time-matrix": "^0.0.17",
|
|
32
|
-
"@locus-labs/mol-desktop-building-level-selector": "^0.1.15",
|
|
33
|
-
"@locus-labs/mol-desktop-compass": "^0.1.29",
|
|
34
|
-
"@locus-labs/mol-desktop-default-theme": "^0.2.13",
|
|
35
|
-
"@locus-labs/mol-desktop-icon": "^0.1.45",
|
|
36
|
-
"@locus-labs/mol-desktop-logo": "^0.1.10",
|
|
37
|
-
"@locus-labs/mol-desktop-map-nav-button": "^0.1.39",
|
|
38
|
-
"@locus-labs/mol-desktop-submenu": "^0.1.30",
|
|
39
|
-
"@locus-labs/mol-desktop-tooltip": "^0.3.11",
|
|
40
|
-
"@locus-labs/mol-desktop-zoom-control": "^0.1.37",
|
|
41
|
-
"@locus-labs/mol-mobile-floating-action-button": "^0.0.20",
|
|
42
|
-
"@locus-labs/mol-mobile-toast": "^0.1.11",
|
|
43
|
-
"@turf/circle": "^6.5.0",
|
|
44
|
-
IObject: "^0.6.2",
|
|
45
|
-
"crypto-browserify": "^3.12.0",
|
|
46
|
-
"file-loader": "^6.2.0",
|
|
47
|
-
flexsearch: "^0.6.32",
|
|
48
|
-
i18next: "^20.3.4",
|
|
49
|
-
"i18next-browser-languagedetector": "^6.1.1",
|
|
50
|
-
jsonschema: "^1.2.6",
|
|
51
|
-
luxon: "^2.0.1",
|
|
52
|
-
"mapbox-gl": "^1.12.0",
|
|
53
|
-
"mini-css-extract-plugin": "^1.6.0",
|
|
54
|
-
msal: "1.4.11",
|
|
55
|
-
"node-polyfill-webpack-plugin": "^1.1.4",
|
|
56
|
-
"path-browserify": "^1.0.1",
|
|
57
|
-
polished: "^4.0.2",
|
|
58
|
-
"prop-types": "^15.7.2",
|
|
59
|
-
"query-string": "7.0.1",
|
|
60
|
-
ramda: "^0.27.0",
|
|
61
|
-
react: "^17.0.2",
|
|
62
|
-
"react-compound-slider": "^3.3.1",
|
|
63
|
-
"react-dom": "^17.0.2",
|
|
64
|
-
"react-json-editor-ajrm": "^2.5.13",
|
|
65
|
-
"react-qr-svg": "^2.2.1",
|
|
66
|
-
"react-svg": "^11.2.5",
|
|
67
|
-
"react-tageditor": "^0.2.3",
|
|
68
|
-
"react-virtualized-auto-sizer": "^1.0.2",
|
|
69
|
-
"styled-components": "5.1.0",
|
|
70
|
-
"styled-normalize": "^8.0.6",
|
|
71
|
-
"throttle-debounce": "^3.0.1",
|
|
72
|
-
trackjs: "^3.7.4",
|
|
73
|
-
"ua-parser-js": "^0.7.23",
|
|
74
|
-
uuid: "3.3.2",
|
|
75
|
-
zousan: "^3.0.1",
|
|
76
|
-
"zousan-plus": "^4.0.1"
|
|
77
|
-
};
|
|
78
|
-
var devDependencies = {
|
|
79
|
-
"@babel/core": "^7.14.8",
|
|
80
|
-
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
|
81
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
82
|
-
"@babel/plugin-transform-modules-commonjs": "^7.8.3",
|
|
83
|
-
"@babel/plugin-transform-runtime": "^7.8.3",
|
|
84
|
-
"@babel/preset-env": "^7.14.8",
|
|
85
|
-
"@babel/preset-react": "^7.8.3",
|
|
86
|
-
"@percy/cli": "^1.0.0-beta.60",
|
|
87
|
-
"@percy/cypress": "^3.1.0",
|
|
88
|
-
"babel-eslint": "^10.0.1",
|
|
89
|
-
"babel-jest": "^27.0.6",
|
|
90
|
-
"babel-loader": "^8.2.2",
|
|
91
|
-
"babel-plugin-inline-json-import": "^0.3.2",
|
|
92
|
-
"babel-plugin-module-resolver": "^4.0.0",
|
|
93
|
-
"babel-polyfill": "^6.26.0",
|
|
94
|
-
"chai-colors": "^1.0.1",
|
|
95
|
-
"css-loader": "^5.2.4",
|
|
96
|
-
cypress: "^7.4.0",
|
|
97
|
-
"cypress-wait-until": "^1.7.1",
|
|
98
|
-
eslint: "^7.4.0",
|
|
99
|
-
"eslint-config-standard": "^16.0.3",
|
|
100
|
-
"eslint-plugin-cypress": "^2.11.1",
|
|
101
|
-
"eslint-plugin-import": "^2.16.0",
|
|
102
|
-
"eslint-plugin-jest": "^24.3.6",
|
|
103
|
-
"eslint-plugin-node": "^11.1.0",
|
|
104
|
-
"eslint-plugin-promise": "^5.1.0",
|
|
105
|
-
"eslint-plugin-react": "^7.12.4",
|
|
106
|
-
"eslint-plugin-standard": "^5.0.0",
|
|
107
|
-
"fetch-mock-jest": "^1.3.0",
|
|
108
|
-
husky: "^6.0.0",
|
|
109
|
-
jest: "^26.0.0",
|
|
110
|
-
"jest-transform-css": "^2.0.0",
|
|
111
|
-
"lint-staged": "^11.0.1",
|
|
112
|
-
"node-fetch": "^2.6.0",
|
|
113
|
-
"null-loader": "^4.0.1",
|
|
114
|
-
webpack: "^5.45.1",
|
|
115
|
-
"webpack-merge": "^5.8.0"
|
|
116
|
-
};
|
|
117
|
-
var license = "UNLICENSED";
|
|
118
|
-
var workspaces = [
|
|
119
|
-
"demo",
|
|
120
|
-
"deploy",
|
|
121
|
-
"pageSrc",
|
|
122
|
-
"src/extModules/flexapi"
|
|
123
|
-
];
|
|
124
|
-
var pkg = {
|
|
125
|
-
name: name,
|
|
126
|
-
version: version,
|
|
127
|
-
main: main,
|
|
128
|
-
type: type,
|
|
129
|
-
scripts: scripts,
|
|
130
|
-
dependencies: dependencies,
|
|
131
|
-
devDependencies: devDependencies,
|
|
132
|
-
"lint-staged": {
|
|
133
|
-
"*.js": [
|
|
134
|
-
"eslint --fix"
|
|
135
|
-
]
|
|
136
|
-
},
|
|
137
|
-
license: license,
|
|
138
|
-
workspaces: workspaces,
|
|
139
|
-
"private": true
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
export default pkg;
|
|
143
|
-
export { dependencies, devDependencies, license, main, name, scripts, type, version, workspaces };
|
|
1
|
+
var e="web-engine",s="3.2.28",o="src/main.js",l="module",a={demo:"cd demo/ && yarn start",e2eTest:"percy exec -- cypress run --browser chrome",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh",mod:"demo/startMod.sh",mol:"demo/startMol.sh",mos:"demo/startMos.sh",prepare:"husky install",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch"},t={"@aws-amplify/auth":"^4.1.2","@azure/event-hubs":"^5.6.0","@john-osullivan/react-window-dynamic-fork":"^1.9.0-alpha.1","@locus-labs/mod-badge":"^0.1.11","@locus-labs/mod-default-theme":"^0.0.27","@locus-labs/mod-footer":"^0.0.25","@locus-labs/mod-header":"^0.0.19","@locus-labs/mod-location-marker":"^0.0.18","@locus-labs/mod-map-legend":"^0.0.18","@locus-labs/mod-offscreen-indicator":"^0.0.18","@locus-labs/mod-pin":"^0.0.18","@locus-labs/mod-qr-code-card":"^0.0.18","@locus-labs/mod-qr-code-window":"^0.0.19","@locus-labs/mod-walk-time-matrix":"^0.0.17","@locus-labs/mol-desktop-building-level-selector":"^0.1.15","@locus-labs/mol-desktop-compass":"^0.1.29","@locus-labs/mol-desktop-default-theme":"^0.2.13","@locus-labs/mol-desktop-icon":"^0.1.45","@locus-labs/mol-desktop-logo":"^0.1.10","@locus-labs/mol-desktop-map-nav-button":"^0.1.39","@locus-labs/mol-desktop-submenu":"^0.1.30","@locus-labs/mol-desktop-tooltip":"^0.3.11","@locus-labs/mol-desktop-zoom-control":"^0.1.37","@locus-labs/mol-mobile-floating-action-button":"^0.0.20","@locus-labs/mol-mobile-toast":"^0.1.11","@turf/circle":"^6.5.0",IObject:"^0.6.2","crypto-browserify":"^3.12.0","file-loader":"^6.2.0",flexsearch:"0.6.32",i18next:"^20.3.4","i18next-browser-languagedetector":"^6.1.1",jsonschema:"^1.2.6",luxon:"^2.0.1","mapbox-gl":"^1.12.0","mini-css-extract-plugin":"^1.6.0",msal:"1.4.11","node-polyfill-webpack-plugin":"^1.1.4","path-browserify":"^1.0.1",polished:"^4.0.2","prop-types":"^15.7.2","query-string":"7.0.1",ramda:"^0.27.0",react:"^17.0.2","react-compound-slider":"^3.3.1","react-dom":"^17.0.2","react-json-editor-ajrm":"^2.5.13","react-qr-svg":"^2.2.1","react-svg":"^11.2.5","react-tageditor":"^0.2.3","react-virtualized-auto-sizer":"^1.0.2","smoothscroll-polyfill":"^0.4.4","styled-components":"5.1.0","styled-normalize":"^8.0.6","throttle-debounce":"^3.0.1",trackjs:"^3.7.4","ua-parser-js":"^0.7.23",uuid:"3.3.2",zousan:"^3.0.1","zousan-plus":"^4.0.1"},r={"@babel/core":"^7.14.8","@babel/plugin-proposal-class-properties":"^7.8.3","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-transform-modules-commonjs":"^7.8.3","@babel/plugin-transform-runtime":"^7.8.3","@babel/preset-env":"^7.14.8","@babel/preset-react":"^7.8.3","@percy/cli":"^1.0.0-beta.60","@percy/cypress":"^3.1.0","babel-eslint":"^10.0.1","babel-jest":"^27.0.6","babel-loader":"^8.2.2","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^4.0.0","babel-polyfill":"^6.26.0","chai-colors":"^1.0.1","css-loader":"^5.2.4",cypress:"9.5.2","cypress-wait-until":"^1.7.1",eslint:"^7.4.0","eslint-config-standard":"^16.0.3","eslint-plugin-cypress":"^2.11.1","eslint-plugin-import":"^2.16.0","eslint-plugin-jest":"^24.3.6","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.1.0","eslint-plugin-react":"^7.12.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.3.0",husky:"^6.0.0",jest:"^26.0.0","jest-transform-css":"^2.0.0","lint-staged":"^11.0.1","node-fetch":"^2.6.0","null-loader":"^4.0.1",webpack:"^5.45.1","webpack-merge":"^5.8.0"},c="UNLICENSED",n=["demo","deploy","pageSrc","src/extModules/flexapi"],i={name:"web-engine",version:"3.2.28",main:"src/main.js",type:"module",scripts:a,dependencies:t,devDependencies:r,"lint-staged":{"*.js":["eslint --fix"]},license:"UNLICENSED",workspaces:n,private:!0};export{i as default,t as dependencies,r as devDependencies,c as license,o as main,e as name,a as scripts,l as type,s as version,n as workspaces};
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
function create (app, config) {
|
|
4
|
-
clearCommands();
|
|
5
|
-
app.bus.on('clientAPI/registerCommand', ob => registerCommand(ob, cob => app.bus.get(`clientAPI/${cob.command}`, cob)));
|
|
6
|
-
app.bus.on('clientAPI/registerCustomType', ({ name, spec }) => registerCustomType(name, spec));
|
|
7
|
-
app.bus.on('clientAPI/execute', execute);
|
|
8
|
-
|
|
9
|
-
return {
|
|
10
|
-
init: () => {} // nothing more to do
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { create };
|
|
1
|
+
import e from"../../../src/extModules/flexapi/src/index.js";function t(t,n){const s=e();return t.bus.on("clientAPI/registerCommand",(e=>s.registerCommand(e,(e=>t.bus.get(`clientAPI/${e.command}`,e))))),t.bus.on("clientAPI/registerCustomType",(({name:e,spec:t})=>s.registerCustomType(e,t))),t.bus.on("clientAPI/execute",(e=>s.execute(e))),{init:()=>{}}}export{t as create};
|
|
@@ -1,131 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Zousan from 'zousan';
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
This service obtains dynamic POI data from our own backend REST API service.
|
|
6
|
-
Currently it drives dynamic data for Security Wait Times and Parking Status.
|
|
7
|
-
|
|
8
|
-
Configuration Properties Recognized:
|
|
9
|
-
urlBase : to override the REST url base. i.e. for alpha use 'https://rest-alpha.locuslabs.com/v1'. You can also reference
|
|
10
|
-
a local file, such as './testDynamicPois.json'
|
|
11
|
-
|
|
12
|
-
Values defined by 'parking':
|
|
13
|
-
lotName: Name of the lot for this POI, such as 'East'
|
|
14
|
-
lotStatus: returns either 'Closed' or 'Open'
|
|
15
|
-
timeIsReal: If true, the time here is live and valid, else its a default fallback
|
|
16
|
-
rateDay: Daily Rate expressed in English: '$17 per day'
|
|
17
|
-
rateHour: Hourly Rate expressed in English: '$5 per hour'
|
|
18
|
-
timeToTerminal1: Time in walking or by shuttle to Terminal 1 : 'Shuttle 5-7'
|
|
19
|
-
timeToTerminal2: Time in nwalking or by shuttle to Terminal 2 : 'Walking 5-10'
|
|
20
|
-
lastUpdated: timestamp of last update (as sent by server)
|
|
21
|
-
|
|
22
|
-
Values defined by 'security'
|
|
23
|
-
queueTime: Estimated Time in queue (in minutes) : i.e. 45
|
|
24
|
-
isTemporarilyClosed: If true, this line is closed - else it is open
|
|
25
|
-
timeIsReal: If true, the time here is live and valid, else its a default fallback
|
|
26
|
-
lastUpdated: timestamp of last update (as sent by server)
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
const REFRESH_FREQUENCY = 1000 * 30; // every 30 seconds
|
|
30
|
-
|
|
31
|
-
function create (app, config) {
|
|
32
|
-
let dataLoadedProm = new Zousan();
|
|
33
|
-
|
|
34
|
-
const init = async () => {
|
|
35
|
-
const urlBaseNew = config.urlBase || 'https://rest.locuslabs.com/v3';
|
|
36
|
-
const urlBase = config.urlBase || 'https://rest.locuslabs.com/v1';
|
|
37
|
-
|
|
38
|
-
async function getURL () {
|
|
39
|
-
return dataLoadedProm
|
|
40
|
-
.then(({ venueId, accountId }) => {
|
|
41
|
-
let url = `${urlBase}/venue/${venueId}/account/${accountId}/get-all-dynamic-pois/`;
|
|
42
|
-
if (urlBase.startsWith('./') || urlBase.endsWith('.json'))
|
|
43
|
-
url = urlBase;
|
|
44
|
-
return url
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/*
|
|
49
|
-
API URL: https://gitlab.com/locuslabs/core-data-team/rest-api/-/blob/develop/v3/docs/REST%20API%20v3.postman_collection.json
|
|
50
|
-
*/
|
|
51
|
-
const getWaitTimesUrl = async () => dataLoadedProm.then(({ venueId, accountId }) =>
|
|
52
|
-
(urlBaseNew.startsWith('./') || urlBaseNew.endsWith('.json'))
|
|
53
|
-
? urlBaseNew
|
|
54
|
-
: `${urlBaseNew}/venueId/${venueId}/accountId/${accountId}/get-dynamic-queue-times/`);
|
|
55
|
-
|
|
56
|
-
const updateFromAPI = async () => {
|
|
57
|
-
getURL()
|
|
58
|
-
.then(fetch)
|
|
59
|
-
.then(r => r.json())
|
|
60
|
-
.then(poiMap => processParkingPOIS(Date.now(), poiMap));
|
|
61
|
-
getWaitTimesUrl()
|
|
62
|
-
.then(fetch)
|
|
63
|
-
.then(r => r.json())
|
|
64
|
-
.then(waitTimes => processSecurityWaitTimes(Date.now(), waitTimes));
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// Currently, the only way to know if a venue has dynamic POIs is if they have security wait times
|
|
68
|
-
// and the only way we know that is if they have queueTypes.
|
|
69
|
-
// I know this sounds "fragile" - but Jessica said it is our current truth.
|
|
70
|
-
// This will certainly need to change at some point.
|
|
71
|
-
const queueTypes = await app.bus.get('venueData/getQueueTypes');
|
|
72
|
-
if (queueTypes.SecurityLane && queueTypes.SecurityLane.length)
|
|
73
|
-
dataLoadedProm
|
|
74
|
-
.then(updateFromAPI)
|
|
75
|
-
.then(() => setInterval(updateFromAPI, REFRESH_FREQUENCY));
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
function processParkingPOIS (timeNowMs, poiMap) {
|
|
79
|
-
const idValuesMap =
|
|
80
|
-
R.pipe(
|
|
81
|
-
R.filter(poi => poi.category === 'parking'),
|
|
82
|
-
R.map(poi => {
|
|
83
|
-
const da = poi.dynamicAttributes;
|
|
84
|
-
if (!da)
|
|
85
|
-
throw Error(`No dynamicAttributes defined for parking POI ${poi.poiId}`)
|
|
86
|
-
const age = (timeNowMs - poi.timestamp) / 1000; // how long ago this was updated by backend (in seconds)
|
|
87
|
-
const props = (age < da['parking.timeToLive']) // if this update is recent enough, consider it "valid"
|
|
88
|
-
? R.pick(['lotStatus', 'rateDay', 'rateHour', 'timeIsReal', 'timeToTerminal1', 'timeToTerminal2'], poi)
|
|
89
|
-
: { lotStatus: da['parking.default'], rateDay: '$ -', rateHour: '$ -', timeIsReal: false };
|
|
90
|
-
|
|
91
|
-
return { ...props, lastUpdated: poi.timestamp, lotName: poi.lotName }
|
|
92
|
-
}))(poiMap);
|
|
93
|
-
|
|
94
|
-
app.bus.send('poi/setDynamicData', { plugin: 'parking', idValuesMap });
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/*
|
|
98
|
-
API response: https://gitlab.com/locuslabs/core-data-team/json-schemas/-/blob/develop/src/api-marketplace/dynamic-queue-data.json
|
|
99
|
-
*/
|
|
100
|
-
function processSecurityWaitTimes (timeNowMs, waitTimes) {
|
|
101
|
-
const idValuesMap = R.pipe(
|
|
102
|
-
R.map(waitTime => [waitTime.poiId, toDynamicWaitTime(timeNowMs, waitTime)]),
|
|
103
|
-
R.fromPairs
|
|
104
|
-
)(waitTimes);
|
|
105
|
-
app.bus.send('poi/setDynamicData', { plugin: 'security', idValuesMap });
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const toDynamicWaitTime = (timeNowMs, waitTime) => ({
|
|
109
|
-
queueTime: waitTime.queueTime,
|
|
110
|
-
isTemporarilyClosed: waitTime.isTemporarilyClosed,
|
|
111
|
-
timeIsReal: !waitTime.isQueueTimeDefault && waitTime.expiration > timeNowMs,
|
|
112
|
-
lastUpdated: timeNowMs
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
app.bus.on('venueData/mapDataLoaded', ({ venueId, accountId }) => {
|
|
116
|
-
if (dataLoadedProm.v) // non-standard - indicates promise has been resolved...
|
|
117
|
-
dataLoadedProm = Zousan.resolve({ venueId, accountId });
|
|
118
|
-
else
|
|
119
|
-
dataLoadedProm.resolve({ venueId, accountId });
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
init,
|
|
124
|
-
internal: {
|
|
125
|
-
processSecurityWaitTimes,
|
|
126
|
-
processParkingPOIS
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export { create };
|
|
1
|
+
import*as e from"ramda";import t from"zousan";function a(a,n){let s=new t;const i=new t;function o(t,n){const s=e.pipe(e.filter((e=>"parking"===e.category)),e.map((a=>{const n=a.dynamicAttributes;if(!n)throw Error(`No dynamicAttributes defined for parking POI ${a.poiId}`);return{...(t-a.timestamp)/1e3<n["parking.timeToLive"]?e.pick(["lotStatus","rateDay","rateHour","timeIsReal","timeToTerminal1","timeToTerminal2"],a):{lotStatus:n["parking.default"],rateDay:"$ -",rateHour:"$ -",timeIsReal:!1},lastUpdated:a.timestamp,lotName:a.lotName}})))(n);a.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:s})}function r(t,n){const s=e.pipe(e.map((e=>[e.poiId,u(t,e)])),e.fromPairs)(n);a.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:s})}const u=(e,t)=>({queueTime:t.queueTime,isTemporarilyClosed:t.isTemporarilyClosed,timeIsReal:!t.isQueueTimeDefault&&t.expiration>e,lastUpdated:e});return a.bus.on("venueData/venueDataLoaded",(({venueData:e})=>{s.v?s=t.resolve(e):s.resolve(e)})),a.bus.on("sdk/readyWhenYouAre",(()=>i)),{init:async()=>{const e=n.urlBase||"https://rest.locuslabs.com/v3",t=n.urlBase||"https://rest.locuslabs.com/v1",u=a.config.plugins.venueDataLoader.accountId;async function c(){return s.then((e=>{let a=`${t}/venue/${e.id}/account/${u}/get-all-dynamic-pois/`;return(t.startsWith("./")||t.endsWith(".json"))&&(a=t),a}))}const l=async()=>s.then((t=>e.startsWith("./")||e.endsWith(".json")?e:`${e}/venueId/${t.id}/accountId/${u}/get-dynamic-queue-times/`)),m=async()=>{Promise.all([c().then(fetch).then((e=>e.json())).then((e=>o(Date.now(),e))),l().then(fetch).then((e=>e.json())).then((e=>r(Date.now(),e)))]).then((()=>i.resolve(!0))).catch((e=>{console.error(e),i.resolve(!0)}))},p=await a.bus.get("venueData/getQueueTypes");p.SecurityLane&&p.SecurityLane.length?s.then(m).then((()=>setInterval(m,3e4))):i.resolve(!0)},internal:{processSecurityWaitTimes:r,processParkingPOIS:o}}}export{a as create};
|