atriusmaps-node-sdk 3.3.1045 → 3.3.1046
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
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);
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a="3.3.
|
|
1
|
+
var a="3.3.1046",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};
|
package/package.json
CHANGED