atriusmaps-node-sdk 3.3.1045 → 3.3.1047
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/poiDataManager/src/computeIsOpenNow.js +12 -2
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/plugins/poiDataManager/src/computeIsOpenNow.js +1 -1
- package/dist/plugins/poiDataManager/src/poiDataManager.js +1 -1
- package/package.json +1 -1
package/dist/cjs/package.json.js
CHANGED
|
@@ -34,12 +34,22 @@ function computePoiOpenStatus(poi, venueTimezone, T, now = /* @__PURE__ */ new D
|
|
|
34
34
|
return void 0;
|
|
35
35
|
}
|
|
36
36
|
const status = resolveStatus(poi, venueTimezone, openNow, now);
|
|
37
|
-
const timeLabel = venueTimezone ? operationHours.getOpenTimeLabel(poi.operationHours, now, T, venueTimezone) || void 0 : void 0;
|
|
37
|
+
const timeLabel = venueTimezone && !isStatusOverridden(poi, now) ? operationHours.getOpenTimeLabel(poi.operationHours, now, T, venueTimezone) || void 0 : void 0;
|
|
38
38
|
return { isOpen: openNow, status, timeLabel };
|
|
39
39
|
}
|
|
40
|
+
function isStatusOverridden(poi, now) {
|
|
41
|
+
if (poi.state === "permanently-closed") {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
const dynamicStatus = poi.dynamicData?.["open-closed-status"];
|
|
45
|
+
if (!dynamicStatus) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return dynamicStatus.expiresAt === void 0 || dynamicStatus.expiresAt > now.getTime();
|
|
49
|
+
}
|
|
40
50
|
function resolveStatus(poi, venueTimezone, openNow, now) {
|
|
41
51
|
const plainStatus = openNow ? constants.PoiOpenStatus.OPEN : constants.PoiOpenStatus.CLOSED;
|
|
42
|
-
if (!venueTimezone || !operationHours.canParseOperationHours(poi.operationHours)) {
|
|
52
|
+
if (isStatusOverridden(poi, now) || !venueTimezone || !operationHours.canParseOperationHours(poi.operationHours)) {
|
|
43
53
|
return plainStatus;
|
|
44
54
|
}
|
|
45
55
|
const localizedNow = operationHours.toLocalDate(now, venueTimezone);
|
|
@@ -28,7 +28,7 @@ var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
|
28
28
|
|
|
29
29
|
async function create(app, config) {
|
|
30
30
|
const log = app.log.sublog("poiDataManager");
|
|
31
|
-
const isOpenStatusEnabled = config?.enableOpenStatus
|
|
31
|
+
const isOpenStatusEnabled = config?.enableOpenStatus === true;
|
|
32
32
|
const init = () => {
|
|
33
33
|
app.bus.send("venueData/loadPoiData");
|
|
34
34
|
};
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a="3.3.
|
|
1
|
+
var a="3.3.1047",e={version:a};export{e as default,a as version};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getOpenTimeLabel as t,canParseOperationHours as n,toLocalDate as
|
|
1
|
+
import{getOpenTimeLabel as t,canParseOperationHours as n,toLocalDate as e,parseAndOrderWeekdays as o,isOpen as r,getBoundaryMinutes as i}from"../../../src/utils/operationHours.js";import{PoiOpenStatus as s}from"../../../utils/constants.js";function u(t,i,s=new Date){if("permanently-closed"===t.state)return!1;const u=t.dynamicData?.["open-closed-status"];if(u){const t=u.expiresAt;if(void 0===t||t>s.getTime())return u.isOpen}if(!i)return;if(!n(t.operationHours))return;const a=e(s,i),c=o(t.operationHours,a);return c&&0!==c.length?r(c,a):void 0}function a(r,a,f,m=new Date){const O=u(r,a,m);if(void 0===O)return;const d=function(t,r,u,a){const f=u?s.OPEN:s.CLOSED;if(c(t,a)||!r||!n(t.operationHours))return f;const m=e(a,r),O=o(t.operationHours,m);if(!O||0===O.length)return f;const{minutesToOpen:d,minutesToClose:l}=i(O,m);if(u)return p(l)?s.CLOSING_SOON:s.OPEN;return p(d)?s.OPENING_SOON:s.CLOSED}(r,a,O,m);return{isOpen:O,status:d,timeLabel:a&&!c(r,m)&&t(r.operationHours,m,f,a)||void 0}}function c(t,n){if("permanently-closed"===t.state)return!0;const e=t.dynamicData?.["open-closed-status"];return!!e&&(void 0===e.expiresAt||e.expiresAt>n.getTime())}function p(t){return void 0!==t&&t>0&&t<=60}export{u as computeIsOpenNow,a as computePoiOpenStatus};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"ramda";import o from"zousan";import{buildStructuresLookup as t}from"../../../src/utils/buildStructureLookup.js";import{debugIsTrue as a}from"../../../src/utils/configUtils.js";import{toLang as i}from"../../../src/utils/i18n.js";import{computePoiOpenStatus as n}from"./computeIsOpenNow.js";async function r(i,r){const p=i.log.sublog("poiDataManager"),d=!
|
|
1
|
+
import*as e from"ramda";import o from"zousan";import{buildStructuresLookup as t}from"../../../src/utils/buildStructureLookup.js";import{debugIsTrue as a}from"../../../src/utils/configUtils.js";import{toLang as i}from"../../../src/utils/i18n.js";import{computePoiOpenStatus as n}from"./computeIsOpenNow.js";async function r(i,r){const p=i.log.sublog("poiDataManager"),d=!0===r?.enableOpenStatus,c=()=>{i.bus.send("venueData/loadPoiData")};let l=new o;const m=(e,o)=>{const{position:t}=e,a=o.floorIdToStructure(t.floorId);if(!a)return p.error(`No structure found for floorId: ${t.floorId} for POI ${e.poiId}`),{...e};const i=o.floorIdToFloor(t.floorId),n={...t,structureName:e.structureNameOverride||a.name,buildingId:a.id,floorName:e.levelNameOverride||i.name,floorOrdinal:i.ordinal};return{...e,position:n}},f=(e,o)=>{e.roomInfo||(e.roomInfo=[]),e.roomInfo.push(o)},g=e.pipe(e.propOr([],"externalIds"),e.find(e.propEq("roomId","type")),e.prop("id"),e.unless(e.isNil,e.tail));i.bus.on("venueData/poiDataLoaded",async({pois:o,structures:n})=>{if(o=((o,t)=>e.pipe(e.values,e.map(e=>{e.distance=null,e.staticName=e.name,e.isNavigable=void 0===e.isNavigable||!0===e.isNavigable,e.capacity&&f(e,{name:`Seats ${e.capacity.join("-")}`,svgId:"number-of-seats"}),e.category.startsWith("meeting")&&f(e,{name:i.gt()("poiView:Conference Room"),svgId:"conference-room"});const o=g(e);return o&&(e.roomId=o),[e.poiId,m(e,t)]}),e.fromPairs)(o))(o,t(n)),a(i,"pseudoTransPois"))for(const e in o)o[e]=u(o[e],i.i18n().language);o=function(e){const o=[];return Object.values(e).forEach(e=>{try{const t=e.position;t?["buildingId","structureName","floorId","floorName","floorOrdinal","latitude","longitude"].forEach(a=>{null!==t[a]&&void 0!==t[a]||o.push({id:e.poiId,e:`invalid position property: ${a}: ${t[a]}`})}):o.push({poi:e,e:"No position information"})}catch(t){p.error(t),o.push({id:e.poiId,e:t.message})}}),o.length&&(p.warn("badPois:",o),o.forEach(o=>{delete e[o.id]})),e}(o),await async function(e){for(const o of Object.values(e))await w(o);return e}(o),l.resolve(o),i.config.debug&&i.env.isBrowser&&(window._pois=o),i.config.debug&&async function(e){const o=Date.now(),t=[],a=await i.bus.get("wayfinder/_getNavGraph");Object.values(e).forEach(e=>{try{const o=e.position;a.findClosestNode(o.floorId,o.latitude,o.longitude)||t.push({id:e.poiId,e:"No closest Navgraph Node"})}catch(o){p.error(o),t.push({id:e.poiId,e:o.message})}}),t.length&&p.warn("badPois:",t),p(`Total time for navgraph POI check: ${Date.now()-o}ms`)}(o)}),i.bus.on("poi/getById",async({id:e})=>l.then(o=>o[e])),i.bus.on("poi/getByFloorId",async({floorId:o})=>l.then(e.pickBy(e.pathEq(o,["position","floorId"])))),i.bus.on("poi/getByCategoryId",async({categoryId:o})=>l.then(e.pickBy(e=>e.category===o||e.category.startsWith(o+".")))),i.bus.on("poi/getAll",async()=>l),i.bus.on("poi/getOpenStatus",async({id:e,now:o})=>{if(!d)return;const t=(await l)[e];if(!t)return;const a=await i.bus.get("venueData/getVenueTimezone");return n(t,a,i.gt(),o??new Date)});const y=["queue","primaryQueueId"],I=(o,t,a)=>{const i=e.path(["queue","queueType"],t);if(!i)return null;const n=o[i],r=e.path(y,t);return a.filter(e.pathEq(r,y)).filter(e=>e.poiId!==t.poiId).map(o=>{const t=e.path(["queue","queueSubtype"],o),a=h(t)(n);return{poiId:o.poiId,...a}})},h=o=>{return e.pipe(e.find(e.propEq(o,"id")),(t=`No queue found with ID: ${o}`,e=>{if(null!=e)return e;throw Error(t)}),e.pick(["displayText","imageId"]));var t};i.bus.on("poi/addOtherSecurityLanes",({poi:o})=>(async o=>{if(!e.path(y,o))return o;const t=await i.bus.get("venueData/getQueueTypes"),a=await i.bus.get("poi/getByCategoryId",{categoryId:"security"}),n=Object.values(a);return o.queue.otherQueues=I(t,o,n),o})(o));const b=e=>!!e?.startsWith("https:");async function w(t){if(!t)return;const a="undefined"==typeof window?1:window.devicePixelRatio||1,n=`${Math.round(351*a)}x${Math.round(197*a)}`;return e.length(t.images)?b(t.images[0])||(t.images=await o.all(t.images.map(e=>i.bus.get("venueData/getPoiImageUrl",{imageName:e,size:n})))):t.images=[],e.length(t.fullImages)?b(t.fullImages[0]?.url)||(t.fullImages=await o.all(t.fullImages.map(async({url:e,...o})=>({url:await i.bus.get("venueData/getPoiImageUrl",{imageName:e,size:n}),...o})))):t.fullImages=[],t}const v=e.memoizeWith(e.identity,e.pipe(e.pluck("category"),e.values,e.uniq));i.bus.on("poi/getAllCategories",async()=>l.then(v)),i.bus.on("venueData/loadNewVenue",()=>{l=new o,c()}),i.bus.on("poi/setDynamicData",async({plugin:o,idValuesMap:t})=>{const a=await l;for(const i in t){const n=a[i].dynamicData||{};n[o]={...t[i]};const r=e.mergeRight(a[i],{dynamicData:n});a[i]=r}}),i.bus.on("poi/setCoreAttributes",e=>{l.then(o=>{const t=[];for(const a in e){s(o,a,e[a]?.name)&&(i.bus.send("map/mutateFeature",{poiId:a,name:o[a].name}),t.push(o[a]))}t.length>0&&i.bus.send("poi/updated",{pois:t})})});return{init:c,runTest:async e=>(await e(),l),internal:{addImages:w,fixPositionInfo:m,pseudoTransPoi:u,applyPoiNameOverride:s}}}function s(e,o,t){return!!e[o]&&(e[o].name=t||e[o].staticName,!0)}function u(e,o){return["description","nearbyLandmark","name","phone","operationHours"].forEach(t=>{e[t]&&(e[t]=i(e[t],o))}),e.keywords&&(e.keywords=e.keywords.map(e=>(e.name=i(e.name,o),e))),e.position.floorName&&(e.position.floorName=i(e.position.floorName,o)),e.position.structureName&&(e.position.structureName=i(e.position.structureName,o)),e}export{s as applyPoiNameOverride,r as create};
|
package/package.json
CHANGED