atriusmaps-node-sdk 3.3.1098 → 3.3.1100

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "3.3.1098";
5
+ var version = "3.3.1100";
6
6
  var pkg = {
7
7
  version: version};
8
8
 
@@ -195,11 +195,13 @@ const buildSegments = (waypoints, fromEndpoint, toEndpoint, floorIdToNameMap, T,
195
195
  const startWaypoint = R__namespace.last(segment.waypoints);
196
196
  const coordinates = segment.coordinates;
197
197
  const shouldDrawSegment = !(segment.levelDifference && segment.waypoints.every((waypoint) => waypoint.isPortal));
198
+ const isPortal = startWaypoint.isPortal && segment.type !== "Security Checkpoint";
198
199
  const cookedSegment = {
199
200
  levelId: startWaypoint.position.structureId,
200
201
  ordinalId: `ordinal: ${startWaypoint.position.ordinal}`,
201
202
  coordinates,
202
- shouldDrawSegment
203
+ shouldDrawSegment,
204
+ ...isPortal ? { isPortal: true } : {}
203
205
  };
204
206
  const badges = [];
205
207
  if (segmentCategories.WALKING_TO_PORTAL === segment.segmentCategory) {
@@ -1 +1 @@
1
- var a="3.3.1098",e={version:a};export{e as default,a as version};
1
+ var a="3.3.1100",e={version:a};export{e as default,a as version};
@@ -1 +1 @@
1
- import*as e from"ramda";import{bezierCurveTo as t}from"../../../src/utils/geom.js";import o from"./segmentCategories.js";import a from"./stepBuilder.js";const n=e=>e.waypoints.flatMap((e,o)=>o>0&&e.curvedPathForward&&e.curvedPathForward.length>0?e.curvedPathForward.flatMap(e=>t(e.start.lng,e.start.lat,e.in.lng,e.in.lat,e.out.lng,e.out.lat,e.end.lng,e.end.lat)).map(e=>[e.x,e.y]):[[e.position.lng,e.position.lat]]),r=t=>{const a=[];let n={segmentCategory:void 0,waypoints:[]},r=null,s=[];return n.waypoints=[t[0]],n.type=t[0].isPortal?t[0].portalType:"Walk",a.push(n),n={segmentCategory:void 0,waypoints:[]},t.forEach(e=>{s.push(e),r?(r.isPortal===e.isPortal&&r.isSecurityCheckpoint===e.isSecurityCheckpoint||(n.waypoints=s,e.isPortal||r.isPortal?(s.length>1&&s.pop(),s=!e.isPortal||"train"!==e.portalType.toLowerCase()&&"bus"!==e.portalType.toLowerCase()?[e]:[s[s.length-1],e]):s=[],r.poiId&&(n.poiId=r.poiId),a.push(n),n={segmentCategory:void 0,waypoints:[]},n.type=e.isPortal?e.portalType:"Walk"),n.levelDifference=e.levelDifference,r=e):(n.type=e.isPortal?e.portalType:"Walk",r=e)}),n.waypoints=s,0===s.length&&r&&(n.waypoints=[r]),a.push(n),(e=>{e.forEach((t,a)=>{0===a?t.segmentCategory=o.START:t.waypoints[t.waypoints.length-1].isDestination?t.segmentCategory=o.WALKING_TO_END:"Security Checkpoint"===t.type?t.segmentCategory=o.SECURITY_CHECKPOINT:"Bus"===t.type?t.segmentCategory=o.BUS:"Train"===t.type?t.segmentCategory=o.TRAIN:"Stairs"===t.type?t.levelDifference>0?t.segmentCategory=o.STAIRS_UP:t.levelDifference<0?t.segmentCategory=o.STAIRS_DOWN:t.segmentCategory=o.STAIRS:"AccessibleStairs"===t.type?t.levelDifference>0?t.segmentCategory=o.ACCESSIBLE_STAIRS_UP:t.levelDifference<0?t.segmentCategory=o.ACCESSIBLE_STAIRS_DOWN:t.segmentCategory=o.ACCESSIBLE_STAIRS:"Elevator"===t.type?t.levelDifference>0?t.segmentCategory=o.ELEVATOR_UP:t.levelDifference<0?t.segmentCategory=o.ELEVATOR_DOWN:t.segmentCategory=o.ELEVATOR:"Escalator"===t.type?t.levelDifference>0?t.segmentCategory=o.ESCALATOR_UP:t.levelDifference<0?t.segmentCategory=o.ESCALATOR_DOWN:t.segmentCategory=o.ESCALATOR:"Ramp"===t.type?t.levelDifference>0?t.segmentCategory=o.RAMP_UP:t.levelDifference<0?t.segmentCategory=o.RAMP_DOWN:t.segmentCategory=o.RAMP:"Security Checkpoint"===e[a+1].type?t.segmentCategory=o.WALKING_TO_SECURITY_CHECKPOINT:"Walk"!==e[a+1].type&&(t.segmentCategory=o.WALKING_TO_PORTAL)})})(a),((e,t)=>{if(1===e.length&&t){const a={segmentCategory:void 0,waypoints:[]};a.segmentCategory=o.WALKING_TO_END,a.type="Walk",a.waypoints=[t],e.push(a)}})(a,r),(t=>{t.forEach((o,a)=>{if(a>1){const n=e.head(o.waypoints);if(0===n?.levelDifference){const n=e.last(t[a-1].waypoints);o.waypoints=e.prepend(n,o.waypoints)}}})})(a),a},s=(t,s,i,p,l,y,g,c,C)=>{let m=r(t);m=(e=>e.map(e=>({...e,coordinates:n(e)})))(m),s&&m[0]?.coordinates.unshift([s.lng,s.lat]),i&&e.last(m)?.coordinates.push([i.lng,i.lat]);return{segments:m.map((t,a)=>{const n=e.last(t.waypoints),r=t.coordinates,s=!(t.levelDifference&&t.waypoints.every(e=>e.isPortal)),i={levelId:n.position.structureId,ordinalId:`ordinal: ${n.position.ordinal}`,coordinates:r,shouldDrawSegment:s},p=[];if(o.WALKING_TO_PORTAL===t.segmentCategory){const t=m[a+1];p.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)})}else o.START!==t.segmentCategory&&p.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)});if(i.badges=p,i.segmentType=(e=>"Train"===e.type?"nav.train":"Bus"===e.type?"nav.transit":"Security Checkpoint"===e.type?"nav.secure":"nav.primary")(t),"Train"===t.type||"Bus"===t.type){const e=e=>({floorId:e.position.floorId,ordinal:e.position.ordinal,structureId:e.position.structureId,...e.poiId?{poiId:e.poiId}:{}});i.transit={entry:e(t.waypoints[0]),exit:e(t.waypoints.at(-1))}}return t.poiId&&(i.poiId=t.poiId),i}),steps:a(m,e.prop("title",s),e.prop("title",i),p,l,y,g,c,C)}};export{s as buildSegments};
1
+ import*as e from"ramda";import{bezierCurveTo as t}from"../../../src/utils/geom.js";import o from"./segmentCategories.js";import a from"./stepBuilder.js";const n=e=>e.waypoints.flatMap((e,o)=>o>0&&e.curvedPathForward&&e.curvedPathForward.length>0?e.curvedPathForward.flatMap(e=>t(e.start.lng,e.start.lat,e.in.lng,e.in.lat,e.out.lng,e.out.lat,e.end.lng,e.end.lat)).map(e=>[e.x,e.y]):[[e.position.lng,e.position.lat]]),r=t=>{const a=[];let n={segmentCategory:void 0,waypoints:[]},r=null,s=[];return n.waypoints=[t[0]],n.type=t[0].isPortal?t[0].portalType:"Walk",a.push(n),n={segmentCategory:void 0,waypoints:[]},t.forEach(e=>{s.push(e),r?(r.isPortal===e.isPortal&&r.isSecurityCheckpoint===e.isSecurityCheckpoint||(n.waypoints=s,e.isPortal||r.isPortal?(s.length>1&&s.pop(),s=!e.isPortal||"train"!==e.portalType.toLowerCase()&&"bus"!==e.portalType.toLowerCase()?[e]:[s[s.length-1],e]):s=[],r.poiId&&(n.poiId=r.poiId),a.push(n),n={segmentCategory:void 0,waypoints:[]},n.type=e.isPortal?e.portalType:"Walk"),n.levelDifference=e.levelDifference,r=e):(n.type=e.isPortal?e.portalType:"Walk",r=e)}),n.waypoints=s,0===s.length&&r&&(n.waypoints=[r]),a.push(n),(e=>{e.forEach((t,a)=>{0===a?t.segmentCategory=o.START:t.waypoints[t.waypoints.length-1].isDestination?t.segmentCategory=o.WALKING_TO_END:"Security Checkpoint"===t.type?t.segmentCategory=o.SECURITY_CHECKPOINT:"Bus"===t.type?t.segmentCategory=o.BUS:"Train"===t.type?t.segmentCategory=o.TRAIN:"Stairs"===t.type?t.levelDifference>0?t.segmentCategory=o.STAIRS_UP:t.levelDifference<0?t.segmentCategory=o.STAIRS_DOWN:t.segmentCategory=o.STAIRS:"AccessibleStairs"===t.type?t.levelDifference>0?t.segmentCategory=o.ACCESSIBLE_STAIRS_UP:t.levelDifference<0?t.segmentCategory=o.ACCESSIBLE_STAIRS_DOWN:t.segmentCategory=o.ACCESSIBLE_STAIRS:"Elevator"===t.type?t.levelDifference>0?t.segmentCategory=o.ELEVATOR_UP:t.levelDifference<0?t.segmentCategory=o.ELEVATOR_DOWN:t.segmentCategory=o.ELEVATOR:"Escalator"===t.type?t.levelDifference>0?t.segmentCategory=o.ESCALATOR_UP:t.levelDifference<0?t.segmentCategory=o.ESCALATOR_DOWN:t.segmentCategory=o.ESCALATOR:"Ramp"===t.type?t.levelDifference>0?t.segmentCategory=o.RAMP_UP:t.levelDifference<0?t.segmentCategory=o.RAMP_DOWN:t.segmentCategory=o.RAMP:"Security Checkpoint"===e[a+1].type?t.segmentCategory=o.WALKING_TO_SECURITY_CHECKPOINT:"Walk"!==e[a+1].type&&(t.segmentCategory=o.WALKING_TO_PORTAL)})})(a),((e,t)=>{if(1===e.length&&t){const a={segmentCategory:void 0,waypoints:[]};a.segmentCategory=o.WALKING_TO_END,a.type="Walk",a.waypoints=[t],e.push(a)}})(a,r),(t=>{t.forEach((o,a)=>{if(a>1){const n=e.head(o.waypoints);if(0===n?.levelDifference){const n=e.last(t[a-1].waypoints);o.waypoints=e.prepend(n,o.waypoints)}}})})(a),a},s=(t,s,i,p,l,y,g,c,C)=>{let m=r(t);m=(e=>e.map(e=>({...e,coordinates:n(e)})))(m),s&&m[0]?.coordinates.unshift([s.lng,s.lat]),i&&e.last(m)?.coordinates.push([i.lng,i.lat]);return{segments:m.map((t,a)=>{const n=e.last(t.waypoints),r=t.coordinates,s=!(t.levelDifference&&t.waypoints.every(e=>e.isPortal)),i=n.isPortal&&"Security Checkpoint"!==t.type,p={levelId:n.position.structureId,ordinalId:`ordinal: ${n.position.ordinal}`,coordinates:r,shouldDrawSegment:s,...i?{isPortal:!0}:{}},l=[];if(o.WALKING_TO_PORTAL===t.segmentCategory){const t=m[a+1];l.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)})}else o.START!==t.segmentCategory&&l.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)});if(p.badges=l,p.segmentType=(e=>"Train"===e.type?"nav.train":"Bus"===e.type?"nav.transit":"Security Checkpoint"===e.type?"nav.secure":"nav.primary")(t),"Train"===t.type||"Bus"===t.type){const e=e=>({floorId:e.position.floorId,ordinal:e.position.ordinal,structureId:e.position.structureId,...e.poiId?{poiId:e.poiId}:{}});p.transit={entry:e(t.waypoints[0]),exit:e(t.waypoints.at(-1))}}return t.poiId&&(p.poiId=t.poiId),p}),steps:a(m,e.prop("title",s),e.prop("title",i),p,l,y,g,c,C)}};export{s as buildSegments};
@@ -23,6 +23,8 @@ export type PreviewSegment = {
23
23
  coordinates: Coordinate[];
24
24
  ordinalId: string;
25
25
  segmentType: string;
26
+ /** Set when the segment is a portal (elevator, stairs, escalator, train, ...). */
27
+ isPortal?: boolean;
26
28
  poiId?: string | number;
27
29
  badges?: {
28
30
  canonicalName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atriusmaps-node-sdk",
3
- "version": "3.3.1098",
3
+ "version": "3.3.1100",
4
4
  "description": "This project provides an API to Atrius Personal Wayfinder maps within a Node environment. See the README.md for more information",
5
5
  "keywords": [
6
6
  "acuitybrands",