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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var name = "web-engine";
6
- var version = "3.3.917";
6
+ var version = "3.3.918";
7
7
  var license = "UNLICENSED";
8
8
  var type = "module";
9
9
  var main = "src/main.ts";
@@ -34,12 +34,12 @@ function mapFlightListItem(nowDate, flight, T, tz, locale) {
34
34
  statusText: T(`flightDetails:${getFlightStatusText(status)}`),
35
35
  baggageClaim: flightType === FlightType.ARRIVAL ? prepareBaggageClaim(airportResources.arrivalBagClaim, T) : void 0,
36
36
  connectionAirport: prepareAirportLabel(flightType, departureAirport, arrivalAirport, T),
37
- time: getLocalFormattedTime(localTime, tz, locale),
38
- oldTime: getLocalFormattedTime(localOldTime, tz, locale),
37
+ time: getLocalFormattedTime(localTime?.toISO() ?? null, tz, locale),
38
+ oldTime: getLocalFormattedTime(localOldTime?.toISO() ?? null, tz, locale),
39
39
  date: T(datePlaceholder, {
40
- date: getLocalFormattedDate(localTime, tz, locale)
40
+ date: getLocalFormattedDate(localTime?.toISO() ?? null, tz, locale)
41
41
  }),
42
- dateStamp: localTime.toMillis(),
42
+ dateStamp: localTime?.toMillis() ?? 0,
43
43
  gate: formatGate(gatePoi),
44
44
  gateLabel: T("flightDetails:Gate")
45
45
  };
@@ -73,10 +73,10 @@ function mapFlightDetails(nowDate, flight, T, tz, locale) {
73
73
  arrival: pickAirportData(arrivalAirport),
74
74
  connectionAirport: prepareAirportLabel(flightType, departureAirport, arrivalAirport, T),
75
75
  flightIn: prepareFlightIn(status, flightType, nowDate, localTime, T),
76
- time: getLocalFormattedTime(localTime, tz, locale),
77
- oldTime: getLocalFormattedTime(localOldTime, tz, locale),
78
- date: getLocalFormattedDate(localTime, tz, locale),
79
- lastUpdated: prepareLastUpdated(nowDate, flightStatusUpdates, T),
76
+ time: getLocalFormattedTime(localTime?.toISO() ?? null, tz, locale),
77
+ oldTime: getLocalFormattedTime(localOldTime?.toISO() ?? null, tz, locale),
78
+ date: getLocalFormattedDate(localTime?.toISO() ?? null, tz, locale),
79
+ lastUpdated: prepareLastUpdated(nowDate, flightStatusUpdates ?? [], T),
80
80
  flightDuration: "",
81
81
  gateLabel: T("flightDetails:Gate"),
82
82
  gate: formatGate(gatePoi),
@@ -91,42 +91,45 @@ const formatGate = (gate) => {
91
91
  return { name: "-" };
92
92
  }
93
93
  const match = gate.name.match(gateNameRegex);
94
- const name = match ? match[0] : gate.name;
95
- return { ...gate, name };
94
+ return { ...gate, name: match ? match[0] : gate.name };
96
95
  };
97
96
  const prepareFlightIn = (status, flightType, nowDate, flightDate, T) => {
98
97
  if (status === constants.FlightLabelStatus.DEPARTED) {
99
98
  return T("flightDetails:Departed");
100
- } else if (status === constants.FlightLabelStatus.ARRIVED) {
99
+ }
100
+ if (status === constants.FlightLabelStatus.ARRIVED) {
101
101
  return T("flightDetails:Arrived");
102
- } else if (status === constants.FlightLabelStatus.CANCELLED) {
102
+ }
103
+ if (status === constants.FlightLabelStatus.CANCELLED) {
104
+ return null;
105
+ }
106
+ if (!flightDate) {
103
107
  return null;
104
108
  }
105
109
  const prefix = flightType === FlightType.DEPARTURE ? "Departs" : "Arrives";
106
- const minutes = minutesBetween(nowDate, flightDate);
107
- return T(`flightDetails:${prefix} in _minutes_ minute`, { count: minutes });
110
+ return T(`flightDetails:${prefix} in _minutes_ minute`, { count: minutesBetween(nowDate, flightDate) });
108
111
  };
