atriusmaps-node-sdk 3.3.917 → 3.3.918
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/package.json.js +1 -1
- package/dist/cjs/plugins/flightStatus/src/flightDetailsMapper.js +38 -37
- package/dist/cjs/plugins/flightStatus/src/flightStatus.js +25 -42
- package/dist/cjs/plugins/flightStatus/src/utils.js +6 -7
- package/dist/cjs/plugins/sdkServer/src/prepareSDKConfig.js +47 -51
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +49 -49
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +124 -151
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +20 -18
- package/dist/cjs/src/configs/postproc-stateTracking.js +16 -12
- package/dist/cjs/src/utils/observable.js +9 -12
- package/dist/package.json.js +1 -1
- package/dist/plugins/flightStatus/src/flightDetailsMapper.js +1 -1
- package/dist/plugins/flightStatus/src/flightStatus.js +1 -1
- package/dist/plugins/flightStatus/src/utils.js +1 -1
- package/dist/plugins/sdkServer/src/prepareSDKConfig.js +1 -1
- package/dist/plugins/sdkServer/src/sdkHeadless.js +1 -1
- package/dist/plugins/sdkServer/src/sdkServer.js +1 -1
- package/dist/src/configs/postproc-mol-url-parms.js +1 -1
- package/dist/src/configs/postproc-stateTracking.js +1 -1
- package/dist/src/utils/observable.js +1 -1
- package/package.json +1 -1
|
@@ -14,17 +14,17 @@ function describeMessageRelation(senderOrigin, iframeOrigin) {
|
|
|
14
14
|
}
|
|
15
15
|
return senderOrigin === iframeOrigin ? "same-origin" : "cross-origin";
|
|
16
16
|
}
|
|
17
|
-
function logBrowserMessageTelemetry(bus,
|
|
17
|
+
function logBrowserMessageTelemetry(bus, payload) {
|
|
18
18
|
bus.send("appInsights/log", {
|
|
19
19
|
name: "browserMessageObserved",
|
|
20
20
|
properties: {
|
|
21
|
-
command,
|
|
21
|
+
command: payload.command,
|
|
22
22
|
deploymentHost: window.location.host,
|
|
23
|
-
iframeOrigin,
|
|
24
|
-
messageType,
|
|
25
|
-
relation: describeMessageRelation(senderOrigin, iframeOrigin),
|
|
26
|
-
senderOrigin,
|
|
27
|
-
wouldRejectCrossOrigin: !isSameOriginBrowserMessage(senderOrigin, iframeOrigin)
|
|
23
|
+
iframeOrigin: payload.iframeOrigin,
|
|
24
|
+
messageType: payload.messageType,
|
|
25
|
+
relation: describeMessageRelation(payload.senderOrigin, payload.iframeOrigin),
|
|
26
|
+
senderOrigin: payload.senderOrigin,
|
|
27
|
+
wouldRejectCrossOrigin: !isSameOriginBrowserMessage(payload.senderOrigin, payload.iframeOrigin)
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -32,61 +32,43 @@ function isSameOriginBrowserMessage(senderOrigin, iframeOrigin) {
|
|
|
32
32
|
return senderOrigin === iframeOrigin;
|
|
33
33
|
}
|
|
34
34
|
function getBrowserCom(app) {
|
|
35
|
-
const clean = (
|
|
35
|
+
const clean = (value) => JSON.parse(JSON.stringify(value));
|
|
36
36
|
const sendResponse = (payload, clientMsgId) => {
|
|
37
|
-
const
|
|
38
|
-
payload,
|
|
39
|
-
type: "LL-server"
|
|
40
|
-
};
|
|
41
|
-
if (clientMsgId) {
|
|
42
|
-
ob.clientMsgId = clientMsgId;
|
|
43
|
-
}
|
|
37
|
+
const message = { payload, type: "LL-server", clientMsgId };
|
|
44
38
|
try {
|
|
45
|
-
window.postMessage(
|
|
39
|
+
window.postMessage(message, "*");
|
|
46
40
|
} catch {
|
|
47
|
-
window.postMessage(clean(
|
|
41
|
+
window.postMessage(clean(message), "*");
|
|
48
42
|
}
|
|
49
43
|
};
|
|
50
44
|
const sendError = (payload, clientMsgId) => {
|
|
51
|
-
|
|
52
|
-
error: true,
|
|
53
|
-
payload,
|
|
54
|
-
type: "LL-server"
|
|
55
|
-
};
|
|
56
|
-
if (clientMsgId) {
|
|
57
|
-
ob.clientMsgId = clientMsgId;
|
|
58
|
-
}
|
|
59
|
-
window.postMessage(ob, "*");
|
|
45
|
+
window.postMessage({ error: true, payload, type: "LL-server", clientMsgId }, "*");
|
|
60
46
|
};
|
|
61
47
|
const sendEvent = (event, payload) => {
|
|
62
|
-
|
|
63
|
-
event,
|
|
64
|
-
payload,
|
|
65
|
-
type: "LL-server"
|
|
66
|
-
};
|
|
67
|
-
window.postMessage(ob, "*");
|
|
48
|
+
window.postMessage({ event, payload, type: "LL-server" }, "*");
|
|
68
49
|
};
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
logBrowserMessageTelemetry(app.bus, {
|
|
74
|
-
messageType: "LL-client",
|
|
75
|
-
senderOrigin: e.origin,
|
|
76
|
-
command: d.payload?.command,
|
|
77
|
-
iframeOrigin
|
|
78
|
-
});
|
|
79
|
-
if (!isSameOriginBrowserMessage(e.origin, iframeOrigin)) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
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
|
-
});
|
|
50
|
+
const msgHandler = (event) => {
|
|
51
|
+
const data = event.data;
|
|
52
|
+
if (!data || data.type !== "LL-client") {
|
|
53
|
+
return;
|
|
88
54
|
}
|
|
89
|
-
|
|
55
|
+
const iframeOrigin = window.location.origin;
|
|
56
|
+
logBrowserMessageTelemetry(app.bus, {
|
|
57
|
+
messageType: "LL-client",
|
|
58
|
+
senderOrigin: event.origin,
|
|
59
|
+
command: data.payload?.command,
|
|
60
|
+
iframeOrigin
|
|
61
|
+
});
|
|
62
|
+
if (!isSameOriginBrowserMessage(event.origin, iframeOrigin)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
app.bus.get("clientAPI/execute", data.payload).then((result) => sendResponse(result, data.msgId)).catch((error) => {
|
|
66
|
+
if (app.config.debug) {
|
|
67
|
+
console.error(error);
|
|
68
|
+
}
|
|
69
|
+
sendError(error.message, data.msgId);
|
|
70
|
+
});
|
|
71
|
+
};
|
|
90
72
|
if (removePreviousListener) {
|
|
91
73
|
removePreviousListener();
|
|
92
74
|
}
|
|
@@ -101,103 +83,84 @@ function getNodeCom(app) {
|
|
|
101
83
|
return sendEvent;
|
|
102
84
|
}
|
|
103
85
|
function registerCustomTypes(app) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
type: "object",
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
]
|
|
86
|
+
const types = [
|
|
87
|
+
{
|
|
88
|
+
name: "latLngOrdLocation",
|
|
89
|
+
spec: {
|
|
90
|
+
type: "object",
|
|
91
|
+
props: [
|
|
92
|
+
{ name: "lat", type: "float" },
|
|
93
|
+
{ name: "lng", type: "float" },
|
|
94
|
+
{ name: "ord", type: "integer" }
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "latLngFloorLocation",
|
|
100
|
+
spec: {
|
|
101
|
+
type: "object",
|
|
102
|
+
props: [
|
|
103
|
+
{ name: "lat", type: "float" },
|
|
104
|
+
{ name: "lng", type: "float" },
|
|
105
|
+
{ name: "floorId", type: "string" }
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "poiIdLocation",
|
|
111
|
+
spec: { type: "object", props: [{ name: "poiId", type: "integer", min: 0 }] }
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "location",
|
|
115
|
+
spec: {
|
|
116
|
+
type: "multi",
|
|
117
|
+
types: [{ type: "poiIdLocation" }, { type: "latLngOrdLocation" }, { type: "latLngFloorLocation" }]
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "viewSettings",
|
|
122
|
+
spec: {
|
|
123
|
+
type: "object",
|
|
124
|
+
props: [
|
|
125
|
+
{ name: "zoom", type: "float", optional: true },
|
|
126
|
+
{ name: "pitch", type: "float", optional: true },
|
|
127
|
+
{ name: "bearing", type: "float", optional: true }
|
|
128
|
+
]
|
|
129
|
+
}
|
|
149
130
|
}
|
|
131
|
+
];
|
|
132
|
+
types.forEach((typeDefinition) => {
|
|
133
|
+
app.bus.send("clientAPI/registerCustomType", typeDefinition);
|
|
150
134
|
});
|
|
151
135
|
}
|
|
152
136
|
function registerEvents(app, sendEvent) {
|
|
153
|
-
|
|
154
|
-
const { lat, lng, floorId, ordinal, structureId } = await app.bus.get("map/getMapCenter");
|
|
155
|
-
sendEvent("userMoveStart", {
|
|
156
|
-
lat,
|
|
157
|
-
lng,
|
|
158
|
-
floorId,
|
|
159
|
-
ord: ordinal,
|
|
160
|
-
structureId,
|
|
161
|
-
pitch,
|
|
162
|
-
zoom,
|
|
163
|
-
bearing
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
const userMoving = async ({ pitch, zoom, bearing }) => {
|
|
137
|
+
const forwardMapMoveEvent = async (eventName, payload) => {
|
|
167
138
|
const { lat, lng, floorId, ordinal, structureId } = await app.bus.get("map/getMapCenter");
|
|
168
|
-
sendEvent(
|
|
169
|
-
lat,
|
|
170
|
-
lng,
|
|
171
|
-
floorId,
|
|
172
|
-
ord: ordinal,
|
|
173
|
-
structureId,
|
|
174
|
-
pitch,
|
|
175
|
-
zoom,
|
|
176
|
-
bearing
|
|
177
|
-
});
|
|
139
|
+
sendEvent(eventName, { lat, lng, floorId, ord: ordinal, structureId, ...payload });
|
|
178
140
|
};
|
|
179
|
-
app.bus.monitor(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
141
|
+
app.bus.monitor(
|
|
142
|
+
"map/userMoveStart",
|
|
143
|
+
(payload) => void forwardMapMoveEvent("userMoveStart", payload)
|
|
144
|
+
);
|
|
145
|
+
app.bus.monitor(
|
|
146
|
+
"map/userMoving",
|
|
147
|
+
throttleDebounce.throttle(
|
|
148
|
+
500,
|
|
149
|
+
(payload) => void forwardMapMoveEvent("userMoving", payload)
|
|
150
|
+
)
|
|
151
|
+
);
|
|
152
|
+
app.bus.monitor(
|
|
153
|
+
"map/moveEnd",
|
|
154
|
+
(payload) => void forwardMapMoveEvent("moveEnd", payload)
|
|
155
|
+
);
|
|
193
156
|
app.bus.monitor(
|
|
194
157
|
"map/floorChanged",
|
|
195
158
|
({ structure, floor }) => sendEvent("levelChange", {
|
|
196
|
-
floorId: floor
|
|
197
|
-
floorName: floor
|
|
198
|
-
ord: floor
|
|
199
|
-
structureId: structure
|
|
200
|
-
structureName: structure
|
|
159
|
+
floorId: floor?.id ?? null,
|
|
160
|
+
floorName: floor?.name ?? null,
|
|
161
|
+
ord: floor?.ordinal ?? null,
|
|
162
|
+
structureId: structure?.id ?? null,
|
|
163
|
+
structureName: structure?.name ?? null
|
|
201
164
|
})
|
|
202
165
|
);
|
|
203
166
|
app.bus.monitor("map/poiClicked", ({ poi }) => sendEvent("poiSelected", poi));
|
|
@@ -205,7 +168,14 @@ function registerEvents(app, sendEvent) {
|
|
|
205
168
|
app.bus.monitor("map/click", async ({ lat, lng, ord }) => {
|
|
206
169
|
const structures = await app.bus.get("venueData/getStructures");
|
|
207
170
|
const mapviewBBox = await app.bus.get("map/getViewBBox");
|
|
208
|
-
const { building: structure, floor } = geom.getStructureAndFloorAtPoint(
|
|
171
|
+
const { building: structure, floor } = geom.getStructureAndFloorAtPoint(
|
|
172
|
+
structures,
|
|
173
|
+
lat,
|
|
174
|
+
lng,
|
|
175
|
+
ord,
|
|
176
|
+
mapviewBBox,
|
|
177
|
+
true
|
|
178
|
+
);
|
|
209
179
|
sendEvent("mapClicked", { lat, lng, ord, building: structure, floor });
|
|
210
180
|
});
|
|
211
181
|
}
|
|
@@ -213,21 +183,23 @@ async function create(app, config) {
|
|
|
213
183
|
const sendEvent = app.env.isBrowser ? getBrowserCom(app) : getNodeCom(app);
|
|
214
184
|
const init = async () => {
|
|
215
185
|
registerCustomTypes(app);
|
|
216
|
-
sdkHeadless.headlessCommands.forEach(
|
|
186
|
+
sdkHeadless.headlessCommands.forEach(
|
|
187
|
+
(commandDefinition) => app.bus.send("clientAPI/registerCommand", commandDefinition)
|
|
188
|
+
);
|
|
217
189
|
sdkHeadless.handleHeadless(app);
|
|
218
190
|
if (!config.headless) {
|
|
219
191
|
await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../../../_virtual/_empty_module_placeholder.js')); }).then((sdkVisual) => {
|
|
220
|
-
sdkVisual.visualCommands.forEach(
|
|
192
|
+
sdkVisual.visualCommands.forEach(
|
|
193
|
+
(commandDefinition) => app.bus.send("clientAPI/registerCommand", commandDefinition)
|
|
194
|
+
);
|
|
221
195
|
sdkVisual.handleVisual(app, sendEvent);
|
|
222
196
|
});
|
|
223
197
|
}
|
|
224
198
|
const weReady = async () => {
|
|
225
199
|
await app.bus.send("system/readywhenyouare");
|
|
226
200
|
app.bus.get("clientAPI/execute", { command: "getCommandJSON" }).then((commandJSON) => sendEvent("ready", { commandJSON }));
|
|
227
|
-
if (!config.headless && app.config.uiHide
|
|
228
|
-
app.bus.send("map/changePadding", {
|
|
229
|
-
padding: { left: 55, right: 55, top: 72, bottom: 22 }
|
|
230
|
-
});
|
|
201
|
+
if (!config.headless && app.config.uiHide?.sidebar && app.env.isDesktop()) {
|
|
202
|
+
app.bus.send("map/changePadding", { padding: { left: 55, right: 55, top: 72, bottom: 22 } });
|
|
231
203
|
}
|
|
232
204
|
};
|
|
233
205
|
if (config.headless) {
|
|
@@ -238,12 +210,13 @@ async function create(app, config) {
|
|
|
238
210
|
} else {
|
|
239
211
|
app.bus.on("map/mapReadyToShow", weReady);
|
|
240
212
|
}
|
|
241
|
-
app.bus.on(
|
|
213
|
+
app.bus.on(
|
|
214
|
+
"sdkServer/sendEvent",
|
|
215
|
+
({ eventName, ...props }) => sendEvent(eventName, props)
|
|
216
|
+
);
|
|
242
217
|
};
|
|
243
218
|
registerEvents(app, sendEvent);
|
|
244
|
-
return {
|
|
245
|
-
init
|
|
246
|
-
};
|
|
219
|
+
return { init };
|
|
247
220
|
}
|
|
248
221
|
|
|
249
222
|
exports.create = create;
|
|
@@ -13,9 +13,7 @@ const parmToPlugin = {
|
|
|
13
13
|
accountId: "venueDataLoader",
|
|
14
14
|
search: "online/headerOnline",
|
|
15
15
|
ho: ["online/getDirectionsFromTo", "analytics2"],
|
|
16
|
-
// handoff indicator (used in analytics)
|
|
17
16
|
home: "online/homeView",
|
|
18
|
-
// doing a handoff to home view
|
|
19
17
|
zoom: "mapRenderer",
|
|
20
18
|
pitch: "mapRenderer",
|
|
21
19
|
bearing: "mapRenderer",
|
|
@@ -28,34 +26,38 @@ const parmToPlugin = {
|
|
|
28
26
|
refInstallId: "analytics2",
|
|
29
27
|
disableZoomToExplorePopup: "levelIndicator"
|
|
30
28
|
};
|
|
31
|
-
function setDeepLinksForParms(config, parms, forceCreate) {
|
|
29
|
+
function setDeepLinksForParms(config, parms, forceCreate = false) {
|
|
32
30
|
if (parms.has("lldebug")) {
|
|
33
31
|
try {
|
|
34
|
-
|
|
35
|
-
if (
|
|
32
|
+
const parsedDebug = JSON.parse(parms.get("lldebug") ?? "null");
|
|
33
|
+
if (parsedDebug === null) {
|
|
36
34
|
config.debug = {};
|
|
35
|
+
} else {
|
|
36
|
+
config.debug = parsedDebug;
|
|
37
37
|
}
|
|
38
38
|
} catch {
|
|
39
39
|
config.debug = true;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
Object.keys(parmToPlugin).forEach((key) => {
|
|
43
|
-
if (parms.has(key)) {
|
|
44
|
-
|
|
45
|
-
if (!Array.isArray(plugins)) {
|
|
46
|
-
plugins = [plugins];
|
|
47
|
-
}
|
|
48
|
-
plugins.forEach((plugin) => {
|
|
49
|
-
let pc = config.plugins[plugin];
|
|
50
|
-
if (!pc && forceCreate) {
|
|
51
|
-
pc = config.plugins[plugin] = {};
|
|
52
|
-
}
|
|
53
|
-
pc.deepLinkProps = { ...pc.deepLinkProps, [key]: parms.get(key) };
|
|
54
|
-
});
|
|
43
|
+
if (!parms.has(key)) {
|
|
44
|
+
return;
|
|
55
45
|
}
|
|
46
|
+
const pluginNames = parmToPlugin[key];
|
|
47
|
+
const plugins = Array.isArray(pluginNames) ? pluginNames : [pluginNames];
|
|
48
|
+
plugins.forEach((plugin) => {
|
|
49
|
+
let pluginConfig = config.plugins[plugin];
|
|
50
|
+
if (!pluginConfig && forceCreate) {
|
|
51
|
+
pluginConfig = config.plugins[plugin] = {};
|
|
52
|
+
}
|
|
53
|
+
if (!pluginConfig) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
pluginConfig.deepLinkProps = { ...pluginConfig.deepLinkProps, [key]: parms.get(key) };
|
|
57
|
+
});
|
|
56
58
|
});
|
|
57
59
|
if (parms.has("poiId") && parms.has("showNav")) {
|
|
58
|
-
delete config.plugins["online/poiView"]
|
|
60
|
+
delete config.plugins["online/poiView"]?.deepLinkProps?.poiId;
|
|
59
61
|
}
|
|
60
62
|
return config;
|
|
61
63
|
}
|
|
@@ -22,22 +22,26 @@ function _interopNamespaceDefault(e) {
|
|
|
22
22
|
|
|
23
23
|
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
24
24
|
|
|
25
|
-
function setStateFromStateString(config, stateString, forceCreate) {
|
|
25
|
+
function setStateFromStateString(config, stateString, forceCreate = false) {
|
|
26
26
|
const state = JSON.parse(stateString);
|
|
27
27
|
Object.keys(state).forEach((id) => {
|
|
28
|
-
const
|
|
29
|
-
let
|
|
30
|
-
if (!
|
|
31
|
-
|
|
28
|
+
const stateObject = state[id];
|
|
29
|
+
let pluginConfig = config.plugins[id];
|
|
30
|
+
if (!pluginConfig && forceCreate) {
|
|
31
|
+
pluginConfig = config.plugins[id] = {};
|
|
32
32
|
}
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
if (!pluginConfig) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const currentDeepLinkProps = pluginConfig.deepLinkProps;
|
|
37
|
+
if (!currentDeepLinkProps) {
|
|
38
|
+
pluginConfig.deepLinkProps = stateObject;
|
|
39
|
+
return;
|
|
40
40
|
}
|
|
41
|
+
pluginConfig.deepLinkProps = R__namespace.mergeDeepRight(
|
|
42
|
+
currentDeepLinkProps,
|
|
43
|
+
stateObject
|
|
44
|
+
);
|
|
41
45
|
});
|
|
42
46
|
return config;
|
|
43
47
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
function fire(...args) {
|
|
4
|
-
const
|
|
5
|
-
if (!
|
|
4
|
+
const observers = this._observers;
|
|
5
|
+
if (!observers) {
|
|
6
6
|
return void 0;
|
|
7
7
|
}
|
|
8
|
-
for (let x = 0; x <
|
|
8
|
+
for (let x = 0; x < observers.length; x++) {
|
|
9
9
|
try {
|
|
10
|
-
|
|
10
|
+
observers[x].apply(this, args);
|
|
11
11
|
} catch (err) {
|
|
12
12
|
console.error(err);
|
|
13
13
|
}
|
|
@@ -25,16 +25,16 @@ function observe(cb) {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
function detach(cb) {
|
|
28
|
-
this._observers
|
|
28
|
+
this._observers?.splice(this._observers.indexOf(cb), 1);
|
|
29
29
|
}
|
|
30
30
|
function filter(fn) {
|
|
31
|
-
const
|
|
31
|
+
const filteredObserver = create();
|
|
32
32
|
this.observe(function(...args) {
|
|
33
33
|
if (fn.apply(this, args)) {
|
|
34
|
-
|
|
34
|
+
filteredObserver.fire(...args);
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
|
-
return
|
|
37
|
+
return filteredObserver;
|
|
38
38
|
}
|
|
39
39
|
function filterByName(eventName) {
|
|
40
40
|
return filter.call(this, function(name) {
|
|
@@ -46,10 +46,7 @@ function on(value, cb) {
|
|
|
46
46
|
}
|
|
47
47
|
const observable = { detach, filter, fire, observe, on };
|
|
48
48
|
function extend(to, from) {
|
|
49
|
-
|
|
50
|
-
to[prop] = from[prop];
|
|
51
|
-
}
|
|
52
|
-
return to;
|
|
49
|
+
return Object.assign(to, from);
|
|
53
50
|
}
|
|
54
51
|
function create(ob) {
|
|
55
52
|
if (ob) {
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t="web-engine",e="3.3.
|
|
1
|
+
var t="web-engine",e="3.3.918",s="UNLICENSED",r="module",o="src/main.ts",i=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],a={"build-storybook":"storybook build",colors:"cat utils/colors1.txt && node utils/processColors.ts | pbcopy && cat utils/colors2.txt",demo:"cd demo/ && yarn start",dev:"yarn mol e2e","format:check":"yarn prettier . --check","format:fix":"yarn prettier . --write",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh","icons:convert":"node scripts/convertSvgToJsx.mjs",lint:"eslint . --ext .js,.jsx,.ts,.tsx",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol","playwright:ci":"yarn playwright test --grep-invert sdk","playwright:ci:failed":"yarn playwright test --last-failed --grep-invert sdk","playwright:sdk":"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./test/sdk && npx http-server' 8080 'yarn playwright test sdk --ui'","playwright:ui":"yarn playwright test --ui --grep-invert sdk",prepare:"husky",storybook:"storybook dev -p 6006",test:"vitest run --project unit","test-watch":"vitest --watch","test:comp":"vitest run --project browser","test:comp:ci":"vitest run --project browser --reporter=dot","test:comp:ui":"VITE_COMP_UI=1 vitest --project browser --ui --browser.headless=false","test:all":"yarn lint && yarn format:check && yarn test && yarn playwright:ci","test:mod":"playwright test --config=playwright.mod.config.ts",typecheck:"tsc -p tsconfig.checkjs.json","typecheck:strict":"tsc -p tsconfig.strict.json"},l=["defaults"],n={"@azure/event-hubs":"^5.12.2","@csstools/normalize.css":"^11.0.1","@dnd-kit/core":"^6.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@mapbox/mapbox-gl-draw":"^1.5.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.6","@styled-system/prop-types":"^5.1.5","@turf/area":"^7.2.0","@turf/bbox-clip":"^7.2.0","@turf/bbox-polygon":"^7.2.0","@turf/bearing":"^7.2.0","@turf/circle":"^7.2.0","@turf/helpers":"^7.2.0","@turf/point-to-line-distance":"^7.2.0","@vitejs/plugin-react":"^5.2.0","@zumer/snapdom":"^2.9.0","axe-core":"^4.10.3",browserslist:"^4.27.0","crypto-browserify":"^3.12.1",dompurify:"^3.3.3","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^26.0.0","i18next-browser-languagedetector":"^6.1.1",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^2.9.2","node-polyfill-webpack-plugin":"^4.1.0","path-browserify":"^1.0.1",pmtiles:"^4.4.0","prop-types":"^15.8.1","qrcode.react":"^4.2.0",ramda:"^0.32.0",react:"^19.2.4","react-compound-slider":"^3.4.0","react-dom":"^19.2.4","react-json-editor-ajrm":"^2.5.14","react-svg":"^16.3.0","react-virtualized-auto-sizer":"^1.0.25","react-window":"^1.8.11","smoothscroll-polyfill":"^0.4.4","styled-components":"^6.1.15","styled-normalize":"^8.1.1","styled-system":"^5.1.5","styled-tools":"^1.7.2","throttle-debounce":"^5.0.2","ua-parser-js":"^0.7.40",uuid:"^11.1.0",zousan:"^3.0.1","zousan-plus":"^4.0.1"},c={"@axe-core/playwright":"^4.10.2","@azure/identity":"^4.13.0","@azure/playwright":"^1.0.0","@playwright/test":"~1.59.1","@rollup/plugin-typescript":"^12.3.0","@storybook/addon-essentials":"^8.6.15","@storybook/blocks":"^8.6.15","@storybook/react":"^8.6.15","@storybook/react-vite":"^8.6.15","@testing-library/dom":"^10.4.1","@testing-library/jest-dom":"^6.6.3","@testing-library/react":"^16.3.0","@testing-library/user-event":"^14.5.2","@types/luxon":"^3.7.2","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@types/styled-system":"^5.1.25","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","@vitest/browser":"4.1.6","@vitest/browser-playwright":"4.1.6","@vitest/ui":"4.1.6","css-loader":"^7.1.2",eslint:"^8.57.1","eslint-config-prettier":"^10.1.8","eslint-import-resolver-alias":"^1.1.2","eslint-plugin-playwright":"^2.2.2","eslint-plugin-react":"^7.37.4","eslint-plugin-vitest":"^0.5.4","fetch-mock":"^12.6.0",glob:"^11.0.1",husky:"^9.1.7","lint-staged":"^16.4.0","node-fetch":"^2.7.0",nx:"19.8.14","nx-remotecache-azure":"^19.0.0","os-browserify":"^0.3.0",prettier:"^3.8.3","rollup-plugin-esbuild":"^6.2.1","start-server-and-test":"^2.0.11",storybook:"^8.6.15",typescript:"^5.8.2",vite:"^7.3.2",vitest:"^4.1.8","webpack-merge":"^6.0.1"},p="yarn@4.13.0",d={node:"24.x"},y={},u={name:t,version:e,private:!0,license:s,type:r,main:o,workspaces:i,scripts:a,"lint-staged":{"*.{js,ts,tsx}":["eslint --fix","prettier --check"],"*.{json,md,css,ts,tsx,jsx}":["prettier --check"],"src/i18n/**/*.json":["node utils/sort-json.ts","prettier --write"]},browserslist:l,dependencies:n,devDependencies:c,packageManager:p,engines:d,nx:y};export{l as browserslist,u as default,n as dependencies,c as devDependencies,d as engines,s as license,o as main,t as name,y as nx,p as packageManager,a as scripts,r as type,e as version,i as workspaces};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DateTime as t}from"luxon";import{pick as e,propOr as a,compose as
|
|
1
|
+
import{DateTime as t}from"luxon";import{pick as e,propOr as a,compose as i,path as r,last as l}from"ramda";import{formatTime as n,msToMin as o}from"../../../src/utils/date.js";import{FlightLabelStatus as s}from"../../../utils/constants.js";const u={ARRIVAL:"arr",DEPARTURE:"dep",ALL:"all"};function m(t,e,i,r,l){const{flightId:n,carrierFsCode:o,flightNumber:s,airline:m,flightType:d,departureAirport:g,arrivalAirport:c,airportResources:D,gatePoi:p,status:A}=e,R=E(e),{localTime:I,localOldTime:C}=h(R,r),_=T(d,A,t,I,C),N=d===u.DEPARTURE?"flightDetails:Departs _date_":"flightDetails:Arrives _date_";return{flightId:n,name:`${a("","name",m)} - ${o} ${s}`,status:_,statusText:i(`flightDetails:${L(_)}`),baggageClaim:d===u.ARRIVAL?U(D.arrivalBagClaim,i):void 0,connectionAirport:v(d,g,c,i),time:S(I?.toISO()??null,r,l),oldTime:S(C?.toISO()??null,r,l),date:i(N,{date:O(I?.toISO()??null,r,l)}),dateStamp:I?.toMillis()??0,gate:f(p),gateLabel:i("flightDetails:Gate")}}function d(t,i,r,l,n){const{flightNumber:o,flightType:s,departureAirport:m,arrivalAirport:d,airportResources:g,flightStatusUpdates:c,carrierFsCode:A,gatePoi:R,airline:I,status:C}=i,_=e(["city","iata"]),N=E(i),{localTime:P,localOldTime:$}=h(N,l),M=T(s,C,t,P,$);return{flightType:s,flightTypeLabel:r(`flightDetails:${s===u.DEPARTURE?"Departure":"Arrival"}`),name:`${a("","name",I)} - ${A} ${o}`,status:M,statusText:r(`flightDetails:${L(M)}`),baggageClaim:s===u.ARRIVAL?U(g.arrivalBagClaim,r):void 0,departure:_(m),arrival:_(d),connectionAirport:v(s,m,d,r),flightIn:D(M,s,t,P,r),time:S(P?.toISO()??null,l,n),oldTime:S($?.toISO()??null,l,n),date:O(P?.toISO()??null,l,n),lastUpdated:p(t,c??[],r),flightDuration:"",gateLabel:r("flightDetails:Gate"),gate:f(R),tags:[],flightIconBaseName:s===u.ARRIVAL?"arrivals":"departures"}}const g=(t,e)=>t.dateStamp-e.dateStamp,c=/[A-Z]?\d+[a-zA-Z]?/,f=t=>{if(!t)return{name:"-"};const e=t.name.match(c);return{...t,name:e?e[0]:t.name}},D=(t,e,a,i,r)=>{if(t===s.DEPARTED)return r("flightDetails:Departed");if(t===s.ARRIVED)return r("flightDetails:Arrived");if(t===s.CANCELLED)return null;if(!i)return null;return r(`flightDetails:${e===u.DEPARTURE?"Departs":"Arrives"} in _minutes_ minute`,{count:A(a,i)})},p=(t,e,a)=>{const n=i(r(["updatedAt","dateUtc"]),l)(e),o=_(n);if(!o)return a("flightDetails:Last updated a few minutes ago");const s=A(t,o);return s<10?a("flightDetails:Last updated a few minutes ago"):s<60?a("flightDetails:Last updated _minutes_ minutes ago",{minutes:s}):a("flightDetails:Last updated over an hour ago")},A=(t,e)=>o(Math.abs(t.toMillis()-e.toMillis())),E=({flightType:t,operationalTimes:e,departureDate:a,arrivalDate:i})=>t===u.DEPARTURE?R(a,e.estimatedGateDeparture):R(i,e.estimatedGateArrival),R=(t,e)=>{const a=t.dateLocal||t.dateUtc,i=e?.dateLocal||e?.dateUtc;return i&&a!==i?{time:i,oldTime:a}:{time:a}},h=({time:t,oldTime:e},a)=>({localTime:_(t,a),localOldTime:_(e,a)});function T(t,e,a,i,r){if(!i)return s.UNKNOWN;if(a>i)return I(t);return"C"===e.toUpperCase()?s.CANCELLED:r?i>r?s.DELAYED:s.EARLY:s.ON_TIME}const L=t=>{switch(t){case s.ON_TIME:return"on-time";case s.EARLY:return"early";case s.DELAYED:return"delayed";case s.CANCELLED:return"cancelled";case s.DEPARTED:return"departed";case s.ARRIVED:return"arrived";default:return"unknown"}},I=t=>t===u.DEPARTURE?s.DEPARTED:s.ARRIVED,v=(t,e,a,i)=>t===u.DEPARTURE?i(C("To"),a??{}):i(C("From"),e??{}),C=t=>`flightDetails:${t} _city_ (_iata_)`,U=(t,e)=>t?e("flightDetails:Collect luggage from Baggage Claim _claimNum_",{claimNum:t}):null,_=(e,a)=>e?t.fromISO(e,{zone:a}):null,O=(e,a,i="en-US")=>e?t.fromISO(e,{zone:a}).setLocale(i).toFormat("EEE, d MMMM"):null,S=(e,a,i="en-US")=>e?n(t.fromISO(e,{zone:a}),i):null;export{u as FlightType,g as flightComparator,f as formatGate,c as gateNameRegex,d as mapFlightDetails,m as mapFlightListItem};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"flexsearch";import{DateTime as a}from"luxon";import*as e from"ramda";import{FlightType as r,mapFlightDetails as i,mapFlightListItem as n,flightComparator as o}from"./flightDetailsMapper.js";import{searchFlights as s}from"./utils.js";function l(l,p){const
|
|
1
|
+
import t from"flexsearch";import{DateTime as a}from"luxon";import*as e from"ramda";import{FlightType as r,mapFlightDetails as i,mapFlightListItem as n,flightComparator as o}from"./flightDetailsMapper.js";import{searchFlights as s}from"./utils.js";function l(l,p){const g=()=>new t.Index({tokenize:"forward"}),c={lastUpdated:0,flights:{dep:{},arr:{}},index:{dep:g(),arr:g()},gates:null,apiError:!1},u=(t,a)=>{c.index[t]=g(),c.flights[t]={},a.forEach(a=>{c.index[t].add(a.flightId,f(a)),c.flights[t][a.flightId]=a})},d=[["flightNumber"],["airline","iata"],["airline","name"],["arrivalAirport","iata"],["arrivalAirport","city"],["departureAirport","iata"],["departureAirport","city"]],f=t=>d.map(a=>e.path(a,t)).filter(t=>"string"==typeof t&&t.length>0).join(" "),h=async()=>{if(null===c.gates){const t=await l.bus.get("poi/getByCategoryId",{categoryId:"gate"}),a=({name:t})=>e.tail(t.replace(",","").split(" ")),r=Object.values(t).flatMap(t=>a(t).map(a=>[a,t]));c.gates=e.fromPairs(r)}return c},m=async()=>{await h();const t=await l.bus.get("venueData/getVenueData"),a=new URLSearchParams,i=l.i18n?.().language;if(i&&a.append("locale",i),p?.timeRange){const t=Date.now();a.append("startDate",new Date(t-p.timeRange.beforeNowMs).toISOString()),a.append("endDate",new Date(t+p.timeRange.afterNowMs).toISOString())}const n=`https://marketplace.locuslabs.com/venueId/${t.baseVenueId}/flight-status`,o=a.toString()?`${n}?${a.toString()}`:n;try{const t=await fetch(o),a=await t.json();[r.ARRIVAL,r.DEPARTURE].forEach(t=>{const i=t===r.DEPARTURE?"departures":"arrivals",{airports:n,airlines:o}=a.data[i].appendix;u(t,((t,a,i,n)=>{const o=a.reduce((t,a)=>({...t,[a.iata]:a}),{}),s=i.flatMap(t=>[{code:t.iata,airline:t},{code:t.icao,airline:t}]).filter(t=>Boolean(t.code)).reduce((t,{code:a,airline:e})=>({...t,[a]:e}),{});return t.map(t=>{const a=n===r.DEPARTURE?e.pathOr("",["airportResources","departureGate"],t):e.pathOr("",["airportResources","arrivalGate"],t),i=c.gates?.[String(a)];return{...t,flightType:n,gatePoi:i,airline:s[t.carrierFsCode],departureAirport:o[t.departureAirportFsCode],arrivalAirport:o[t.arrivalAirportFsCode]}})})(a.data[i].flightStatuses,n,o,t))}),c.apiError=!1}catch(t){c.apiError=!0,console.error("Error from flight status api call",t),[r.ARRIVAL,r.DEPARTURE].forEach(t=>u(t,[]))}finally{c.lastUpdated=Date.now()}return c},R=async()=>{Date.now()-c.lastUpdated>6e4&&await m()};return l.bus.on("flightStatus/query",async({term:t=null,type:a=r.DEPARTURE}={})=>(await R(),s(t,a,c))),l.bus.on("flightStatus/getFlight",async({flightId:t})=>(await R(),c.flights.dep[t]||c.flights.arr[t])),l.bus.on("flightStatus/mapFlightDetails",async({flight:t})=>i(a.local(),t,l.gt(),c.tz,l.i18n?.().language??"en-US")),l.bus.on("flightStatus/mapFlightListItems",async({flights:t})=>t.map(t=>n(a.local(),t,l.gt(),c.tz,l.i18n?.().language??"en-US")).sort(o)),{init:async()=>{c.tz=await l.bus.get("venueData/getVenueTimezone")},internal:{updateFlights:m,indexGatePois:h}}}export{l as create};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FlightType as t}from"./flightDetailsMapper.js";const r=(e,a,l)=>{const{index:
|
|
1
|
+
import{FlightType as t}from"./flightDetailsMapper.js";const r=(e,a,l)=>{const{index:i,flights:p,apiError:o}=l,s=a===t.ALL?[t.DEPARTURE,t.ARRIVAL]:[a];let f;return f=e?s.flatMap(t=>i[t].search({query:e}).map(r=>p[t][String(r)]).filter(t=>Boolean(t))):s.flatMap(t=>Object.values(p[t])),0===f.length&&e&&/^\w\w\d{2,4}$/.test(e)?r(e.replace(/(\w\w)(\d{2,4})/,"$1_$2"),a,l):{flights:f,apiError:o}};export{r as searchFlights};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b64DecodeUnicode as e,filterOb as i}from"../../../src/utils/funcs.js";import{setDeepLinksForParms as n}from"../../../src/configs/postproc-mol-url-parms.js";import{setStateFromStateString as o}from"../../../src/configs/postproc-stateTracking.js";
|
|
1
|
+
import{b64DecodeUnicode as e,filterOb as i}from"../../../src/utils/funcs.js";import{setDeepLinksForParms as n}from"../../../src/configs/postproc-mol-url-parms.js";import{setStateFromStateString as o}from"../../../src/configs/postproc-stateTracking.js";const t=(e,i)=>{if(void 0===e)return;const n=e.toString();return n.length>i?n.substring(0,i):n},s=(e,i)=>void 0!==i?{[e]:i}:{},a=e=>{if(!e||"object"!=typeof e)return;const i={};return Object.keys(e).slice(0,10).forEach(n=>{let o=t(n.toString().replaceAll(/[^a-zA-Z0-9_]/g,""),128)??"X";o.match(/^[a-zA-Z]+/)||(o=`X${o}`);let s=e[n];null==s&&(s=""),i[o]=t(String(s),128)??""}),i};function r(e,i,n){Object.keys(e).filter(e=>e.startsWith(`${i}-`)).forEach(i=>{n[i]=e[i]})}function l(l){const{name:c,debug:p,headless:u,theme:d,defaultSearchTerms:g,venueId:h,accountId:m,poiCategories:f,preserveStateInURL:S,supportURLDeepLinks:v,initState:k,deepLinkParms:L,uiHide:P,renderDiv:w,parentConfig:A,desktopViewMinWidth:y,forceDesktop:V,hostAppId:b,hostAppVersion:j,hostAppProperties:D,logFilter:I,searchPlaceholder:Z,dataFetch:F,engineName:C,dynamicPoisUrlBaseV1:O,plugins:R,analytics2ActiveFlag:T,enablePoiSelection:U,showSurround:x,minZoom:M,maxZoom:W,noLangOptions:z,pinnedLocation:B,pinnedLocationZoom:H,pinnedLocationFocusAtStart:E,pinnedLocationBearing:N,pinnedLocationPitch:X}=l,$=A?[A]:u?["sdkHeadless"]:["sdkVisual"],_={name:c,engineName:C,extends:$,debug:p,logFilter:I,theme:d,uiHide:P,renderDiv:w,configPostProc:[],plugins:{venueDataLoader:{dataFetch:F,venueId:h,accountId:m},sdkServer:{headless:u},analytics2:{hostAppId:b?t(b,128):void 0,hostAppVersion:j?t(j,128):void 0,hostAppProperties:a(D)}},uuid:"undefined"!=typeof document&&document.location?document.location.host:"unknown"};if(void 0!==T&&(_.plugins.analytics2={..._.plugins.analytics2,active:T}),u||(_.plugins["online/headerOnline"]={searchPlaceholder:Z},_.plugins.mapRenderer={...s("enablePoiSelection",U),surroundConfig:x?{}:null,viewLimits:{...s("maxZoom",W),...s("minZoom",M)}},_.plugins.userMenu={noLangOptions:z},B&&(_.plugins["online/pinnedLocation"]={location:B,zoom:H,focusAtStart:E,bearing:N,pitch:X})),_.plugins.searchService=g?{defaultSearchTerms:g}:{},r(l,"defaultSearchTerms",_.plugins.searchService),$.includes("sdkVisual")&&(_.plugins["online/homeView"]=f?{poiCategories:f}:{},r(l,"poiCategories",_.plugins["online/homeView"])),R&&"object"==typeof R){const e=R;e.draw&&(_.plugins.draw=e.draw),e.flightStatus&&(_.plugins.flightStatus=e.flightStatus,_.plugins["online/flightDetails"]={},_.plugins["online/flightDetailsSearch"]={})}return S&&((_.configPostProc??[]).push("stateTracking"),_.plugins.deepLinking={trackURL:!0}),v&&(_.configPostProc??[]).push("mol-url-parms"),k&&o(_,e(k),!0),L&&n(_,new URLSearchParams(L),!0),void 0!==y&&(_.desktopViewMinWidth=y),V&&(_.desktopViewMinWidth=0),O&&(_.plugins.dynamicPois={urlBaseV1:O}),i((e,i)=>void 0!==i,_)}export{l as default};
|