atriusmaps-node-sdk 3.3.917 → 3.3.919

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.
@@ -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",
@@ -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;
@@ -25,7 +25,11 @@ async function setupPlugin(app, id, config) {
25
25
  return null;
26
26
  }
27
27
  }
28
- return import(`../plugins/${id}/src/index.js`).then((pluginModule) => {
28
+ const load = id.includes("/") ? (() => {
29
+ const [scope, shortName] = id.split("/");
30
+ return import(`../plugins/${scope}/${shortName}/src/index.js`);
31
+ })() : import(`../plugins/${id}/src/index.js`);
32
+ return load.then((pluginModule) => {
29
33
  app.log.info(`Creating plugin ${id}`);
30
34
  return pluginModule.create(app, config);
31
35
  });
@@ -86,8 +90,12 @@ async function create(rawConfig) {
86
90
  const appInstance = /* @__PURE__ */ Object.create(null);
87
91
  let config = rawConfig.extends ? await extendConfig(rawConfig, rawConfig.extends) : rawConfig;
88
92
  if (config.plugins?.monitoring) {
89
- const monConfig = config.plugins.monitoring;
90
- await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }).then((mon) => mon.activate(monConfig));
93
+ try {
94
+ const mon = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); });
95
+ await mon.activate(config.plugins.monitoring);
96
+ } catch (err) {
97
+ console.warn("Monitoring plugin failed to load (continuing without it):", err?.message || err);
98
+ }
91
99
  }
92
100
  config = await handleConfigPostProcess(config);
93
101
  const lang = getLang(config);
@@ -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) {