@wework/floormap-utils
Advanced tools
Comparing version 2.26.0 to 2.27.0
@@ -6,2 +6,8 @@ # Change Log | ||
# [2.27.0](https://github.com/WeConnect/floormap-monorepo/compare/v2.26.0...v2.27.0) (2021-11-30) | ||
### Features | ||
- ✅ LBE-4215 added new space types and bookable ([#776](https://github.com/WeConnect/floormap-monorepo/issues/776)) ([2ee6598](https://github.com/WeConnect/floormap-monorepo/commit/2ee6598a2465798e7df72560a797ee4c78291b0f)) | ||
# [2.26.0](https://github.com/WeConnect/floormap-monorepo/compare/v2.25.1...v2.26.0) (2021-11-24) | ||
@@ -8,0 +14,0 @@ |
@@ -236,6 +236,7 @@ 'use strict'; | ||
var noReservable = !space.reservable; | ||
var matchProgramType = space.programType === 'MEET' || space.programType === 'WORK'; | ||
return noRelationships && noReservable && matchProgramType && !CheckIsHotDesk(space.subType.toUpperCase()) && !CheckIsDedicatedDesk(space.subType.toUpperCase()); | ||
var matchProgramType = ['MEET', 'WORK'].includes(space.programType) || isBookable(space); | ||
return noRelationships && noReservable && matchProgramType && // !CheckIsHotDesk(space.subType.toUpperCase()) && | ||
!CheckIsDedicatedDesk(space.subType.toUpperCase()); | ||
}; | ||
var bookableInventories = /*#__PURE__*/new Set(['BOOKABLE_PRIVATE_OFFICE', 'COMMON_SPACE', 'CONFERENCE_ROOM', 'DAILY_DESK', 'SHAREABLE_WORKSPACE']); | ||
var bookableInventories = /*#__PURE__*/new Set(['BOOKABLE_PRIVATE_OFFICE', 'COMMON_SPACE', 'CONFERENCE_ROOM', 'DAILY_DESK', 'SHAREABLE_WORKSPACE', 'LOUNGE', 'COMMUNITY BAR', 'SCREENING ROOM']); | ||
var isBookable = function isBookable(space) { | ||
@@ -245,5 +246,12 @@ var _space$inventoryData2, _space$inventoryData3; | ||
return !!((_space$inventoryData2 = space.inventoryData) !== null && _space$inventoryData2 !== void 0 && (_space$inventoryData3 = _space$inventoryData2.relationships) !== null && _space$inventoryData3 !== void 0 && _space$inventoryData3.some(function (rel) { | ||
return rel.product_type && bookableInventories.has(rel.product_type); | ||
})); | ||
return (rel === null || rel === void 0 ? void 0 : rel.product_type) && bookableInventories.has(rel === null || rel === void 0 ? void 0 : rel.product_type); | ||
})) || bookableInventories.has(space === null || space === void 0 ? void 0 : space.subType); | ||
}; | ||
var getSpaceProgramType = function getSpaceProgramType(space) { | ||
if (['MEET', 'WE', 'OPERATE'].includes(space === null || space === void 0 ? void 0 : space.programType)) { | ||
return isBookable(space) ? 'MEET' : space === null || space === void 0 ? void 0 : space.programType; | ||
} else { | ||
return space === null || space === void 0 ? void 0 : space.programType; | ||
} | ||
}; | ||
@@ -257,2 +265,3 @@ exports.CheckIsChair = CheckIsChair; | ||
exports.getSize = getSize; | ||
exports.getSpaceProgramType = getSpaceProgramType; | ||
exports.isBookable = isBookable; | ||
@@ -259,0 +268,0 @@ exports.isDedicatedDeskRoom = isDedicatedDeskRoom; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=(t=require("date-fns-tz/zonedTimeToUtc"))&&"object"==typeof t&&"default"in t?t.default:t,n=/HOT DESK/i,i=["DEDICATED DESK","DEDICATED DESKS","SHARED OFFICE DESK","SHARED OFFICE DESKS"],o=function(t,e){return e.some((function(e){return e===t}))};function r(t){return o(t,["HOT DESK","HOT DESKS","PRIVATE HOT DESK AREA","PRIVATE HOT DESKS AREA","HOT DESK AREA","HOT DESKS AREA"])}function a(t){return o(t,["DEDICATED DESK","DEDICATED DESKS","SHARED OFFICE DESK","SHARED OFFICE DESKS"])}var s=new Set(["BOOKABLE_PRIVATE_OFFICE","COMMON_SPACE","CONFERENCE_ROOM","DAILY_DESK","SHAREABLE_WORKSPACE"]);exports.CheckIsChair=function(t){return o(t,["SEAT","SEATS","CHAIR","CHAIRS"])},exports.CheckIsDedicatedDesk=a,exports.CheckIsHotDesk=r,exports.CheckIsTable=function(t){return o(t,["DESK","DESKS","TABLE","TABLES"])},exports.applyInstancing=function(t,e){var n=new Map;!function e(){for(var i=0;i<t.length;i++){var o=t[i];if(o.instancingId){var r=n.get(o.instancingId);r||(r=[]),r.push(o),n.set(o.instancingId,r),t.splice(i,1),e()}}}(),n.forEach((function(t,n,i){!function(t,e,n){if(0!==t.length){var i=t[0];if(n.createInstancedMesh({id:e,mesh:{points:i.points,extrude:i.extrude,opacity:i.style?i.style.opacity:1}}),t.forEach((function(t){n.addToInstancedMesh({id:t.id,instancingId:e,style:{color:t.style.color},position:t.position,rotation:t.rotation,interactable:t.interactable,visible:t.visible})})),n.drawInstancedMesh({id:e}),i.style.outline&&i.style.outline.color){var o=e+"_OUTLINE";n.createInstancedMesh({id:o,mesh:{style:{outline:{color:i.style.outline.color,only:!0}},points:i.points,extrude:i.extrude,zOrder:i.zOrder}}),t.forEach((function(t){n.addToInstancedMesh({id:t.id+"_outline",instancingId:o,style:{color:t.style.color},position:t.position,rotation:t.rotation,visible:t.visible})})),n.drawInstancedMesh({id:o})}}}(t,n,e)}))},exports.getCenter=function(t){for(var e=Infinity,n=Infinity,i=-Infinity,o=-Infinity,r=0;r<t.length;r++)e=Math.min(e,t[r].x),n=Math.min(n,t[r].y),i=Math.max(i,t[r].x),o=Math.max(o,t[r].y);return{x:(i+e)/2,y:(o+n)/2}},exports.getSize=function(t){for(var e=Infinity,n=Infinity,i=-Infinity,o=-Infinity,r=0;r<t.length;r++)e=Math.min(e,t[r].x),n=Math.min(n,t[r].y),i=Math.max(i,t[r].x),o=Math.max(o,t[r].y);return{width:i-e,height:o-n}},exports.isBookable=function(t){var e,n;return!(null===(e=t.inventoryData)||void 0===e||null===(n=e.relationships)||void 0===n||!n.some((function(t){return t.product_type&&s.has(t.product_type)})))},exports.isDedicatedDeskRoom=function(t,e){return void 0===t&&(t=""),void 0===e&&(e=""),"7c2c9f70-97c5-410b-b3a4-4fe9d1db88f8"===e||i.includes(t.toUpperCase())},exports.isHotDeskArea=function(t,e){return void 0===t&&(t=""),void 0===e&&(e=""),"b866ac5b-a1ce-45e0-a274-2137d4a547a1"===e||Boolean(n.exec(t))},exports.isNotLinked=function(t){var e,n=null===(e=t.inventoryData)||void 0===e?void 0:e.relationships;return!(n&&n.length>0||t.reservable||"MEET"!==t.programType&&"WORK"!==t.programType||r(t.subType.toUpperCase())||a(t.subType.toUpperCase()))},exports.parseUTCDate=function(t){return e(t,"utc")}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=(t=require("date-fns-tz/zonedTimeToUtc"))&&"object"==typeof t&&"default"in t?t.default:t,n=/HOT DESK/i,i=["DEDICATED DESK","DEDICATED DESKS","SHARED OFFICE DESK","SHARED OFFICE DESKS"],o=function(t,e){return e.some((function(e){return e===t}))};function r(t){return o(t,["DEDICATED DESK","DEDICATED DESKS","SHARED OFFICE DESK","SHARED OFFICE DESKS"])}var a=new Set(["BOOKABLE_PRIVATE_OFFICE","COMMON_SPACE","CONFERENCE_ROOM","DAILY_DESK","SHAREABLE_WORKSPACE","LOUNGE","COMMUNITY BAR","SCREENING ROOM"]),s=function(t){var e,n;return!(null===(e=t.inventoryData)||void 0===e||null===(n=e.relationships)||void 0===n||!n.some((function(t){return(null==t?void 0:t.product_type)&&a.has(null==t?void 0:t.product_type)})))||a.has(null==t?void 0:t.subType)};exports.CheckIsChair=function(t){return o(t,["SEAT","SEATS","CHAIR","CHAIRS"])},exports.CheckIsDedicatedDesk=r,exports.CheckIsHotDesk=function(t){return o(t,["HOT DESK","HOT DESKS","PRIVATE HOT DESK AREA","PRIVATE HOT DESKS AREA","HOT DESK AREA","HOT DESKS AREA"])},exports.CheckIsTable=function(t){return o(t,["DESK","DESKS","TABLE","TABLES"])},exports.applyInstancing=function(t,e){var n=new Map;!function e(){for(var i=0;i<t.length;i++){var o=t[i];if(o.instancingId){var r=n.get(o.instancingId);r||(r=[]),r.push(o),n.set(o.instancingId,r),t.splice(i,1),e()}}}(),n.forEach((function(t,n,i){!function(t,e,n){if(0!==t.length){var i=t[0];if(n.createInstancedMesh({id:e,mesh:{points:i.points,extrude:i.extrude,opacity:i.style?i.style.opacity:1}}),t.forEach((function(t){n.addToInstancedMesh({id:t.id,instancingId:e,style:{color:t.style.color},position:t.position,rotation:t.rotation,interactable:t.interactable,visible:t.visible})})),n.drawInstancedMesh({id:e}),i.style.outline&&i.style.outline.color){var o=e+"_OUTLINE";n.createInstancedMesh({id:o,mesh:{style:{outline:{color:i.style.outline.color,only:!0}},points:i.points,extrude:i.extrude,zOrder:i.zOrder}}),t.forEach((function(t){n.addToInstancedMesh({id:t.id+"_outline",instancingId:o,style:{color:t.style.color},position:t.position,rotation:t.rotation,visible:t.visible})})),n.drawInstancedMesh({id:o})}}}(t,n,e)}))},exports.getCenter=function(t){for(var e=Infinity,n=Infinity,i=-Infinity,o=-Infinity,r=0;r<t.length;r++)e=Math.min(e,t[r].x),n=Math.min(n,t[r].y),i=Math.max(i,t[r].x),o=Math.max(o,t[r].y);return{x:(i+e)/2,y:(o+n)/2}},exports.getSize=function(t){for(var e=Infinity,n=Infinity,i=-Infinity,o=-Infinity,r=0;r<t.length;r++)e=Math.min(e,t[r].x),n=Math.min(n,t[r].y),i=Math.max(i,t[r].x),o=Math.max(o,t[r].y);return{width:i-e,height:o-n}},exports.getSpaceProgramType=function(t){return["MEET","WE","OPERATE"].includes(null==t?void 0:t.programType)&&s(t)?"MEET":null==t?void 0:t.programType},exports.isBookable=s,exports.isDedicatedDeskRoom=function(t,e){return void 0===t&&(t=""),void 0===e&&(e=""),"7c2c9f70-97c5-410b-b3a4-4fe9d1db88f8"===e||i.includes(t.toUpperCase())},exports.isHotDeskArea=function(t,e){return void 0===t&&(t=""),void 0===e&&(e=""),"b866ac5b-a1ce-45e0-a274-2137d4a547a1"===e||Boolean(n.exec(t))},exports.isNotLinked=function(t){var e,n=null===(e=t.inventoryData)||void 0===e?void 0:e.relationships,i=!(n&&n.length>0),o=!t.reservable,a=["MEET","WORK"].includes(t.programType)||s(t);return i&&o&&a&&!r(t.subType.toUpperCase())},exports.parseUTCDate=function(t){return e(t,"utc")}; | ||
//# sourceMappingURL=floormap-utils.cjs.production.min.js.map |
@@ -230,6 +230,7 @@ import zonedTimeToUtc from 'date-fns-tz/zonedTimeToUtc'; | ||
var noReservable = !space.reservable; | ||
var matchProgramType = space.programType === 'MEET' || space.programType === 'WORK'; | ||
return noRelationships && noReservable && matchProgramType && !CheckIsHotDesk(space.subType.toUpperCase()) && !CheckIsDedicatedDesk(space.subType.toUpperCase()); | ||
var matchProgramType = ['MEET', 'WORK'].includes(space.programType) || isBookable(space); | ||
return noRelationships && noReservable && matchProgramType && // !CheckIsHotDesk(space.subType.toUpperCase()) && | ||
!CheckIsDedicatedDesk(space.subType.toUpperCase()); | ||
}; | ||
var bookableInventories = /*#__PURE__*/new Set(['BOOKABLE_PRIVATE_OFFICE', 'COMMON_SPACE', 'CONFERENCE_ROOM', 'DAILY_DESK', 'SHAREABLE_WORKSPACE']); | ||
var bookableInventories = /*#__PURE__*/new Set(['BOOKABLE_PRIVATE_OFFICE', 'COMMON_SPACE', 'CONFERENCE_ROOM', 'DAILY_DESK', 'SHAREABLE_WORKSPACE', 'LOUNGE', 'COMMUNITY BAR', 'SCREENING ROOM']); | ||
var isBookable = function isBookable(space) { | ||
@@ -239,7 +240,14 @@ var _space$inventoryData2, _space$inventoryData3; | ||
return !!((_space$inventoryData2 = space.inventoryData) !== null && _space$inventoryData2 !== void 0 && (_space$inventoryData3 = _space$inventoryData2.relationships) !== null && _space$inventoryData3 !== void 0 && _space$inventoryData3.some(function (rel) { | ||
return rel.product_type && bookableInventories.has(rel.product_type); | ||
})); | ||
return (rel === null || rel === void 0 ? void 0 : rel.product_type) && bookableInventories.has(rel === null || rel === void 0 ? void 0 : rel.product_type); | ||
})) || bookableInventories.has(space === null || space === void 0 ? void 0 : space.subType); | ||
}; | ||
var getSpaceProgramType = function getSpaceProgramType(space) { | ||
if (['MEET', 'WE', 'OPERATE'].includes(space === null || space === void 0 ? void 0 : space.programType)) { | ||
return isBookable(space) ? 'MEET' : space === null || space === void 0 ? void 0 : space.programType; | ||
} else { | ||
return space === null || space === void 0 ? void 0 : space.programType; | ||
} | ||
}; | ||
export { CheckIsChair, CheckIsDedicatedDesk, CheckIsHotDesk, CheckIsTable, applyInstancing, getCenter, getSize, isBookable, isDedicatedDeskRoom, isHotDeskArea, isNotLinked, parseUTCDate }; | ||
export { CheckIsChair, CheckIsDedicatedDesk, CheckIsHotDesk, CheckIsTable, applyInstancing, getCenter, getSize, getSpaceProgramType, isBookable, isDedicatedDeskRoom, isHotDeskArea, isNotLinked, parseUTCDate }; | ||
//# sourceMappingURL=floormap-utils.esm.js.map |
export { getCenter, getSize } from './spatial-service'; | ||
export { applyInstancing } from './instancing'; | ||
export { parseUTCDate } from './date-utils'; | ||
export { isDedicatedDeskRoom, isHotDeskArea, isNotLinked, isBookable, CheckIsHotDesk, CheckIsDedicatedDesk, CheckIsTable, CheckIsChair, } from './space-utils'; | ||
export { isDedicatedDeskRoom, isHotDeskArea, isNotLinked, isBookable, CheckIsHotDesk, CheckIsDedicatedDesk, CheckIsTable, CheckIsChair, getSpaceProgramType, } from './space-utils'; |
@@ -39,2 +39,3 @@ export declare const isHotDeskArea: (type?: string, roomTypeUUID?: string) => boolean; | ||
export declare const isBookable: (space: Space) => boolean; | ||
export declare const getSpaceProgramType: (space: Space) => string; | ||
export {}; |
{ | ||
"name": "@wework/floormap-utils", | ||
"version": "2.26.0", | ||
"version": "2.27.0", | ||
"main": "dist/index.js", | ||
@@ -27,3 +27,3 @@ "module": "dist/floormap-utils.esm.js", | ||
}, | ||
"gitHead": "9653334d68ce3fe46b261a57054930961e6ea90b" | ||
"gitHead": "03c93509adb255f02b093227e2de3f1ff8a4a0aa" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77696
537