109
112
  const prepareLastUpdated = (nowDate, flightStatusUpdates, T) => {
110
113
  const updateDate = R.compose(R.path(["updatedAt", "dateUtc"]), R.last)(flightStatusUpdates);
111
- const minutes = minutesBetween(nowDate, getLocalGMTDate(updateDate));
114
+ const localUpdateDate = getLocalGMTDate(updateDate);
115
+ if (!localUpdateDate) {
116
+ return T("flightDetails:Last updated a few minutes ago");
117
+ }
118
+ const minutes = minutesBetween(nowDate, localUpdateDate);
112
119
  if (minutes < 10) {
113
120
  return T("flightDetails:Last updated a few minutes ago");
114
- } else if (minutes < 60) {
121
+ }
122
+ if (minutes < 60) {
115
123
  return T("flightDetails:Last updated _minutes_ minutes ago", { minutes });
116
- } else {
117
- return T("flightDetails:Last updated over an hour ago");
118
124
  }
125
+ return T("flightDetails:Last updated over an hour ago");
119
126
  };
120
- const minutesBetween = (firstDate, secondDate) => {
121
- const ms = Math.abs(firstDate - secondDate);
122
- return date.msToMin(ms);
123
- };
127
+ const minutesBetween = (firstDate, secondDate) => date.msToMin(Math.abs(firstDate.toMillis() - secondDate.toMillis()));
124
128
  const selectRawDateTime = ({ flightType, operationalTimes, departureDate, arrivalDate }) => flightType === FlightType.DEPARTURE ? prepareRawDateTime(departureDate, operationalTimes.estimatedGateDeparture) : prepareRawDateTime(arrivalDate, operationalTimes.estimatedGateArrival);
125
129
  const prepareRawDateTime = (dateTime, estimatedTime) => {
126
130
  const localDate = dateTime.dateLocal || dateTime.dateUtc;
127
- const estimatedDate = estimatedTime.dateLocal || estimatedTime.dateUtc;
128
- const isTimeChanged = estimatedDate && localDate !== estimatedDate;
129
- return isTimeChanged ? { time: estimatedDate, oldTime: localDate } : { time: localDate };
131
+ const estimatedDate = estimatedTime?.dateLocal || estimatedTime?.dateUtc;
132
+ return estimatedDate && localDate !== estimatedDate ? { time: estimatedDate, oldTime: localDate } : { time: localDate };
130
133
  };
