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.
@@ -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, { messageType, senderOrigin, command, iframeOrigin }) {
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 = (ob) => JSON.parse(JSON.stringify(ob));
35
+ const clean = (value) => JSON.parse(JSON.stringify(value));
36
36
  const sendResponse = (payload, clientMsgId) => {
37
- const ob = {
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(ob, "*");
39
+ window.postMessage(message, "*");
46
40
  } catch {
47
- window.postMessage(clean(ob), "*");
41
+ window.postMessage(clean(message), "*");
48
42
  }
49
43
  };
50
44
  const sendError = (payload, clientMsgId) => {
51
- const ob = {
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
- const ob = {
63
- event,
64
- payload,
65
- type: "LL-server"
66
- };
67
- window.postMessage(ob, "*");
48
+ window.postMessage({ event, payload, type: "LL-server" }, "*");
68
49
  };
69
- function msgHandler(e) {
70
- const d = e.data;
71
- if (d && d.type === "LL-client") {
72
- const iframeOrigin = window.location.origin;
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
- app.bus.send("clientAPI/registerCustomType", {
105
- name: "latLngOrdLocation",
106
- spec: {
107
- type: "object",
108
- props: [
109
- { name: "lat", type: "float" },
110
- { name: "lng", type: "float" },
111
- { name: "ord", type: "integer" }
112
- ]
113
- }
114
- });
115
- app.bus.send("clientAPI/registerCustomType", {
116
- name: "latLngFloorLocation",
117
- spec: {
118
- type: "object",
119
- props: [
120
- { name: "lat", type: "float" },
121
- { name: "lng", type: "float" },
122
- { name: "floorId", type: "string" }
123
- ]
124
- }
125
- });
126
- app.bus.send("clientAPI/registerCustomType", {
127
- name: "poiIdLocation",
128
- spec: {
129
- type: "object",
130
- props: [{ name: "poiId", type: "integer", min: 0 }]
131
- }
132
- });
133
- app.bus.send("clientAPI/registerCustomType", {
134
- name: "location",
135
- spec: {
136
- type: "multi",
137
- types: [{ type: "poiIdLocation" }, { type: "latLngOrdLocation" }, { type: "latLngFloorLocation" }]
138
- }
139
- });
140
- app.bus.send("clientAPI/registerCustomType", {
141
- name: "viewSettings",
142
- spec: {
143
- type: "object",
144
- props: [
145
- { name: "zoom", type: "float", optional: true },
146
- { name: "pitch", type: "float", optional: true },
147
- { name: "bearing", type: "float", optional: true }
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
- 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", {
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("userMoving", {
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("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", {
183
- lat,
184
- lng,
185
- floorId,
186
- ord: ordinal,
187
- structureId,
188
- pitch,
189
- zoom,
190
- bearing
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 ? floor.id : null,
197
- floorName: floor ? floor.name : null,
198
- ord: floor ? floor.ordinal : null,
199
- structureId: structure ? structure.id : null,
200
- structureName: structure ? structure.name : null
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(structures, lat, lng, ord, mapviewBBox, true);
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((cdef) => app.bus.send("clientAPI/registerCommand", cdef));
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((cdef) => app.bus.send("clientAPI/registerCommand", cdef));
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 && app.config.uiHide.sidebar && app.env.isDesktop()) {
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("sdkServer/sendEvent", ({ eventName, ...props }) => sendEvent(eventName, props));
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
- config.debug = JSON.parse(parms.get("lldebug"));
35
- if (config.debug === null) {
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
- let plugins = parmToPlugin[key];
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"].deepLinkProps.poiId;
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 so = state[id];
29
- let pluginConf = config.plugins[id];
30
- if (!pluginConf && forceCreate) {
31
- pluginConf = config.plugins[id] = {};
28
+ const stateObject = state[id];
29
+ let pluginConfig = config.plugins[id];
30
+ if (!pluginConfig && forceCreate) {
31
+ pluginConfig = config.plugins[id] = {};
32
32
  }
33
- if (pluginConf) {
34
- const curDLP = pluginConf.deepLinkProps;
35
- if (!curDLP) {
36
- pluginConf.deepLinkProps = so;
37
- } else {
38
- pluginConf.deepLinkProps = R__namespace.mergeDeepRight(curDLP, so);
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 ob = this._observers;
5
- if (!ob) {
4
+ const observers = this._observers;
5
+ if (!observers) {
6
6
  return void 0;
7
7
  }
8
- for (let x = 0; x < ob.length; x++) {
8
+ for (let x = 0; x < observers.length; x++) {
9
9
  try {
10
- ob[x].apply(this, args);
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.splice(this._observers.indexOf(cb), 1);
28
+ this._observers?.splice(this._observers.indexOf(cb), 1);
29
29
  }
30
30
  function filter(fn) {
31
- const o2 = create();
31
+ const filteredObserver = create();
32
32
  this.observe(function(...args) {
33
33
  if (fn.apply(this, args)) {
34
- o2.fire(...args);
34
+ filteredObserver.fire(...args);
35
35
  }
36
36
  });
37
- return o2;
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
- for (const prop in from) {
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) {
@@ -1 +1 @@
1
- var t="web-engine",e="3.3.917",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
+ 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 r,path as i,last as l}from"ramda";import{formatTime as o,msToMin as s}from"../../../src/utils/date.js";import{FlightLabelStatus as n}from"../../../utils/constants.js";const m={ARRIVAL:"arr",DEPARTURE:"dep",ALL:"all"};function u(t,e,r,i,l){const{flightId:o,carrierFsCode:s,flightNumber:n,airline:u,flightType:d,departureAirport:g,arrivalAirport:c,airportResources:f,gatePoi:A,status:p}=e,R=E(e),{localTime:v,localOldTime:I}=h(R,i),_=T(d,p,t,v,I),$=d===m.DEPARTURE?"flightDetails:Departs _date_":"flightDetails:Arrives _date_";return{flightId:o,name:`${a("","name",u)} - ${s} ${n}`,status:_,statusText:r(`flightDetails:${L(_)}`),baggageClaim:d===m.ARRIVAL?U(f.arrivalBagClaim,r):void 0,connectionAirport:C(d,g,c,r),time:P(v,i,l),oldTime:P(I,i,l),date:r($,{date:N(v,i,l)}),dateStamp:v.toMillis(),gate:D(A),gateLabel:r("flightDetails:Gate")}}function d(t,r,i,l,o){const{flightNumber:s,flightType:n,departureAirport:u,arrivalAirport:d,airportResources:g,flightStatusUpdates:c,carrierFsCode:p,gatePoi:R,airline:v,status:I}=r,_=e(["city","iata"]),$=E(r),{localTime:y,localOldTime:O}=h($,l),S=T(n,I,t,y,O);return{flightType:n,flightTypeLabel:i(`flightDetails:${n===m.DEPARTURE?"Departure":"Arrival"}`),name:`${a("","name",v)} - ${p} ${s}`,status:S,statusText:i(`flightDetails:${L(S)}`),baggageClaim:n===m.ARRIVAL?U(g.arrivalBagClaim,i):void 0,departure:_(u),arrival:_(d),connectionAirport:C(n,u,d,i),flightIn:f(S,n,t,y,i),time:P(y,l,o),oldTime:P(O,l,o),date:N(y,l,o),lastUpdated:A(t,c,i),flightDuration:"",gateLabel:i("flightDetails:Gate"),gate:D(R),tags:[],flightIconBaseName:n===m.ARRIVAL?"arrivals":"departures"}}const g=(t,e)=>t.dateStamp-e.dateStamp,c=/[A-Z]?\d+[a-zA-Z]?/,D=t=>{if(!t)return{name:"-"};const e=t.name.match(c),a=e?e[0]:t.name;return{...t,name:a}},f=(t,e,a,r,i)=>{if(t===n.DEPARTED)return i("flightDetails:Departed");if(t===n.ARRIVED)return i("flightDetails:Arrived");if(t===n.CANCELLED)return null;return i(`flightDetails:${e===m.DEPARTURE?"Departs":"Arrives"} in _minutes_ minute`,{count:p(a,r)})},A=(t,e,a)=>{const o=r(i(["updatedAt","dateUtc"]),l)(e),s=p(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")},p=(t,e)=>{const a=Math.abs(t-e);return s(a)},E=({flightType:t,operationalTimes:e,departureDate:a,arrivalDate:r})=>t===m.DEPARTURE?R(a,e.estimatedGateDeparture):R(r,e.estimatedGateArrival),R=(t,e)=>{const a=t.dateLocal||t.dateUtc,r=e.dateLocal||e.dateUtc;return r&&a!==r?{time:r,oldTime:a}:{time:a}},h=({time:t,oldTime:e},a)=>({localTime:_(t,a),localOldTime:_(e,a)});function T(t,e,a,r,i){return r?a>r?v(t):"C"===(e=e.toUpperCase())?n.CANCELLED:i?r>i?n.DELAYED:n.EARLY:n.ON_TIME:n.UNKNOWN}const L=t=>{switch(t){case n.ON_TIME:return"on-time";case n.EARLY:return"early";case n.DELAYED:return"delayed";case n.CANCELLED:return"cancelled";case n.DEPARTED:return"departed";case n.ARRIVED:return"arrived";default:return"unknown"}},v=t=>t===m.DEPARTURE?n.DEPARTED:n.ARRIVED,C=(t,e,a,r)=>t===m.DEPARTURE?r(I("To"),a):r(I("From"),e),I=t=>`flightDetails:${t} _city_ (_iata_)`,U=(t,e)=>t&&e("flightDetails:Collect luggage from Baggage Claim _claimNum_",{claimNum:t}),_=(e,a)=>e&&t.fromISO(e,{zone:a}),N=(e,a,r="en-US")=>e&&t.fromISO(e,{zone:a}).setLocale(r).toFormat("EEE, d MMMM"),P=(e,a,r="en-US")=>e&&o(t.fromISO(e,{zone:a}),r);export{m as FlightType,g as flightComparator,D as formatGate,c as gateNameRegex,d as mapFlightDetails,u as mapFlightListItem};
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 u=()=>new t.Index({tokenize:"forward"}),g={lastUpdated:0,flights:{dep:null,arr:null},index:{dep:u(),arr:u()},gates:null,apiError:!1},c=(t,a)=>{g.index[t]=u(),g.flights[t]={},a.forEach(a=>{g.index[t].add(a.flightId,d(a)),g.flights[t][a.flightId]=a})},d=e.pipe(e.juxt(e.map(e.path,[["flightNumber"],["airline","iata"],["airline","name"],["arrivalAirport","iata"],["arrivalAirport","city"],["departureAirport","iata"],["departureAirport","city"]])),e.filter(e.identity),e.join(" ")),f=async()=>{if(null===g.gates){const t=await l.bus.get("poi/getByCategoryId",{categoryId:"gate"}),a=({name:t})=>e.tail(t.replace(",","").split(" ")),r=e.reduce((t,r)=>{const i=a(r);return[...t,...e.map(t=>[t,r],i)]},[],Object.values(t));g.gates=e.fromPairs(r)}return g},h=async()=>{await f();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(),e=new Date(t-p.timeRange.beforeNowMs).toISOString(),r=new Date(t+p.timeRange.afterNowMs).toISOString();a.append("startDate",e),a.append("endDate",r)}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;c(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(({code:t})=>t).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=g.gates[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))}),g.apiError=!1}catch(t){g.apiError=!0,console.error("Error from flight status api call",t),[r.ARRIVAL,r.DEPARTURE].forEach(t=>{c(t,[])})}finally{g.lastUpdated=Date.now()}return g},m=async()=>{Date.now()-g.lastUpdated>6e4&&await h()};return l.bus.on("flightStatus/query",async({term:t=null,type:a=r.DEPARTURE}={})=>(await m(),s(t,a,g))),l.bus.on("flightStatus/getFlight",async({flightId:t})=>{await m();return g.flights.dep[t]||g.flights.arr[t]}),l.bus.on("flightStatus/mapFlightDetails",async({flight:t})=>i(a.local(),t,l.gt(),g.tz,l.i18n().language)),l.bus.on("flightStatus/mapFlightListItems",async({flights:t})=>t.map(t=>n(a.local(),t,l.gt(),g.tz,l.i18n().language)).sort(o)),{init:async()=>{g.tz=await l.bus.get("venueData/getVenueTimezone")},internal:{updateFlights:h,indexGatePois:f}}}export{l as create};
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:p,flights:s,apiError:i}=l,o=a===t.ALL?[t.DEPARTURE,t.ARRIVAL]:[a];let f;if(f=e?o.flatMap(t=>p[t].search({query:e}).map(r=>s[t][r])):o.flatMap(t=>Object.values(s[t])),0===f.length&&/^\w\w\d{2,4}$/.test(e)){const t=e.replace(/(\w\w)(\d{2,4})/,"$1_$2");return r(t,a,l)}return{flights:f,apiError:i}};export{r as searchFlights};
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";function t(t){const{name:a,debug:r,headless:l,theme:c,defaultSearchTerms:p,venueId:u,accountId:d,poiCategories:g,preserveStateInURL:h,supportURLDeepLinks:m,initState:f,deepLinkParms:S,uiHide:v,renderDiv:k,parentConfig:L,desktopViewMinWidth:P,forceDesktop:w,hostAppId:A,hostAppVersion:V,hostAppProperties:b,logFilter:y,searchPlaceholder:D,dataFetch:I,engineName:Z,dynamicPoisUrlBaseV1:j,plugins:F,analytics2ActiveFlag:C,enablePoiSelection:O,showSurround:R,minZoom:T,maxZoom:U,noLangOptions:x,pinnedLocation:M,pinnedLocationZoom:W,pinnedLocationFocusAtStart:z,pinnedLocationBearing:B,pinnedLocationPitch:H}=t,E=L?[L]:l?["sdkHeadless"]:["sdkVisual"],N=(e,i)=>e&&e.length>i?e.substring(0,i):e,X={name:a,engineName:Z,extends:E,debug:r,logFilter:y,theme:c,uiHide:v,renderDiv:k,configPostProc:[],plugins:{venueDataLoader:{dataFetch:I,venueId:u,accountId:d},sdkServer:{headless:l},analytics2:{hostAppId:(q=A,q?N(q.toString(),128):void 0),hostAppVersion:(_=V,_?N(_.toString(),128):void 0),hostAppProperties:(e=>{if(!e||"object"!=typeof e)return;const i={},n=Object.keys(e);return n.length>10&&(n.length=10),n.forEach(n=>{let o=N(n.toString().replaceAll(/[^a-zA-Z0-9_]/g,""),128);o.match(/^[a-zA-Z]+/)||(o="X"+o);let t=e[n];null==t&&(t=""),t=N(t.toString(),128),i[o]=t}),i})(b)}},uuid:"undefined"!=typeof document&&document&&document.location?document.location.host:"unknown"};var _,q;void 0!==C&&(X.plugins.analytics2.active=C);const G=(e,i)=>void 0!==i?{[e]:i}:{};return l||(X.plugins["online/headerOnline"]={searchPlaceholder:D},X.plugins.mapRenderer={...G("enablePoiSelection",O),surroundConfig:R?{}:null,viewLimits:{...G("maxZoom",U),...G("minZoom",T)}},X.plugins.userMenu={noLangOptions:x},M&&(X.plugins["online/pinnedLocation"]={location:M,zoom:W,focusAtStart:z,bearing:B,pitch:H})),X.plugins.searchService=p?{defaultSearchTerms:p}:{},s(t,"defaultSearchTerms",X.plugins.searchService),E.includes("sdkVisual")&&(X.plugins["online/homeView"]=g?{poiCategories:g}:{},s(t,"poiCategories",X.plugins["online/homeView"])),F&&(F.draw&&(X.plugins.draw=F.draw),F.flightStatus&&(X.plugins.flightStatus=F.flightStatus,X.plugins["online/flightDetails"]={},X.plugins["online/flightDetailsSearch"]={})),h&&(X.configPostProc.push("stateTracking"),X.plugins.deepLinking={trackURL:!0}),m&&X.configPostProc.push("mol-url-parms"),f&&o(X,e(f),!0),S&&n(X,new URLSearchParams(S),!0),void 0!==P&&(X.desktopViewMinWidth=P),w&&(X.desktopViewMinWidth=0),j&&(X.plugins.dynamicPois={urlBaseV1:j}),i((e,i)=>void 0!==i,X)}function s(e,i,n){Object.keys(e).filter(e=>e.startsWith(i+"-")).forEach(i=>n[i]=e[i])}export{t as default};
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};