atriusmaps-node-sdk 3.3.898 → 3.3.899
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/nodesdk/nodeEntry.js +36 -58
- package/dist/cjs/package.json.js +8 -4
- package/dist/cjs/plugins/clientAPI/src/clientAPI.js +8 -6
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +50 -142
- package/dist/cjs/plugins/dynamicPois/src/processors.js +31 -53
- package/dist/cjs/plugins/flightStatus/src/flightDetailsMapper.js +47 -116
- package/dist/cjs/plugins/flightStatus/src/flightStatus.js +48 -82
- package/dist/cjs/plugins/flightStatus/src/utils.js +4 -14
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +77 -154
- package/dist/cjs/plugins/sdkServer/src/prepareSDKConfig.js +45 -76
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +70 -79
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +97 -147
- package/dist/cjs/plugins/searchService/src/flexsearchExports/lang.js +16 -190
- package/dist/cjs/plugins/searchService/src/flexsearchExports/simple.js +28 -35
- package/dist/cjs/plugins/searchService/src/poiSearch.js +10 -21
- package/dist/cjs/plugins/searchService/src/searchService.js +45 -147
- package/dist/cjs/plugins/searchService/src/searchTypeahead.js +17 -28
- package/dist/cjs/plugins/searchService/src/utils.js +9 -13
- package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +148 -304
- package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +47 -126
- package/dist/cjs/plugins/wayfinder/src/findRoute.js +6 -73
- package/dist/cjs/plugins/wayfinder/src/minPriorityQueue.js +7 -27
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +78 -259
- package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +26 -57
- package/dist/cjs/plugins/wayfinder/src/segmentBadges.js +25 -25
- package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +50 -133
- package/dist/cjs/plugins/wayfinder/src/segmentCategories.js +29 -29
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +53 -145
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +105 -349
- package/dist/cjs/src/app.js +53 -91
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +34 -43
- package/dist/cjs/src/configs/postproc-stateTracking.js +1 -19
- package/dist/cjs/src/controller.js +4 -26
- package/dist/cjs/src/debugTools.js +55 -94
- package/dist/cjs/src/env.js +8 -19
- package/dist/cjs/src/extModules/bustle.js +15 -71
- package/dist/cjs/src/extModules/flexapi/src/help.js +7 -22
- package/dist/cjs/src/extModules/flexapi/src/index.js +15 -29
- package/dist/cjs/src/extModules/flexapi/src/validate.js +45 -93
- package/dist/cjs/src/extModules/geohasher.js +13 -31
- package/dist/cjs/src/extModules/log.js +18 -29
- package/dist/cjs/src/historyManager.js +4 -6
- package/dist/cjs/src/utils/bounds.js +2 -4
- package/dist/cjs/src/utils/buildStructureLookup.js +7 -7
- package/dist/cjs/src/utils/configUtils.js +7 -43
- package/dist/cjs/src/utils/date.js +5 -17
- package/dist/cjs/src/utils/distance.js +2 -2
- package/dist/cjs/src/utils/dom.js +9 -24
- package/dist/cjs/src/utils/funcs.js +15 -30
- package/dist/cjs/src/utils/geodesy.js +24 -39
- package/dist/cjs/src/utils/geom.js +32 -148
- package/dist/cjs/src/utils/i18n.js +39 -70
- package/dist/cjs/src/utils/isInitialState.js +7 -13
- package/dist/cjs/src/utils/location.js +10 -29
- package/dist/cjs/src/utils/observable.js +4 -29
- package/dist/cjs/src/utils/rand.js +9 -80
- package/dist/cjs/utils/constants.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/plugins/sdkServer/src/prepareSDKConfig.js +1 -1
- package/dist/src/utils/buildStructureLookup.js +1 -1
- package/dist/src/utils/date.js +1 -1
- package/package.json +1 -1
|
@@ -23,132 +23,123 @@ function _interopNamespaceDefault(e) {
|
|
|
23
23
|
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
24
24
|
|
|
25
25
|
const headlessCommands = [
|
|
26
|
-
{ command:
|
|
26
|
+
{ command: "destroy" },
|
|
27
27
|
{
|
|
28
|
-
command:
|
|
28
|
+
command: "getDirections",
|
|
29
29
|
args: [
|
|
30
|
-
{ name:
|
|
31
|
-
{ name:
|
|
32
|
-
{ name:
|
|
30
|
+
{ name: "from", type: "location" },
|
|
31
|
+
{ name: "to", type: "location" },
|
|
32
|
+
{ name: "accessible", type: "boolean", optional: true },
|
|
33
33
|
{
|
|
34
|
-
name:
|
|
35
|
-
type:
|
|
36
|
-
itemType: { type:
|
|
37
|
-
optional: true
|
|
38
|
-
}
|
|
39
|
-
]
|
|
34
|
+
name: "queueTypes",
|
|
35
|
+
type: "list",
|
|
36
|
+
itemType: { type: "string" },
|
|
37
|
+
optional: true
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
|
-
command:
|
|
42
|
+
command: "getDirectionsMultiple",
|
|
43
43
|
args: [
|
|
44
|
-
{ name:
|
|
45
|
-
{ name:
|
|
44
|
+
{ name: "locations", type: "list", itemType: { type: "location" } },
|
|
45
|
+
{ name: "accessible", type: "boolean", optional: true },
|
|
46
46
|
{
|
|
47
|
-
name:
|
|
48
|
-
type:
|
|
49
|
-
itemType: { type:
|
|
50
|
-
optional: true
|
|
51
|
-
}
|
|
52
|
-
]
|
|
47
|
+
name: "queueTypes",
|
|
48
|
+
type: "list",
|
|
49
|
+
itemType: { type: "string" },
|
|
50
|
+
optional: true
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
command:
|
|
56
|
-
args: [{ name:
|
|
55
|
+
command: "getPOIDetails",
|
|
56
|
+
args: [{ name: "poiId", type: "integer", min: 0 }]
|
|
57
57
|
},
|
|
58
|
-
{ command:
|
|
59
|
-
{ command:
|
|
60
|
-
{ command:
|
|
58
|
+
{ command: "getAllPOIs" },
|
|
59
|
+
{ command: "getStructures" },
|
|
60
|
+
{ command: "getVenueData" },
|
|
61
61
|
{
|
|
62
|
-
command:
|
|
63
|
-
args: [{ name:
|
|
62
|
+
command: "getSecurityWaitTimes",
|
|
63
|
+
args: [{ name: "isOpen", type: "boolean", optional: true }]
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
|
-
command:
|
|
66
|
+
command: "search",
|
|
67
67
|
args: [
|
|
68
|
-
{ name:
|
|
69
|
-
{ name:
|
|
70
|
-
]
|
|
68
|
+
{ name: "term", type: "string", minLength: 2 },
|
|
69
|
+
{ name: "details", type: "boolean", optional: true }
|
|
70
|
+
]
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
command:
|
|
73
|
+
command: "getFlightStatus",
|
|
74
74
|
args: [
|
|
75
|
-
{ name:
|
|
76
|
-
{ name:
|
|
77
|
-
]
|
|
78
|
-
}
|
|
75
|
+
{ name: "term", type: "string", optional: true },
|
|
76
|
+
{ name: "type", type: "string", optional: true }
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
79
|
];
|
|
80
|
-
|
|
81
80
|
function handleHeadless(app) {
|
|
82
|
-
app.bus.on(
|
|
83
|
-
|
|
84
|
-
app.bus.on('clientAPI/getDirections', async ({ from, to, accessible, queueTypes }) => {
|
|
81
|
+
app.bus.on("clientAPI/destroy", async () => app.destroy());
|
|
82
|
+
app.bus.on("clientAPI/getDirections", async ({ from, to, accessible, queueTypes }) => {
|
|
85
83
|
const fromEndpoint = await location.locationToEndpoint(app, from);
|
|
86
84
|
const toEndpoint = await location.locationToEndpoint(app, to);
|
|
87
85
|
const options = { requiresAccessibility: !!accessible };
|
|
88
86
|
if (queueTypes) {
|
|
89
87
|
options.selectedSecurityLanes = { SecurityLane: queueTypes };
|
|
90
88
|
}
|
|
91
|
-
return app.bus
|
|
92
|
-
.get('wayfinder/getRoute', { fromEndpoint, toEndpoint, options })
|
|
93
|
-
.then(R__namespace.pick(['distance', 'time', 'steps', 'navline', 'waypoints']));
|
|
89
|
+
return app.bus.get("wayfinder/getRoute", { fromEndpoint, toEndpoint, options }).then(R__namespace.pick(["distance", "time", "steps", "navline", "waypoints"]));
|
|
94
90
|
});
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const endpoints = await Promise.all(locations.map(async l => location.locationToEndpoint(app, l)));
|
|
91
|
+
app.bus.on("clientAPI/getDirectionsMultiple", async ({ locations, accessible, queueTypes }) => {
|
|
92
|
+
const endpoints = await Promise.all(locations.map(async (l) => location.locationToEndpoint(app, l)));
|
|
98
93
|
const options = { requiresAccessibility: !!accessible };
|
|
99
94
|
if (queueTypes) {
|
|
100
95
|
options.selectedSecurityLanes = { SecurityLane: queueTypes };
|
|
101
96
|
}
|
|
102
97
|
const routes = await Promise.all(
|
|
103
|
-
R__namespace.aperture(2, endpoints).map(
|
|
104
|
-
app.bus.get(
|
|
98
|
+
R__namespace.aperture(2, endpoints).map(
|
|
99
|
+
async (a) => app.bus.get("wayfinder/getRoute", {
|
|
105
100
|
fromEndpoint: a[0],
|
|
106
101
|
toEndpoint: a[1],
|
|
107
|
-
options
|
|
108
|
-
})
|
|
109
|
-
)
|
|
102
|
+
options
|
|
103
|
+
})
|
|
104
|
+
)
|
|
110
105
|
);
|
|
111
|
-
const directions = R__namespace.map(R__namespace.pick([
|
|
106
|
+
const directions = R__namespace.map(R__namespace.pick(["distance", "time", "steps", "navline", "waypoints"]), routes);
|
|
112
107
|
return {
|
|
113
108
|
total: {
|
|
114
|
-
distance: R__namespace.sum(R__namespace.map(d => d.distance, directions)),
|
|
115
|
-
time: R__namespace.sum(R__namespace.map(d => d.time, directions))
|
|
109
|
+
distance: R__namespace.sum(R__namespace.map((d) => d.distance, directions)),
|
|
110
|
+
time: R__namespace.sum(R__namespace.map((d) => d.time, directions))
|
|
116
111
|
},
|
|
117
|
-
directions
|
|
112
|
+
directions
|
|
118
113
|
};
|
|
119
114
|
});
|
|
120
|
-
|
|
121
|
-
app.bus.on(
|
|
122
|
-
|
|
123
|
-
app.bus.on(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
app.bus.on('clientAPI/getSecurityWaitTimes', async ({ isOpen }) =>
|
|
128
|
-
app.bus.get('dynamicPois/getSecurityWaitTimes', { isOpen }),
|
|
115
|
+
app.bus.on("clientAPI/getPOIDetails", async ({ poiId }) => app.bus.get("poi/getById", { id: poiId }));
|
|
116
|
+
app.bus.on("clientAPI/getAllPOIs", async () => app.bus.get("poi/getAll"));
|
|
117
|
+
app.bus.on("clientAPI/getStructures", () => location.getStructures(app));
|
|
118
|
+
app.bus.on(
|
|
119
|
+
"clientAPI/getSecurityWaitTimes",
|
|
120
|
+
async ({ isOpen }) => app.bus.get("dynamicPois/getSecurityWaitTimes", { isOpen })
|
|
129
121
|
);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const vd = await app.bus.get('venueData/getVenueData');
|
|
122
|
+
const isNotFunction = (o) => typeof o !== "function";
|
|
123
|
+
app.bus.on("clientAPI/getVenueData", async () => {
|
|
124
|
+
const vd = await app.bus.get("venueData/getVenueData");
|
|
134
125
|
return R__namespace.filter(isNotFunction, vd);
|
|
135
126
|
});
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
app.bus.get(
|
|
139
|
-
const poiIdList = poiList.map(poi => poi.poiId);
|
|
140
|
-
app.bus.send(
|
|
141
|
-
referrer:
|
|
127
|
+
app.bus.on(
|
|
128
|
+
"clientAPI/search",
|
|
129
|
+
async ({ term, details }) => app.bus.get("search/queryAsync", { term }).then((poiList) => {
|
|
130
|
+
const poiIdList = poiList.map((poi) => poi.poiId);
|
|
131
|
+
app.bus.send("event/search", {
|
|
132
|
+
referrer: "prog",
|
|
142
133
|
searchMethod: null,
|
|
143
134
|
query: term,
|
|
144
|
-
entities: poiIdList
|
|
135
|
+
entities: poiIdList
|
|
145
136
|
});
|
|
146
137
|
return details ? poiList : poiIdList;
|
|
147
|
-
})
|
|
138
|
+
})
|
|
148
139
|
);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
app.bus.get(
|
|
140
|
+
app.bus.on(
|
|
141
|
+
"clientAPI/getFlightStatus",
|
|
142
|
+
async ({ term, type = "all" }) => app.bus.get("flightStatus/query", { term, type })
|
|
152
143
|
);
|
|
153
144
|
}
|
|
154
145
|
|
|
@@ -8,17 +8,15 @@ var sdkHeadless = require('./sdkHeadless.js');
|
|
|
8
8
|
function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: null, default: e }); }
|
|
9
9
|
|
|
10
10
|
let removePreviousListener = null;
|
|
11
|
-
|
|
12
11
|
function describeMessageRelation(senderOrigin, iframeOrigin) {
|
|
13
|
-
if (senderOrigin ===
|
|
14
|
-
return
|
|
12
|
+
if (senderOrigin === "null") {
|
|
13
|
+
return "null-origin";
|
|
15
14
|
}
|
|
16
|
-
return senderOrigin === iframeOrigin ?
|
|
15
|
+
return senderOrigin === iframeOrigin ? "same-origin" : "cross-origin";
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
function logBrowserMessageTelemetry(bus, { messageType, senderOrigin, command, iframeOrigin }) {
|
|
20
|
-
bus.send(
|
|
21
|
-
name:
|
|
18
|
+
bus.send("appInsights/log", {
|
|
19
|
+
name: "browserMessageObserved",
|
|
22
20
|
properties: {
|
|
23
21
|
command,
|
|
24
22
|
deploymentHost: window.location.host,
|
|
@@ -26,162 +24,135 @@ function logBrowserMessageTelemetry(bus, { messageType, senderOrigin, command, i
|
|
|
26
24
|
messageType,
|
|
27
25
|
relation: describeMessageRelation(senderOrigin, iframeOrigin),
|
|
28
26
|
senderOrigin,
|
|
29
|
-
wouldRejectCrossOrigin: !isSameOriginBrowserMessage(senderOrigin, iframeOrigin)
|
|
30
|
-
}
|
|
27
|
+
wouldRejectCrossOrigin: !isSameOriginBrowserMessage(senderOrigin, iframeOrigin)
|
|
28
|
+
}
|
|
31
29
|
});
|
|
32
30
|
}
|
|
33
|
-
|
|
34
31
|
function isSameOriginBrowserMessage(senderOrigin, iframeOrigin) {
|
|
35
32
|
return senderOrigin === iframeOrigin;
|
|
36
33
|
}
|
|
37
|
-
|
|
38
|
-
// browser based communication
|
|
39
|
-
// listens for messages passed through
|
|
40
|
-
// postMessage and converts them to clientAPI/execute calls..
|
|
41
|
-
// responds by sending messages back through postMessage
|
|
42
|
-
// returns a sendEvent function used for sending events through postMessage as well
|
|
43
34
|
function getBrowserCom(app) {
|
|
44
|
-
const clean = ob => JSON.parse(JSON.stringify(ob));
|
|
35
|
+
const clean = (ob) => JSON.parse(JSON.stringify(ob));
|
|
45
36
|
const sendResponse = (payload, clientMsgId) => {
|
|
46
37
|
const ob = {
|
|
47
38
|
payload,
|
|
48
|
-
type:
|
|
39
|
+
type: "LL-server"
|
|
49
40
|
};
|
|
50
41
|
if (clientMsgId) {
|
|
51
42
|
ob.clientMsgId = clientMsgId;
|
|
52
43
|
}
|
|
53
44
|
try {
|
|
54
|
-
window.postMessage(ob,
|
|
45
|
+
window.postMessage(ob, "*");
|
|
55
46
|
} catch {
|
|
56
|
-
window.postMessage(clean(ob),
|
|
57
|
-
}
|
|
47
|
+
window.postMessage(clean(ob), "*");
|
|
48
|
+
}
|
|
58
49
|
};
|
|
59
|
-
|
|
60
50
|
const sendError = (payload, clientMsgId) => {
|
|
61
51
|
const ob = {
|
|
62
52
|
error: true,
|
|
63
53
|
payload,
|
|
64
|
-
type:
|
|
54
|
+
type: "LL-server"
|
|
65
55
|
};
|
|
66
56
|
if (clientMsgId) {
|
|
67
57
|
ob.clientMsgId = clientMsgId;
|
|
68
58
|
}
|
|
69
|
-
window.postMessage(ob,
|
|
59
|
+
window.postMessage(ob, "*");
|
|
70
60
|
};
|
|
71
|
-
|
|
72
61
|
const sendEvent = (event, payload) => {
|
|
73
62
|
const ob = {
|
|
74
63
|
event,
|
|
75
64
|
payload,
|
|
76
|
-
type:
|
|
65
|
+
type: "LL-server"
|
|
77
66
|
};
|
|
78
|
-
window.postMessage(ob,
|
|
67
|
+
window.postMessage(ob, "*");
|
|
79
68
|
};
|
|
80
|
-
|
|
81
69
|
function msgHandler(e) {
|
|
82
70
|
const d = e.data;
|
|
83
|
-
if (d && d.type ===
|
|
71
|
+
if (d && d.type === "LL-client") {
|
|
84
72
|
const iframeOrigin = window.location.origin;
|
|
85
73
|
logBrowserMessageTelemetry(app.bus, {
|
|
86
|
-
messageType:
|
|
74
|
+
messageType: "LL-client",
|
|
87
75
|
senderOrigin: e.origin,
|
|
88
76
|
command: d.payload?.command,
|
|
89
|
-
iframeOrigin
|
|
77
|
+
iframeOrigin
|
|
90
78
|
});
|
|
91
79
|
if (!isSameOriginBrowserMessage(e.origin, iframeOrigin)) {
|
|
92
80
|
return;
|
|
93
81
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
console.error(er);
|
|
101
|
-
}
|
|
102
|
-
sendError(er.message, d.msgId);
|
|
103
|
-
});
|
|
82
|
+
app.bus.get("clientAPI/execute", d.payload).then((resOb) => sendResponse(resOb, d.msgId)).catch((er) => {
|
|
83
|
+
if (app.config.debug) {
|
|
84
|
+
console.error(er);
|
|
85
|
+
}
|
|
86
|
+
sendError(er.message, d.msgId);
|
|
87
|
+
});
|
|
104
88
|
}
|
|
105
89
|
}
|
|
106
|
-
|
|
107
|
-
// Listen for HTML5 postMessage events - these come from SDKClient apps
|
|
108
90
|
if (removePreviousListener) {
|
|
109
91
|
removePreviousListener();
|
|
110
92
|
}
|
|
111
|
-
window.addEventListener(
|
|
112
|
-
removePreviousListener = () => window.removeEventListener(
|
|
113
|
-
|
|
93
|
+
window.addEventListener("message", msgHandler);
|
|
94
|
+
removePreviousListener = () => window.removeEventListener("message", msgHandler);
|
|
114
95
|
return sendEvent;
|
|
115
96
|
}
|
|
116
|
-
|
|
117
|
-
// For node, command sending and response sending is handled via
|
|
118
|
-
// nodeEntry - no postMessage required.
|
|
119
|
-
// sendEvent attaches a hook into app to receive them...
|
|
120
97
|
function getNodeCom(app) {
|
|
121
98
|
const eventListener = observable();
|
|
122
99
|
app.eventListener = eventListener;
|
|
123
100
|
const sendEvent = (event, payload) => eventListener.fire(event, payload);
|
|
124
101
|
return sendEvent;
|
|
125
102
|
}
|
|
126
|
-
|
|
127
103
|
function registerCustomTypes(app) {
|
|
128
|
-
app.bus.send(
|
|
129
|
-
name:
|
|
104
|
+
app.bus.send("clientAPI/registerCustomType", {
|
|
105
|
+
name: "latLngOrdLocation",
|
|
130
106
|
spec: {
|
|
131
|
-
type:
|
|
107
|
+
type: "object",
|
|
132
108
|
props: [
|
|
133
|
-
{ name:
|
|
134
|
-
{ name:
|
|
135
|
-
{ name:
|
|
136
|
-
]
|
|
137
|
-
}
|
|
109
|
+
{ name: "lat", type: "float" },
|
|
110
|
+
{ name: "lng", type: "float" },
|
|
111
|
+
{ name: "ord", type: "integer" }
|
|
112
|
+
]
|
|
113
|
+
}
|
|
138
114
|
});
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
name: 'latLngFloorLocation',
|
|
115
|
+
app.bus.send("clientAPI/registerCustomType", {
|
|
116
|
+
name: "latLngFloorLocation",
|
|
142
117
|
spec: {
|
|
143
|
-
type:
|
|
118
|
+
type: "object",
|
|
144
119
|
props: [
|
|
145
|
-
{ name:
|
|
146
|
-
{ name:
|
|
147
|
-
{ name:
|
|
148
|
-
]
|
|
149
|
-
}
|
|
120
|
+
{ name: "lat", type: "float" },
|
|
121
|
+
{ name: "lng", type: "float" },
|
|
122
|
+
{ name: "floorId", type: "string" }
|
|
123
|
+
]
|
|
124
|
+
}
|
|
150
125
|
});
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
name: 'poiIdLocation',
|
|
126
|
+
app.bus.send("clientAPI/registerCustomType", {
|
|
127
|
+
name: "poiIdLocation",
|
|
154
128
|
spec: {
|
|
155
|
-
type:
|
|
156
|
-
props: [{ name:
|
|
157
|
-
}
|
|
129
|
+
type: "object",
|
|
130
|
+
props: [{ name: "poiId", type: "integer", min: 0 }]
|
|
131
|
+
}
|
|
158
132
|
});
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
name: 'location',
|
|
133
|
+
app.bus.send("clientAPI/registerCustomType", {
|
|
134
|
+
name: "location",
|
|
162
135
|
spec: {
|
|
163
|
-
type:
|
|
164
|
-
types: [{ type:
|
|
165
|
-
}
|
|
136
|
+
type: "multi",
|
|
137
|
+
types: [{ type: "poiIdLocation" }, { type: "latLngOrdLocation" }, { type: "latLngFloorLocation" }]
|
|
138
|
+
}
|
|
166
139
|
});
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
name: 'viewSettings',
|
|
140
|
+
app.bus.send("clientAPI/registerCustomType", {
|
|
141
|
+
name: "viewSettings",
|
|
170
142
|
spec: {
|
|
171
|
-
type:
|
|
143
|
+
type: "object",
|
|
172
144
|
props: [
|
|
173
|
-
{ name:
|
|
174
|
-
{ name:
|
|
175
|
-
{ name:
|
|
176
|
-
]
|
|
177
|
-
}
|
|
145
|
+
{ name: "zoom", type: "float", optional: true },
|
|
146
|
+
{ name: "pitch", type: "float", optional: true },
|
|
147
|
+
{ name: "bearing", type: "float", optional: true }
|
|
148
|
+
]
|
|
149
|
+
}
|
|
178
150
|
});
|
|
179
151
|
}
|
|
180
|
-
|
|
181
152
|
function registerEvents(app, sendEvent) {
|
|
182
|
-
app.bus.monitor(
|
|
183
|
-
const { lat, lng, floorId, ordinal, structureId } = await app.bus.get(
|
|
184
|
-
sendEvent(
|
|
153
|
+
app.bus.monitor("map/userMoveStart", async ({ pitch, zoom, bearing }) => {
|
|
154
|
+
const { lat, lng, floorId, ordinal, structureId } = await app.bus.get("map/getMapCenter");
|
|
155
|
+
sendEvent("userMoveStart", {
|
|
185
156
|
lat,
|
|
186
157
|
lng,
|
|
187
158
|
floorId,
|
|
@@ -189,13 +160,12 @@ function registerEvents(app, sendEvent) {
|
|
|
189
160
|
structureId,
|
|
190
161
|
pitch,
|
|
191
162
|
zoom,
|
|
192
|
-
bearing
|
|
163
|
+
bearing
|
|
193
164
|
});
|
|
194
165
|
});
|
|
195
|
-
|
|
196
166
|
const userMoving = async ({ pitch, zoom, bearing }) => {
|
|
197
|
-
const { lat, lng, floorId, ordinal, structureId } = await app.bus.get(
|
|
198
|
-
sendEvent(
|
|
167
|
+
const { lat, lng, floorId, ordinal, structureId } = await app.bus.get("map/getMapCenter");
|
|
168
|
+
sendEvent("userMoving", {
|
|
199
169
|
lat,
|
|
200
170
|
lng,
|
|
201
171
|
floorId,
|
|
@@ -203,15 +173,13 @@ function registerEvents(app, sendEvent) {
|
|
|
203
173
|
structureId,
|
|
204
174
|
pitch,
|
|
205
175
|
zoom,
|
|
206
|
-
bearing
|
|
176
|
+
bearing
|
|
207
177
|
});
|
|
208
178
|
};
|
|
209
|
-
|
|
210
|
-
app.bus.monitor(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const { lat, lng, floorId, ordinal, structureId } = await app.bus.get('map/getMapCenter');
|
|
214
|
-
sendEvent('moveEnd', {
|
|
179
|
+
app.bus.monitor("map/userMoving", throttleDebounce.throttle(500, userMoving));
|
|
180
|
+
app.bus.monitor("map/moveEnd", async ({ pitch, zoom, bearing }) => {
|
|
181
|
+
const { lat, lng, floorId, ordinal, structureId } = await app.bus.get("map/getMapCenter");
|
|
182
|
+
sendEvent("moveEnd", {
|
|
215
183
|
lat,
|
|
216
184
|
lng,
|
|
217
185
|
floorId,
|
|
@@ -219,80 +187,62 @@ function registerEvents(app, sendEvent) {
|
|
|
219
187
|
structureId,
|
|
220
188
|
pitch,
|
|
221
189
|
zoom,
|
|
222
|
-
bearing
|
|
190
|
+
bearing
|
|
223
191
|
});
|
|
224
192
|
});
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
sendEvent(
|
|
193
|
+
app.bus.monitor(
|
|
194
|
+
"map/floorChanged",
|
|
195
|
+
({ structure, floor }) => sendEvent("levelChange", {
|
|
228
196
|
floorId: floor ? floor.id : null,
|
|
229
197
|
floorName: floor ? floor.name : null,
|
|
230
198
|
ord: floor ? floor.ordinal : null,
|
|
231
199
|
structureId: structure ? structure.id : null,
|
|
232
|
-
structureName: structure ? structure.name : null
|
|
233
|
-
})
|
|
200
|
+
structureName: structure ? structure.name : null
|
|
201
|
+
})
|
|
234
202
|
);
|
|
235
|
-
|
|
236
|
-
app.bus.monitor(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
app.bus.monitor('map/click', async ({ lat, lng, ord }) => {
|
|
241
|
-
const structures = await app.bus.get('venueData/getStructures');
|
|
242
|
-
const mapviewBBox = await app.bus.get('map/getViewBBox');
|
|
203
|
+
app.bus.monitor("map/poiClicked", ({ poi }) => sendEvent("poiSelected", poi));
|
|
204
|
+
app.bus.monitor("poiDetails/showPoi", ({ poi }) => sendEvent("poiShown", poi));
|
|
205
|
+
app.bus.monitor("map/click", async ({ lat, lng, ord }) => {
|
|
206
|
+
const structures = await app.bus.get("venueData/getStructures");
|
|
207
|
+
const mapviewBBox = await app.bus.get("map/getViewBBox");
|
|
243
208
|
const { building: structure, floor } = geom.getStructureAndFloorAtPoint(structures, lat, lng, ord, mapviewBBox, true);
|
|
244
|
-
sendEvent(
|
|
209
|
+
sendEvent("mapClicked", { lat, lng, ord, building: structure, floor });
|
|
245
210
|
});
|
|
246
211
|
}
|
|
247
|
-
|
|
248
212
|
async function create(app, config) {
|
|
249
213
|
const sendEvent = app.env.isBrowser ? getBrowserCom(app) : getNodeCom(app);
|
|
250
|
-
|
|
251
214
|
const init = async () => {
|
|
252
|
-
// Register the Custom Types
|
|
253
215
|
registerCustomTypes(app);
|
|
254
|
-
|
|
255
|
-
// Register our commands
|
|
256
|
-
sdkHeadless.headlessCommands.forEach(cdef => app.bus.send('clientAPI/registerCommand', cdef));
|
|
216
|
+
sdkHeadless.headlessCommands.forEach((cdef) => app.bus.send("clientAPI/registerCommand", cdef));
|
|
257
217
|
sdkHeadless.handleHeadless(app);
|
|
258
|
-
|
|
259
218
|
if (!config.headless) {
|
|
260
|
-
await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../../../_virtual/_empty_module_placeholder.js')); }).then(sdkVisual => {
|
|
261
|
-
sdkVisual.visualCommands.forEach(cdef => app.bus.send(
|
|
219
|
+
await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../../../_virtual/_empty_module_placeholder.js')); }).then((sdkVisual) => {
|
|
220
|
+
sdkVisual.visualCommands.forEach((cdef) => app.bus.send("clientAPI/registerCommand", cdef));
|
|
262
221
|
sdkVisual.handleVisual(app, sendEvent);
|
|
263
222
|
});
|
|
264
223
|
}
|
|
265
|
-
|
|
266
224
|
const weReady = async () => {
|
|
267
|
-
await app.bus.send(
|
|
268
|
-
app.bus
|
|
269
|
-
.get('clientAPI/execute', { command: 'getCommandJSON' })
|
|
270
|
-
.then(commandJSON => sendEvent('ready', { commandJSON }));
|
|
225
|
+
await app.bus.send("system/readywhenyouare");
|
|
226
|
+
app.bus.get("clientAPI/execute", { command: "getCommandJSON" }).then((commandJSON) => sendEvent("ready", { commandJSON }));
|
|
271
227
|
if (!config.headless && app.config.uiHide && app.config.uiHide.sidebar && app.env.isDesktop()) {
|
|
272
|
-
app.bus.send(
|
|
273
|
-
padding: { left: 55, right: 55, top: 72, bottom: 22 }
|
|
228
|
+
app.bus.send("map/changePadding", {
|
|
229
|
+
padding: { left: 55, right: 55, top: 72, bottom: 22 }
|
|
274
230
|
});
|
|
275
231
|
}
|
|
276
232
|
};
|
|
277
|
-
|
|
278
|
-
if (config.headless) // in headless case, we are ready once data is ready
|
|
279
|
-
{
|
|
233
|
+
if (config.headless) {
|
|
280
234
|
Promise.all([
|
|
281
|
-
new Promise(resolve => app.bus.monitor(
|
|
282
|
-
new Promise(resolve => app.bus.monitor(
|
|
235
|
+
new Promise((resolve) => app.bus.monitor("venueData/navGraphLoaded", resolve)),
|
|
236
|
+
new Promise((resolve) => app.bus.monitor("venueData/poiDataLoaded", resolve))
|
|
283
237
|
]).then(weReady);
|
|
284
238
|
} else {
|
|
285
|
-
app.bus.on(
|
|
239
|
+
app.bus.on("map/mapReadyToShow", weReady);
|
|
286
240
|
}
|
|
287
|
-
|
|
288
|
-
app.bus.on('sdkServer/sendEvent', ({ eventName, ...props }) => sendEvent(eventName, props));
|
|
241
|
+
app.bus.on("sdkServer/sendEvent", ({ eventName, ...props }) => sendEvent(eventName, props));
|
|
289
242
|
};
|
|
290
|
-
|
|
291
|
-
// Register Events
|
|
292
243
|
registerEvents(app, sendEvent);
|
|
293
|
-
|
|
294
244
|
return {
|
|
295
|
-
init
|
|
245
|
+
init
|
|
296
246
|
};
|
|
297
247
|
}
|
|
298
248
|
|