131
134
  const formatToLocalDateTimes = ({ time, oldTime }, tz) => ({
132
135
  localTime: getLocalGMTDate(time, tz),
@@ -139,17 +142,17 @@ function mapFlightStatus(flightType, status, nowDate, localTime, localOldTime) {
139
142
  if (nowDate > localTime) {
140
143
  return lateFlightStatus(flightType);
141
144
  }
142
- status = status.toUpperCase();
143
- if (status === "C") {
145
+ const normalizedStatus = status.toUpperCase();
146
+ if (normalizedStatus === "C") {
144
147
  return constants.FlightLabelStatus.CANCELLED;
145
148
  }
146
149
  if (!localOldTime) {
147
150
  return constants.FlightLabelStatus.ON_TIME;
148
- } else if (localTime > localOldTime) {
151
+ }
152
+ if (localTime > localOldTime) {
149
153
  return constants.FlightLabelStatus.DELAYED;
150
- } else {
151
- return constants.FlightLabelStatus.EARLY;
152
154
  }
155
+ return constants.FlightLabelStatus.EARLY;
153
156
  }
154
157
  const getFlightStatusText = (status) => {
155
158
  switch (status) {
@@ -170,14 +173,12 @@ const getFlightStatusText = (status) => {
170
173
  }
171
174
  };
172
175
  const lateFlightStatus = (flightType) => flightType === FlightType.DEPARTURE ? constants.FlightLabelStatus.DEPARTED : constants.FlightLabelStatus.ARRIVED;
173
- const prepareAirportLabel = (flightType, departureAirport, arrivalAirport, T) => flightType === FlightType.DEPARTURE ? T(formatAirportLabel("To"), arrivalAirport) : T(formatAirportLabel("From"), departureAirport);
176
+ const prepareAirportLabel = (flightType, departureAirport, arrivalAirport, T) => flightType === FlightType.DEPARTURE ? T(formatAirportLabel("To"), arrivalAirport ?? {}) : T(formatAirportLabel("From"), departureAirport ?? {});
174
177
  const formatAirportLabel = (prefix) => `flightDetails:${prefix} _city_ (_iata_)`;
175
- const prepareBaggageClaim = (claimNum, T) => claimNum && T("flightDetails:Collect luggage from Baggage Claim _claimNum_", {
176
- claimNum
177
- });
178
- const getLocalGMTDate = (date, tz) => date && luxon.DateTime.fromISO(date, { zone: tz });
179
- const getLocalFormattedDate = (dateStr, tz, locale = "en-US") => dateStr && luxon.DateTime.fromISO(dateStr, { zone: tz }).setLocale(locale).toFormat("EEE, d MMMM");
180
- const getLocalFormattedTime = (dateStr, tz, locale = "en-US") => dateStr && date.formatTime(luxon.DateTime.fromISO(dateStr, { zone: tz }), locale);
178
+ const prepareBaggageClaim = (claimNum, T) => claimNum ? T("flightDetails:Collect luggage from Baggage Claim _claimNum_", { claimNum }) : null;
179
+ const getLocalGMTDate = (date, tz) => date ? luxon.DateTime.fromISO(date, { zone: tz }) : null;
180
+ const getLocalFormattedDate = (dateStr, tz, locale = "en-US") => dateStr ? luxon.DateTime.fromISO(dateStr, { zone: tz }).setLocale(locale).toFormat("EEE, d MMMM") : null;
181
+ const getLocalFormattedTime = (dateStr, tz, locale = "en-US") => dateStr ? date.formatTime(luxon.DateTime.fromISO(dateStr, { zone: tz }), locale) : null;
181
182
 
182
183
  exports.FlightType = FlightType;
183
184
  exports.flightComparator = flightComparator;
@@ -29,29 +29,28 @@ function create(app, config) {
29
29
  const createIndex = () => new FlexSearch.Index({
30
30
  tokenize: "forward"
31
31
  });
32
- const init = async () => {
33
- state.tz = await app.bus.get("venueData/getVenueTimezone");
34
- };
35
32
  const state = {
36
33
  lastUpdated: 0,
37
- flights: { dep: null, arr: null },
34
+ flights: { dep: {}, arr: {} },
38
35
  index: { dep: createIndex(), arr: createIndex() },
39
36
  gates: null,
40
37
  apiError: false
41
38
  };
39
+ const init = async () => {
40
+ state.tz = await app.bus.get("venueData/getVenueTimezone");
41
+ };
42
42
  const enrichData = (flights, airportsArg, airlinesArg, flightType) => {
43
- const airports = airportsArg.reduce((acc, obj) => {
44
- return { ...acc, [obj.iata]: obj };
45
- }, {});
43
+ const airports = airportsArg.reduce(
44
+ (acc, airport) => ({ ...acc, [airport.iata]: airport }),
45
+ {}
46
+ );
46
47
  const airlines = airlinesArg.flatMap((airline) => [
47
48
  { code: airline.iata, airline },
48
49
  { code: airline.icao, airline }
49
- ]).filter(({ code }) => code).reduce((acc, { code, airline }) => {
50
- return { ...acc, [code]: airline };
51
- }, {});
50
+ ]).filter((entry) => Boolean(entry.code)).reduce((acc, { code, airline }) => ({ ...acc, [code]: airline }), {});
52
51
  return flights.map((flight) => {
53
52
  const gateId = flightType === flightDetailsMapper.FlightType.DEPARTURE ? R__namespace.pathOr("", ["airportResources", "departureGate"], flight) : R__namespace.pathOr("", ["airportResources", "arrivalGate"], flight);
54
- const gatePoi = state.gates[gateId];
53
+ const gatePoi = state.gates?.[String(gateId)];
55
54
  return {
56
55
  ...flight,
57
56
  flightType,
@@ -79,28 +78,15 @@ function create(app, config) {
79
78
  ["departureAirport", "iata"],
80
79
  ["departureAirport", "city"]
81
80
  ];
82
- const createFlightSearchEntry = R__namespace.pipe(
83
- // apply each function one after another to passed object
84
- R__namespace.juxt(R__namespace.map(R__namespace.path, searchPropertiesPaths)),
85
- // safe collect of nested properties into list
86
- R__namespace.filter(R__namespace.identity),
87
- // filter 'falsy' values
88
- R__namespace.join(" ")
89
- );
81
+ const createFlightSearchEntry = (flight) => searchPropertiesPaths.map((searchPath) => R__namespace.path(searchPath, flight)).filter((value) => typeof value === "string" && value.length > 0).join(" ");
90
82
  const indexGatePois = async () => {
91
83
  if (state.gates === null) {
92
84
  const gatePois = await app.bus.get("poi/getByCategoryId", {
93
85
  categoryId: "gate"
94
86
  });
95
87
  const parseGate = ({ name }) => R__namespace.tail(name.replace(",", "").split(" "));
96
- const pairs = R__namespace.reduce(
97
- (acc, poi) => {
98
- const gateIds = parseGate(poi);
99
- const gateAndPoiPairs = R__namespace.map((gateId) => [gateId, poi], gateIds);
100
- return [...acc, ...gateAndPoiPairs];
101
- },
102
- [],
103
- Object.values(gatePois)
88
+ const pairs = Object.values(gatePois).flatMap(
89
+ (poi) => parseGate(poi).map((gateId) => [gateId, poi])
104
90
  );
105
91
  state.gates = R__namespace.fromPairs(pairs);
106
92
  }
@@ -116,10 +102,8 @@ function create(app, config) {
116
102
  }
117
103
  if (config?.timeRange) {
118
104
  const now = Date.now();
119
- const startDate = new Date(now - config.timeRange.beforeNowMs).toISOString();
120
- const endDate = new Date(now + config.timeRange.afterNowMs).toISOString();
121
- params.append("startDate", startDate);
122
- params.append("endDate", endDate);
105
+ params.append("startDate", new Date(now - config.timeRange.beforeNowMs).toISOString());
106
+ params.append("endDate", new Date(now + config.timeRange.afterNowMs).toISOString());
123
107
  }
124
108
  const baseURL = `https://marketplace.locuslabs.com/venueId/${venueData.baseVenueId}/flight-status`;
125
109
  const apiURL = params.toString() ? `${baseURL}?${params.toString()}` : baseURL;
@@ -135,9 +119,7 @@ function create(app, config) {
135
119
  } catch (error) {
136
120
  state.apiError = true;
137
121
  console.error("Error from flight status api call", error);
138
- [flightDetailsMapper.FlightType.ARRIVAL, flightDetailsMapper.FlightType.DEPARTURE].forEach((type) => {
139
- updateIndexes(type, []);
140
- });
122
+ [flightDetailsMapper.FlightType.ARRIVAL, flightDetailsMapper.FlightType.DEPARTURE].forEach((type) => updateIndexes(type, []));
141
123
  } finally {
142
124
  state.lastUpdated = Date.now();
143
125
  }
@@ -154,15 +136,16 @@ function create(app, config) {
154
136
  });
155
137
  app.bus.on("flightStatus/getFlight", async ({ flightId }) => {
156
138
  await checkFlights();
157
- const flight = state.flights.dep[flightId] || state.flights.arr[flightId];
158
- return flight;
159
- });
160
- app.bus.on("flightStatus/mapFlightDetails", async ({ flight }) => {
161
- return flightDetailsMapper.mapFlightDetails(luxon.DateTime.local(), flight, app.gt(), state.tz, app.i18n().language);
162
- });
163
- app.bus.on("flightStatus/mapFlightListItems", async ({ flights }) => {
164
- return flights.map((flight) => flightDetailsMapper.mapFlightListItem(luxon.DateTime.local(), flight, app.gt(), state.tz, app.i18n().language)).sort(flightDetailsMapper.flightComparator);
139
+ return state.flights.dep[flightId] || state.flights.arr[flightId];
165
140
  });
141
+ app.bus.on(
142
+ "flightStatus/mapFlightDetails",
143
+ async ({ flight }) => flightDetailsMapper.mapFlightDetails(luxon.DateTime.local(), flight, app.gt(), state.tz, app.i18n?.().language ?? "en-US")
144
+ );
145
+ app.bus.on(
146
+ "flightStatus/mapFlightListItems",
147
+ async ({ flights }) => flights.map((flight) => flightDetailsMapper.mapFlightListItem(luxon.DateTime.local(), flight, app.gt(), state.tz, app.i18n?.().language ?? "en-US")).sort(flightDetailsMapper.flightComparator)
148
+ );
166
149
  return {
167
150
  init,
168
151
  internal: {
@@ -7,16 +7,15 @@ const searchFlights = (term, type, state) => {
7
7
  const types = type === flightDetailsMapper.FlightType.ALL ? [flightDetailsMapper.FlightType.DEPARTURE, flightDetailsMapper.FlightType.ARRIVAL] : [type];
8
8
  let flightResults;
9
9
  if (term) {
10
- flightResults = types.flatMap((t) => {
11
- const ids = index[t].search({ query: term });
12
- return ids.map((id) => flights[t][id]);
10
+ flightResults = types.flatMap((currentType) => {
11
+ const ids = index[currentType].search({ query: term });
12
+ return ids.map((id) => flights[currentType][String(id)]).filter((flight) => Boolean(flight));
13
13
  });
14
14
  } else {
15
- flightResults = types.flatMap((t) => Object.values(flights[t]));
15
+ flightResults = types.flatMap((currentType) => Object.values(flights[currentType]));
16
16
  }
17
- if (flightResults.length === 0 && /^\w\w\d{2,4}$/.test(term)) {
18
- const modifiedTerm = term.replace(/(\w\w)(\d{2,4})/, "$1_$2");
19
- return searchFlights(modifiedTerm, type, state);
17
+ if (flightResults.length === 0 && term && /^\w\w\d{2,4}$/.test(term)) {
18
+ return searchFlights(term.replace(/(\w\w)(\d{2,4})/, "$1_$2"), type, state);
20
19
  }
21
20
  return { flights: flightResults, apiError };
22
21
  };
@@ -4,6 +4,38 @@ var funcs = require('../../../src/utils/funcs.js');
4
4
  var postprocMolUrlParms = require('../../../src/configs/postproc-mol-url-parms.js');
5
5
  var postprocStateTracking = require('../../../src/configs/postproc-stateTracking.js');
6
6
 
7
+ const trunc = (value, len) => {
8
+ if (value === void 0) {
9
+ return void 0;
10
+ }
11
+ const stringValue = value.toString();
12
+ return stringValue.length > len ? stringValue.substring(0, len) : stringValue;
13
+ };
14
+ const setIfDef = (name, value) => value !== void 0 ? { [name]: value } : {};
15
+ const validateHostAppProperties = (hostAppProperties) => {
16
+ if (!hostAppProperties || typeof hostAppProperties !== "object") {
17
+ return void 0;
18
+ }
19
+ const ret = {};
20
+ const keys = Object.keys(hostAppProperties).slice(0, 10);
21
+ keys.forEach((key) => {
22
+ let cleanKey = trunc(key.toString().replaceAll(/[^a-zA-Z0-9_]/g, ""), 128) ?? "X";
23
+ if (!cleanKey.match(/^[a-zA-Z]+/)) {
24
+ cleanKey = `X${cleanKey}`;
25
+ }
26
+ let cleanVal = hostAppProperties[key];
27
+ if (cleanVal === null || cleanVal === void 0) {
28
+ cleanVal = "";
29
+ }
30
+ ret[cleanKey] = trunc(String(cleanVal), 128) ?? "";
31
+ });
32
+ return ret;
33
+ };
34
+ function handleI18NParm(sdkConfig, prefix, configDest) {
35
+ Object.keys(sdkConfig).filter((key) => key.startsWith(`${prefix}-`)).forEach((key) => {
36
+ configDest[key] = sdkConfig[key];
37
+ });
38
+ }
7
39
  function prepareSDKConfig(sc) {
8
40
  const {
9
41
  name,
@@ -45,32 +77,6 @@ function prepareSDKConfig(sc) {
45
77
  pinnedLocationPitch
46
78
  } = sc;
47
79
  const extendsConfig = parentConfig ? [parentConfig] : headless ? ["sdkHeadless"] : ["sdkVisual"];
48
- const trunc = (str, len) => str && str.length > len ? str.substring(0, len) : str;
49
- const validateHostAppId = (hostAppId2) => hostAppId2 ? trunc(hostAppId2.toString(), 128) : void 0;
50
- const validateHostAppVersion = (hostAppVersion2) => hostAppVersion2 ? trunc(hostAppVersion2.toString(), 128) : void 0;
51
- const validateHostAppProperties = (hostAppProperties2) => {
52
- if (!hostAppProperties2 || typeof hostAppProperties2 !== "object") {
53
- return void 0;
54
- }
55
- const ret = {};
56
- const keys = Object.keys(hostAppProperties2);
57
- if (keys.length > 10) {
58
- keys.length = 10;
59
- }
60
- keys.forEach((key) => {
61
- let cleanKey = trunc(key.toString().replaceAll(/[^a-zA-Z0-9_]/g, ""), 128);
62
- if (!cleanKey.match(/^[a-zA-Z]+/)) {
63
- cleanKey = "X" + cleanKey;
64
- }
65
- let cleanVal = hostAppProperties2[key];
66
- if (cleanVal === null || cleanVal === void 0) {
67
- cleanVal = "";
68
- }
69
- cleanVal = trunc(cleanVal.toString(), 128);
70
- ret[cleanKey] = cleanVal;
71
- });
72
- return ret;
73
- };
74
80
  const config = {
75
81
  name,
76
82
  engineName,
@@ -91,18 +97,16 @@ function prepareSDKConfig(sc) {
91
97
  headless
92
98
  },
93
99
  analytics2: {
94
- hostAppId: validateHostAppId(hostAppId),
95
- hostAppVersion: validateHostAppVersion(hostAppVersion),
100
+ hostAppId: hostAppId ? trunc(hostAppId, 128) : void 0,
101
+ hostAppVersion: hostAppVersion ? trunc(hostAppVersion, 128) : void 0,
96
102
  hostAppProperties: validateHostAppProperties(hostAppProperties)
97
103
  }
98
104
  },
99
- uuid: typeof document !== "undefined" && document && document.location ? document.location.host : "unknown"
100
- // used in analytics
105
+ uuid: typeof document !== "undefined" && document.location ? document.location.host : "unknown"
101
106
  };
102
107
  if (analytics2ActiveFlag !== void 0) {
103
- config.plugins.analytics2.active = analytics2ActiveFlag;
108
+ config.plugins.analytics2 = { ...config.plugins.analytics2, active: analytics2ActiveFlag };
104
109
  }
105
- const setIfDef = (name2, value) => value !== void 0 ? { [name2]: value } : {};
106
110
  if (!headless) {
107
111
  config.plugins["online/headerOnline"] = { searchPlaceholder };
108
112
  config.plugins.mapRenderer = {
@@ -127,29 +131,26 @@ function prepareSDKConfig(sc) {
127
131
  config.plugins.searchService = defaultSearchTerms ? { defaultSearchTerms } : {};
128
132
  handleI18NParm(sc, "defaultSearchTerms", config.plugins.searchService);
129
133
  if (extendsConfig.includes("sdkVisual")) {
130
- if (poiCategories) {
131
- config.plugins["online/homeView"] = { poiCategories };
132
- } else {
133
- config.plugins["online/homeView"] = {};
134
- }
134
+ config.plugins["online/homeView"] = poiCategories ? { poiCategories } : {};
135
135
  handleI18NParm(sc, "poiCategories", config.plugins["online/homeView"]);
136
136
  }
137
- if (plugins) {
138
- if (plugins.draw) {
139
- config.plugins.draw = plugins.draw;
137
+ if (plugins && typeof plugins === "object") {
138
+ const pluginMap = plugins;
139
+ if (pluginMap.draw) {
140
+ config.plugins.draw = pluginMap.draw;
140
141
  }
141
- if (plugins.flightStatus) {
142
- config.plugins.flightStatus = plugins.flightStatus;
142
+ if (pluginMap.flightStatus) {
143
+ config.plugins.flightStatus = pluginMap.flightStatus;
143
144
  config.plugins["online/flightDetails"] = {};
144
145
  config.plugins["online/flightDetailsSearch"] = {};
145
146
  }
146
147
  }
147
148
  if (preserveStateInURL) {
148
- config.configPostProc.push("stateTracking");
149
+ (config.configPostProc ?? []).push("stateTracking");
149
150
  config.plugins.deepLinking = { trackURL: true };
150
151
  }
151
152
  if (supportURLDeepLinks) {
152
- config.configPostProc.push("mol-url-parms");
153
+ (config.configPostProc ?? []).push("mol-url-parms");
153
154
  }
154
155
  if (initState) {
155
156
  postprocStateTracking.setStateFromStateString(config, funcs.b64DecodeUnicode(initState), true);
@@ -164,14 +165,9 @@ function prepareSDKConfig(sc) {
164
165
  config.desktopViewMinWidth = 0;
165
166
  }
166
167
  if (dynamicPoisUrlBaseV1) {
167
- config.plugins.dynamicPois = {
168
- urlBaseV1: dynamicPoisUrlBaseV1
169
- };
168
+ config.plugins.dynamicPois = { urlBaseV1: dynamicPoisUrlBaseV1 };
170
169
  }
171
- return funcs.filterOb((k, v) => v !== void 0, config);
172
- }
173
- function handleI18NParm(sdkConfig, prefix, configDest) {
174
- Object.keys(sdkConfig).filter((key) => key.startsWith(prefix + "-")).forEach((key) => configDest[key] = sdkConfig[key]);
170
+ return funcs.filterOb((_, value) => value !== void 0, config);
175
171
  }
176
172
 
177
173
  module.exports = prepareSDKConfig;
@@ -30,12 +30,7 @@ const headlessCommands = [
30
30
  { name: "from", type: "location" },
31
31
  { name: "to", type: "location" },
32
32
  { name: "accessible", type: "boolean", optional: true },
33
- {
34
- name: "queueTypes",
35
- type: "list",
36
- itemType: { type: "string" },
37
- optional: true
38
- }
33
+ { name: "queueTypes", type: "list", itemType: { type: "string" }, optional: true }
39
34
  ]
40
35
  },
41
36
  {
@@ -43,25 +38,14 @@ const headlessCommands = [
43
38
  args: [
44
39
  { name: "locations", type: "list", itemType: { type: "location" } },
45
40
  { name: "accessible", type: "boolean", optional: true },
46
- {
47
- name: "queueTypes",
48
- type: "list",
49
- itemType: { type: "string" },
50
- optional: true
51
- }
41
+ { name: "queueTypes", type: "list", itemType: { type: "string" }, optional: true }
52
42
  ]
53
43
  },
54
- {
55
- command: "getPOIDetails",
56
- args: [{ name: "poiId", type: "integer", min: 0 }]
57
- },
44
+ { command: "getPOIDetails", args: [{ name: "poiId", type: "integer", min: 0 }] },
58
45
  { command: "getAllPOIs" },
59
46
  { command: "getStructures" },
60
47
  { command: "getVenueData" },
61
- {
62
- command: "getSecurityWaitTimes",
63
- args: [{ name: "isOpen", type: "boolean", optional: true }]
64
- },
48
+ { command: "getSecurityWaitTimes", args: [{ name: "isOpen", type: "boolean", optional: true }] },
65
49
  {
66
50
  command: "search",
67
51
  args: [
@@ -78,7 +62,17 @@ const headlessCommands = [
78
62
  }
79
63
  ];
80
64
  function handleHeadless(app) {
81
- app.bus.on("clientAPI/destroy", async () => app.destroy());
65
+ const pickRouteSummary = (route) => {
66
+ const routeRecord = route;
67
+ return {
68
+ distance: routeRecord.distance,
69
+ time: routeRecord.time,
70
+ steps: routeRecord.steps,
71
+ navline: routeRecord.navline,
72
+ waypoints: routeRecord.waypoints
73
+ };
74
+ };
75
+ app.bus.on("clientAPI/destroy", async () => app.destroy?.());
82
76
  app.bus.on("clientAPI/getDirections", async ({ from, to, accessible, queueTypes }) => {
83
77
  const fromEndpoint = await location.locationToEndpoint(app, from);
84
78
  const toEndpoint = await location.locationToEndpoint(app, to);
@@ -86,43 +80,49 @@ function handleHeadless(app) {
86
80
  if (queueTypes) {
87
81
  options.selectedSecurityLanes = { SecurityLane: queueTypes };
88
82
  }
89
- return app.bus.get("wayfinder/getRoute", { fromEndpoint, toEndpoint, options }).then(R__namespace.pick(["distance", "time", "steps", "navline", "waypoints"]));
83
+ const route = await app.bus.get("wayfinder/getRoute", { fromEndpoint, toEndpoint, options });
84
+ return pickRouteSummary(route);
90
85
  });
91
- app.bus.on("clientAPI/getDirectionsMultiple", async ({ locations, accessible, queueTypes }) => {
92
- const endpoints = await Promise.all(locations.map(async (l) => location.locationToEndpoint(app, l)));
93
- const options = { requiresAccessibility: !!accessible };
94
- if (queueTypes) {
95
- options.selectedSecurityLanes = { SecurityLane: queueTypes };
86
+ app.bus.on(
87
+ "clientAPI/getDirectionsMultiple",
88
+ async ({ locations, accessible, queueTypes }) => {
89
+ const endpoints = await Promise.all(locations.map(async (location$1) => location.locationToEndpoint(app, location$1)));
90
+ const options = { requiresAccessibility: !!accessible };
91
+ if (queueTypes) {
92
+ options.selectedSecurityLanes = { SecurityLane: queueTypes };
93
+ }
94
+ const routes = await Promise.all(
95
+ R__namespace.aperture(2, endpoints).map(
96
+ async (pair) => app.bus.get("wayfinder/getRoute", {
97
+ fromEndpoint: pair[0],
98
+ toEndpoint: pair[1],
99
+ options
100
+ })
101
+ )
102
+ );
103
+ const directions = routes.map(pickRouteSummary);
104
+ return {
105
+ total: {
106
+ distance: R__namespace.sum(directions.map((direction) => Number(direction.distance ?? 0))),
107
+ time: R__namespace.sum(directions.map((direction) => Number(direction.time ?? 0)))
108
+ },
109
+ directions
110
+ };
96
111
  }
97
- const routes = await Promise.all(
98
- R__namespace.aperture(2, endpoints).map(
99
- async (a) => app.bus.get("wayfinder/getRoute", {
100
- fromEndpoint: a[0],
101
- toEndpoint: a[1],
102
- options
103
- })
104
- )
105
- );
106
- const directions = R__namespace.map(R__namespace.pick(["distance", "time", "steps", "navline", "waypoints"]), routes);
107
- return {
108
- total: {
109
- distance: R__namespace.sum(R__namespace.map((d) => d.distance, directions)),
110
- time: R__namespace.sum(R__namespace.map((d) => d.time, directions))
111
- },
112
- directions
113
- };
114
- });
115
- app.bus.on("clientAPI/getPOIDetails", async ({ poiId }) => app.bus.get("poi/getById", { id: poiId }));
112
+ );
113
+ app.bus.on(
114
+ "clientAPI/getPOIDetails",
115
+ async ({ poiId }) => app.bus.get("poi/getById", { id: poiId })
116
+ );
116
117
  app.bus.on("clientAPI/getAllPOIs", async () => app.bus.get("poi/getAll"));
117
118
  app.bus.on("clientAPI/getStructures", () => location.getStructures(app));
118
119
  app.bus.on(
119
120
  "clientAPI/getSecurityWaitTimes",
120
121
  async ({ isOpen }) => app.bus.get("dynamicPois/getSecurityWaitTimes", { isOpen })
121
122
  );
122
- const isNotFunction = (o) => typeof o !== "function";
123
123
  app.bus.on("clientAPI/getVenueData", async () => {
124
- const vd = await app.bus.get("venueData/getVenueData");
125
- return R__namespace.filter(isNotFunction, vd);
124
+ const venueData = await app.bus.get("venueData/getVenueData");
125
+ return Object.fromEntries(Object.entries(venueData).filter(([, value]) => typeof value !== "function"));
126
126
  });
127
127
  app.bus.on(
128
128
  "clientAPI/search",