atriusmaps-node-sdk 3.3.944 → 3.3.946
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/package.json.js +1 -1
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +4 -14
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +0 -28
- package/dist/cjs/src/app.js +6 -0
- package/dist/package.json.js +1 -1
- package/dist/plugins/dynamicPois/src/dynamicPois.js +1 -1
- package/dist/plugins/sdkServer/src/sdkServer.js +1 -1
- package/dist/src/app.js +1 -1
- package/package.json +1 -1
package/dist/cjs/package.json.js
CHANGED
|
@@ -92,7 +92,7 @@ function create(app, config = {}) {
|
|
|
92
92
|
}
|
|
93
93
|
if (Object.keys(updates).length > 0) {
|
|
94
94
|
app.bus.send("poi/setCoreAttributes", updates);
|
|
95
|
-
const originalNames = await
|
|
95
|
+
const originalNames = await getPoiNameMap(Object.keys(updates), (poi) => poi.staticName ?? poi.name);
|
|
96
96
|
app.bus.send("map/mutateFeature", {
|
|
97
97
|
functor: processors.mutatePoiName(T, updates, originalNames)
|
|
98
98
|
});
|
|
@@ -102,22 +102,12 @@ function create(app, config = {}) {
|
|
|
102
102
|
const idValuesMap = processors.processParkingPOIS(poiMap);
|
|
103
103
|
app.bus.send("poi/setDynamicData", { plugin: "parking", idValuesMap });
|
|
104
104
|
}
|
|
105
|
-
const
|
|
105
|
+
const getPoiNameMap = async (idArray, selector = (poi) => poi.name) => {
|
|
106
106
|
const nameMap = {};
|
|
107
107
|
for (const poiId of idArray) {
|
|
108
108
|
const poi = await app.bus.get("poi/getById", { id: poiId });
|
|
109
109
|
if (poi) {
|
|
110
|
-
nameMap[poiId] = poi
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return nameMap;
|
|
114
|
-
};
|
|
115
|
-
const getPoiOriginalNames = async (idArray) => {
|
|
116
|
-
const nameMap = {};
|
|
117
|
-
for (const poiId of idArray) {
|
|
118
|
-
const poi = await app.bus.get("poi/getById", { id: poiId });
|
|
119
|
-
if (poi) {
|
|
120
|
-
nameMap[poiId] = poi.staticName ?? poi.name;
|
|
110
|
+
nameMap[poiId] = selector(poi);
|
|
121
111
|
}
|
|
122
112
|
}
|
|
123
113
|
return nameMap;
|
|
@@ -125,7 +115,7 @@ function create(app, config = {}) {
|
|
|
125
115
|
async function processSecurityWaitTimes(poiMap) {
|
|
126
116
|
const idValuesMap = processors.processSecurityWaitTimes(poiMap);
|
|
127
117
|
app.bus.send("poi/setDynamicData", { plugin: "security", idValuesMap });
|
|
128
|
-
const labels = await
|
|
118
|
+
const labels = await getPoiNameMap(Object.keys(idValuesMap));
|
|
129
119
|
app.bus.send("map/mutateFeature", {
|
|
130
120
|
functor: processors.mutateSecurityCheckpointLabel(T, idValuesMap, labels)
|
|
131
121
|
});
|
|
@@ -8,26 +8,6 @@ var sdkHeadless = require('./sdkHeadless.js');
|
|
|
8
8
|
function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: null, default: e }); }
|
|
9
9
|
|
|
10
10
|
let removePreviousListener = null;
|
|
11
|
-
function describeMessageRelation(senderOrigin, iframeOrigin) {
|
|
12
|
-
if (senderOrigin === "null") {
|
|
13
|
-
return "null-origin";
|
|
14
|
-
}
|
|
15
|
-
return senderOrigin === iframeOrigin ? "same-origin" : "cross-origin";
|
|
16
|
-
}
|
|
17
|
-
function logBrowserMessageTelemetry(bus, payload) {
|
|
18
|
-
bus.send("appInsights/log", {
|
|
19
|
-
name: "sdkServer/browserMessageObserved",
|
|
20
|
-
properties: {
|
|
21
|
-
command: payload.command,
|
|
22
|
-
deploymentHost: window.location.host,
|
|
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
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
11
|
function isSameOriginBrowserMessage(senderOrigin, iframeOrigin) {
|
|
32
12
|
return senderOrigin === iframeOrigin;
|
|
33
13
|
}
|
|
@@ -53,12 +33,6 @@ function getBrowserCom(app) {
|
|
|
53
33
|
return;
|
|
54
34
|
}
|
|
55
35
|
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
36
|
if (!isSameOriginBrowserMessage(event.origin, iframeOrigin)) {
|
|
63
37
|
return;
|
|
64
38
|
}
|
|
@@ -220,6 +194,4 @@ async function create(app, config) {
|
|
|
220
194
|
}
|
|
221
195
|
|
|
222
196
|
exports.create = create;
|
|
223
|
-
exports.describeMessageRelation = describeMessageRelation;
|
|
224
197
|
exports.isSameOriginBrowserMessage = isSameOriginBrowserMessage;
|
|
225
|
-
exports.logBrowserMessageTelemetry = logBrowserMessageTelemetry;
|
package/dist/cjs/src/app.js
CHANGED
|
@@ -171,6 +171,12 @@ async function create(rawConfig) {
|
|
|
171
171
|
appInstance.plugins[id].init();
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
+
if (typeof window !== "undefined") {
|
|
175
|
+
appInstance.bus.send("appInsights/log", {
|
|
176
|
+
name: "app/loaded",
|
|
177
|
+
properties: { deploymentHost: window.location.host }
|
|
178
|
+
});
|
|
179
|
+
}
|
|
174
180
|
return appInstance;
|
|
175
181
|
}
|
|
176
182
|
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a="3.3.
|
|
1
|
+
var a="3.3.946",e={version:a};export{e as default,a as version};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"zousan";import{processParkingPOIS as e,processOpenClosedPois as n,processSecurityWaitTimes as a,mutateSecurityCheckpointLabel as s,processRoutingPois as o,mutatePoiName as i}from"./processors.js";let c=3e4;const r="x-account-id";function u(u,y={}){const l={dynamicDataNotPending:new t},d=u.gt();y._overrideRefreshFrequency&&(c=y._overrideRefreshFrequency);const m=new Map;u.bus.on("system/readywhenyouare",()=>l.dynamicDataNotPending),u.bus.on("dynamicPois/getSecurityWaitTimes",async({isOpen:t}={})=>{const e=await u.bus.get("poi/getAll");return Object.values(e).filter(e=>{return"security.checkpoint"===e.category&&e?.dynamicData?.security&&(n=e?.dynamicData?.security,"object"==typeof n&&null!==n&&!Array.isArray(n))&&(void 0===t||e?.dynamicData?.security?.isTemporarilyClosed!==t);var n}).map(t=>({id:t.poiId,name:t.name,...t.dynamicData.security}))});const p=async
|
|
1
|
+
import t from"zousan";import{processParkingPOIS as e,processOpenClosedPois as n,processSecurityWaitTimes as a,mutateSecurityCheckpointLabel as s,processRoutingPois as o,mutatePoiName as i}from"./processors.js";let c=3e4;const r="x-account-id";function u(u,y={}){const l={dynamicDataNotPending:new t},d=u.gt();y._overrideRefreshFrequency&&(c=y._overrideRefreshFrequency);const m=new Map;u.bus.on("system/readywhenyouare",()=>l.dynamicDataNotPending),u.bus.on("dynamicPois/getSecurityWaitTimes",async({isOpen:t}={})=>{const e=await u.bus.get("poi/getAll");return Object.values(e).filter(e=>{return"security.checkpoint"===e.category&&e?.dynamicData?.security&&(n=e?.dynamicData?.security,"object"==typeof n&&null!==n&&!Array.isArray(n))&&(void 0===t||e?.dynamicData?.security?.isTemporarilyClosed!==t);var n}).map(t=>({id:t.poiId,name:t.name,...t.dynamicData.security}))});const p=async(t,e=t=>t.name)=>{const n={};for(const a of t){const t=await u.bus.get("poi/getById",{id:a});t&&(n[a]=e(t))}return n};return{init:async()=>{const[t,y]=await Promise.all([u.bus.get("venueData/getAccountId"),u.bus.get("venueData/getVenueId")]),f=`https://marketplace.locuslabs.com/venueId/${y}/dynamic-poi`;let g,b=0,D=0;const h=async()=>{const c=await fetch(f,{headers:{[r]:t}});if(c.ok)return c.json().then(({data:t})=>async function(t){(function(t){const n=e(t);u.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:n})})(t),function(t){const e=n(t);u.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:e})}(t),async function(t){const e=a(t);u.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:e});const n=await p(Object.keys(e));u.bus.send("map/mutateFeature",{functor:s(d,e,n)})}(t),async function(t){const e=await o(t);u.bus.send("poi/setDynamicRouting",{plugin:"routing",idValuesMap:e})}(t),async function(t){const e={};for(const[n,a]of Object.entries(t)){const t=a?.dynamicData?.poiAttributes?.name??null,s=m.get(n);void 0===s?null!==t&&(e[n]={name:t},m.set(n,t)):s!==t&&(e[n]={name:t},m.set(n,t))}for(const[n,a]of m.entries())n in t||null===a||(e[n]={name:null},m.set(n,null));if(Object.keys(e).length>0){u.bus.send("poi/setCoreAttributes",e);const t=await p(Object.keys(e),t=>t.staticName??t.name);u.bus.send("map/mutateFeature",{functor:i(d,e,t)})}}(t)}(t)).then(()=>{D++}).catch(console.error);console.warn("dynamicPois: fetch response status not ok",c),b++,b>=3&&b>D&&clearInterval(g)};return await h().then(()=>{g=setInterval(h,c),"function"==typeof g.unref&&g.unref()}).finally(()=>l.dynamicDataNotPending.resolve(!0)),()=>clearInterval(g)}}}export{u as create};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{throttle as e}from"throttle-debounce";import{getStructureAndFloorAtPoint as o}from"../../../src/utils/geom.js";import
|
|
1
|
+
import{throttle as e}from"throttle-debounce";import{getStructureAndFloorAtPoint as o}from"../../../src/utils/geom.js";import t from"../../../src/utils/observable.js";import{headlessCommands as n,handleHeadless as a}from"./sdkHeadless.js";let s=null;function r(e,o){return e===o}function i(e){const o=(e,o)=>{const t={payload:e,type:"LL-server",clientMsgId:o};try{window.postMessage(t,"*")}catch{window.postMessage((n=t,JSON.parse(JSON.stringify(n))),"*")}var n},t=t=>{const n=t.data;if(!n||"LL-client"!==n.type)return;const a=window.location.origin;r(t.origin,a)&&e.bus.get("clientAPI/execute",n.payload).then(e=>o(e,n.msgId)).catch(o=>{var t,a;e.config.debug&&console.error(o),t=o.message,a=n.msgId,window.postMessage({error:!0,payload:t,type:"LL-server",clientMsgId:a},"*")})};return s&&s(),window.addEventListener("message",t),s=()=>window.removeEventListener("message",t),(e,o)=>{window.postMessage({event:e,payload:o,type:"LL-server"},"*")}}async function l(s,r){const l=s.env.isBrowser?i(s):function(e){const o=t();return e.eventListener=o,(e,t)=>o.fire(e,t)}(s);return function(t,n){const a=async(e,o)=>{const{lat:a,lng:s,floorId:r,ordinal:i,structureId:l}=await t.bus.get("map/getMapCenter");n(e,{lat:a,lng:s,floorId:r,ord:i,structureId:l,...o})};t.bus.monitor("map/userMoveStart",e=>{a("userMoveStart",e)}),t.bus.monitor("map/userMoving",e(500,e=>{a("userMoving",e)})),t.bus.monitor("map/moveEnd",e=>{a("moveEnd",e)}),t.bus.monitor("map/floorChanged",({structure:e,floor:o})=>n("levelChange",{floorId:o?.id??null,floorName:o?.name??null,ord:o?.ordinal??null,structureId:e?.id??null,structureName:e?.name??null})),t.bus.monitor("map/poiClicked",({poi:e})=>n("poiSelected",e)),t.bus.monitor("poiDetails/showPoi",({poi:e})=>n("poiShown",e)),t.bus.monitor("map/click",async({lat:e,lng:a,ord:s})=>{const r=await t.bus.get("venueData/getStructures"),i=await t.bus.get("map/getViewBBox"),{building:l,floor:p}=o(r,e,a,s,i,!0);n("mapClicked",{lat:e,lng:a,ord:s,building:l,floor:p})})}(s,l),{init:async()=>{!function(e){[{name:"latLngOrdLocation",spec:{type:"object",props:[{name:"lat",type:"float"},{name:"lng",type:"float"},{name:"ord",type:"integer"}]}},{name:"latLngFloorLocation",spec:{type:"object",props:[{name:"lat",type:"float"},{name:"lng",type:"float"},{name:"floorId",type:"string"}]}},{name:"poiIdLocation",spec:{type:"object",props:[{name:"poiId",type:"integer",min:0}]}},{name:"location",spec:{type:"multi",types:[{type:"poiIdLocation"},{type:"latLngOrdLocation"},{type:"latLngFloorLocation"}]}},{name:"viewSettings",spec:{type:"object",props:[{name:"zoom",type:"float",optional:!0},{name:"pitch",type:"float",optional:!0},{name:"bearing",type:"float",optional:!0}]}}].forEach(o=>{e.bus.send("clientAPI/registerCustomType",o)})}(s),n.forEach(e=>s.bus.send("clientAPI/registerCommand",e)),a(s),r.headless||await import("../../../_virtual/_empty_module_placeholder.js").then(e=>{e.visualCommands.forEach(e=>s.bus.send("clientAPI/registerCommand",e)),e.handleVisual(s,l)});const e=async()=>{await s.bus.send("system/readywhenyouare"),s.bus.get("clientAPI/execute",{command:"getCommandJSON"}).then(e=>l("ready",{commandJSON:e})),!r.headless&&s.config.uiHide?.sidebar&&s.env.isDesktop()&&s.bus.send("map/changePadding",{padding:{left:55,right:55,top:72,bottom:22}})};r.headless?Promise.all([new Promise(e=>s.bus.monitor("venueData/navGraphLoaded",e)),new Promise(e=>s.bus.monitor("venueData/poiDataLoaded",e))]).then(e):s.bus.on("map/mapReadyToShow",e),s.bus.on("sdkServer/sendEvent",({eventName:e,...o})=>l(e,o))}}}export{l as create,r as isSameOriginBrowserMessage};
|
package/dist/src/app.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{map as e,mergeDeepRight as
|
|
1
|
+
import{map as e,mergeDeepRight as n}from"ramda";import t from"zousan-plus";import o from"./utils/i18n.js";import{startInitialStateListener as i}from"./utils/isInitialState.js";import{version as a}from"../package.json.js";import r from"./debugTools.js";import{buildEnv as s}from"./env.js";import{create as l}from"./extModules/bustle.js";import{initLog as u}from"./extModules/log.js";const c="undefined"!=typeof window;async function g(e,n,t){if(!t)return e.log.info(`Plugin ${n} explicitly disabled`),null;if(void 0!==t.active&&(!1===t.active||"notLocalhost"===t.active&&e.env.isLocalhost()))return e.log.info(`Plugin ${n} explicitly deativated`),null;return(n.includes("/")?(()=>{const[e,t]=n.split("/");return import(`../plugins/${e}/${t}/src/index.js`)})():import(`../plugins/${n}/src/index.js`)).then(o=>(e.log.info(`Creating plugin ${n}`),o.create(e,t)))}async function d(e){return c?import(`./configs/${e}.json`):import(`./configs/${e}.json.js`)}async function p(e,t){let o={};const i=await Promise.all(t.map(d));for(const e of i){let t=e.default;t=t.extends?await p(t,t.extends):t,o=n(o,t)}return o=n(o,e),o}const m=e=>n=>import(`./configs/postproc-${e}.ts`).then(e=>e.process(n));async function f(n){const d=Object.create(null);let f=n.extends?await p(n,n.extends):n;if(f.plugins?.monitoring){const e=f.plugins.monitoring;try{const n=await import("../_virtual/_empty_module_placeholder.js");await n.activate(e)}catch(e){const n=e instanceof Error?e.message:String(e);console.warn("Monitoring plugin failed to load (continuing without it):",n)}}f=await(async e=>e.configPostProc?t.series(e,...e.configPostProc.map(m)):e)(f);const w=(e=>{const n=e.supportedLanguages||["am","ar","de","el-GR","en","es","fr","hi","is","it","ja","ko","nl","pl","pt","ru","so","th","zh-Hans","zh-Hant"];if("undefined"!=typeof window){let e=new URLSearchParams(location.search).get("lang")||navigator.language;for(;e;){if(e&&n.includes(e))return e;e=e.substring(0,e.lastIndexOf("-"))}}return e.defaultLanguage||"en"})(f),h=await o(w,{debug:f.debug});d.i18n=()=>h,d.gt=()=>h.t.bind(h),d.config=f,d.plugins={};const y=u("web-engine",{enabled:!!f.debug,isBrowser:c,color:"cyan",logFilter:f.logFilter,truncateObjects:!c,trace:false});if(d.log=y.sublog(f.name),d.bus=l({showEvents:!0,reportAllErrors:!0,log:y}),d.info={wePkg:{version:a}},"undefined"!=typeof window&&(f.debug?(d.debug=e(e=>e.bind(d),r),r.dndGo.call(d)):d.debug={},window._app=d,window.document&&window.document.title&&f.setWindowTitle&&(document.title=f.name)),d.env=s(d),f.theme?await t.evaluate({name:"ThemeManagerModule",value:import("../_virtual/_empty_module_placeholder.js")},{name:"HistoryManager",value:import("./historyManager.js")},{name:"LayerManager",value:import("../_virtual/_empty_module_placeholder.js")}).then(async({LayerManager:e,HistoryManager:n,ThemeManagerModule:t})=>{const o=t.initThemeManager(d);d.themePack=await o.buildTheme(f.theme,f.defaultTheme),i(),e.initLayerManager(d),n.initHistoryManager(d),d.destroy=()=>e.destroy(d)}):d.destroy=()=>{},f.plugins){for(const e in f.plugins)try{const n=f.plugins[e];if(d.plugins[e])throw Error(`Duplicate plugin name "${e}"`);const t=await g(d,e,n);t&&(d.plugins[e]=t)}catch(n){y.error("Error instantiating plugin "+e),y.error(n)}for(const e in d.plugins)d.plugins[e].init()}return"undefined"!=typeof window&&d.bus.send("appInsights/log",{name:"app/loaded",properties:{deploymentHost:window.location.host}}),d}export{f as create};
|
package/package.json
CHANGED