atriusmaps-node-sdk 3.3.631 → 3.3.633
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/LICENSE.md +1 -2
- package/README.md +15 -16
- package/dist/cjs/deploy/prepareSDKConfig.js +73 -57
- package/dist/cjs/nodesdk/nodeEntry.js +51 -44
- package/dist/cjs/package.json.js +4 -1
- package/dist/cjs/plugins/clientAPI/src/clientAPI.js +6 -4
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +32 -26
- package/dist/cjs/plugins/dynamicPois/src/processors.js +41 -35
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +102 -95
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +52 -26
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +86 -66
- package/dist/cjs/plugins/searchService/src/flexsearchExports/lang.js +16 -16
- package/dist/cjs/plugins/searchService/src/flexsearchExports/simple.js +31 -8
- package/dist/cjs/plugins/searchService/src/poiSearch.js +14 -17
- package/dist/cjs/plugins/searchService/src/searchService.js +41 -39
- package/dist/cjs/plugins/searchService/src/searchTypeahead.js +14 -19
- package/dist/cjs/plugins/searchService/src/utils.js +4 -5
- package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +145 -127
- package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +37 -39
- package/dist/cjs/plugins/wayfinder/src/findRoute.js +11 -18
- package/dist/cjs/plugins/wayfinder/src/minPriorityQueue.js +18 -19
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +111 -91
- package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +19 -16
- package/dist/cjs/plugins/wayfinder/src/segmentBadges.js +1 -1
- package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +79 -76
- package/dist/cjs/plugins/wayfinder/src/segmentCategories.js +1 -1
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +147 -107
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +178 -148
- package/dist/cjs/src/app.js +64 -44
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +22 -21
- package/dist/cjs/src/configs/postproc-stateTracking.js +5 -8
- package/dist/cjs/src/controller.js +11 -6
- package/dist/cjs/src/debugTools.js +61 -34
- package/dist/cjs/src/env.js +7 -4
- package/dist/cjs/src/extModules/bustle.js +35 -45
- package/dist/cjs/src/extModules/flexapi/src/help.js +16 -8
- package/dist/cjs/src/extModules/flexapi/src/index.js +39 -18
- package/dist/cjs/src/extModules/flexapi/src/validate.js +129 -87
- package/dist/cjs/src/extModules/geohasher.js +7 -7
- package/dist/cjs/src/extModules/log.js +20 -22
- package/dist/cjs/src/historyManager.js +2 -2
- package/dist/cjs/src/utils/bounds.js +6 -6
- package/dist/cjs/src/utils/buildStructureLookup.js +3 -3
- package/dist/cjs/src/utils/configUtils.js +14 -18
- package/dist/cjs/src/utils/dom.js +12 -18
- package/dist/cjs/src/utils/funcs.js +12 -15
- package/dist/cjs/src/utils/geodesy.js +7 -9
- package/dist/cjs/src/utils/geom.js +52 -40
- package/dist/cjs/src/utils/i18n.js +47 -36
- package/dist/cjs/src/utils/location.js +12 -13
- package/dist/cjs/src/utils/observable.js +27 -28
- package/dist/cjs/src/utils/rand.js +9 -10
- package/dist/package.json.js +1 -1
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@ const calculateSegmentGeneralDirection = ({ waypoints }, T) => {
|
|
|
26
26
|
const to = helpers.point([lastWaypoint.position.lng, lastWaypoint.position.lat]);
|
|
27
27
|
const bearingDegrees = bearing.bearing(from, to);
|
|
28
28
|
// Convert bearing to general direction
|
|
29
|
-
return geodesy.bearingToDirection(bearingDegrees, T) // returns cardinal direction 'north', 'northeast' etc as a string
|
|
29
|
+
return geodesy.bearingToDirection(bearingDegrees, T); // returns cardinal direction 'north', 'northeast' etc as a string
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
/**
|
|
@@ -57,18 +57,38 @@ const calculateSegmentGeneralDirection = ({ waypoints }, T) => {
|
|
|
57
57
|
* @param {boolean} requiresAccessibility
|
|
58
58
|
* @return {Step[]} steps - list of navigation steps
|
|
59
59
|
*/
|
|
60
|
-
function getSteps
|
|
60
|
+
function getSteps(
|
|
61
|
+
segments,
|
|
62
|
+
startName = '',
|
|
63
|
+
destinationName = '',
|
|
64
|
+
floorIdToNameMap,
|
|
65
|
+
T,
|
|
66
|
+
queueTypes = {},
|
|
67
|
+
requiresAccessibility,
|
|
68
|
+
securityPois = [],
|
|
69
|
+
currentUnits,
|
|
70
|
+
) {
|
|
61
71
|
return segments.map((segment, index) => {
|
|
62
72
|
const securityWaitTimes = findPropWaypoints('securityWaitTimes')(segment.waypoints);
|
|
63
|
-
const eta =
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
const eta =
|
|
74
|
+
securityWaitTimes && !securityWaitTimes.isTemporarilyClosed // if there is dynamic wait time and checkpoint is open, then use it
|
|
75
|
+
? securityWaitTimes.queueTime
|
|
76
|
+
: Math.round(calculateSegmentEta(segment.waypoints));
|
|
66
77
|
const distance$1 = Math.round(calculateSegmentDistance(segment.waypoints)); // this is meters
|
|
67
78
|
const currentUnitsDistance = currentUnits === 'yards' ? distance.metersToYards(distance$1) : distance$1;
|
|
68
79
|
const icon = getIcon(segment.segmentCategory);
|
|
69
80
|
const animationAnchor = getAnimationAnchor(segment.segmentCategory, segment.waypoints);
|
|
70
81
|
const direction = calculateSegmentGeneralDirection(segment, T); // returns string like 'north', 'southwest', etc.
|
|
71
|
-
const primaryText = getPrimaryText(
|
|
82
|
+
const primaryText = getPrimaryText(
|
|
83
|
+
segments,
|
|
84
|
+
index,
|
|
85
|
+
startName,
|
|
86
|
+
destinationName,
|
|
87
|
+
floorIdToNameMap,
|
|
88
|
+
T,
|
|
89
|
+
securityPois,
|
|
90
|
+
queueTypes,
|
|
91
|
+
);
|
|
72
92
|
const secondaryText = getSecondaryText(segment, eta, T, false); // this is old but apparently relied on by customers using JS SDK and Mobile SDK
|
|
73
93
|
const secondaryTextUI = getSecondaryText(segment, eta, T, true, direction, currentUnits, currentUnitsDistance); // this is used in Webengine UI
|
|
74
94
|
const bounds$1 = bounds.findBoundsOfWaypoints(segment.waypoints);
|
|
@@ -84,111 +104,110 @@ function getSteps (segments, startName = '', destinationName = '', floorIdToName
|
|
|
84
104
|
distance: distance$1,
|
|
85
105
|
bounds: bounds$1,
|
|
86
106
|
isAccessible,
|
|
87
|
-
securityWaitTimes
|
|
107
|
+
securityWaitTimes,
|
|
88
108
|
};
|
|
89
109
|
|
|
90
|
-
if (segment.poiId)
|
|
91
|
-
step.poiId = segment.poiId;
|
|
110
|
+
if (segment.poiId) step.poiId = segment.poiId;
|
|
92
111
|
|
|
93
|
-
return step
|
|
94
|
-
})
|
|
112
|
+
return step;
|
|
113
|
+
});
|
|
95
114
|
}
|
|
96
115
|
|
|
97
|
-
function calculateSegmentEta
|
|
98
|
-
if (waypoints.length === 1) return waypoints[0].eta // for stairs/elevator segments. should be removed once segment builder will be refactored to not append waypoint from previous semgnent
|
|
116
|
+
function calculateSegmentEta(waypoints) {
|
|
117
|
+
if (waypoints.length === 1) return waypoints[0].eta; // for stairs/elevator segments. should be removed once segment builder will be refactored to not append waypoint from previous semgnent
|
|
99
118
|
return waypoints
|
|
100
119
|
.map(R.prop('eta'))
|
|
101
120
|
.slice(1) // first waypoint is end of previous segment and is added only to connect segments for navline calculation
|
|
102
|
-
.reduce((segmentEta, eta) => segmentEta + eta, 0.0)
|
|
121
|
+
.reduce((segmentEta, eta) => segmentEta + eta, 0.0);
|
|
103
122
|
}
|
|
104
123
|
|
|
105
|
-
function calculateSegmentDistance
|
|
106
|
-
if (waypoints.length === 1) return waypoints[0].distance // for stairs/elevator segments. should be removed once segment builder will be refactored to not append waypoint from previous semgnent
|
|
124
|
+
function calculateSegmentDistance(waypoints) {
|
|
125
|
+
if (waypoints.length === 1) return waypoints[0].distance; // for stairs/elevator segments. should be removed once segment builder will be refactored to not append waypoint from previous semgnent
|
|
107
126
|
return waypoints
|
|
108
127
|
.map(waypoint => waypoint.distance)
|
|
109
128
|
.slice(1) // first waypoint is end of previous segment and is added only to connect segments for navline calculation
|
|
110
|
-
.reduce((segmentDistance, distance) => segmentDistance + distance, 0.0)
|
|
129
|
+
.reduce((segmentDistance, distance) => segmentDistance + distance, 0.0);
|
|
111
130
|
}
|
|
112
131
|
|
|
113
|
-
function getIcon
|
|
132
|
+
function getIcon(segmentCategory) {
|
|
114
133
|
switch (segmentCategory) {
|
|
115
134
|
case segmentCategories.START:
|
|
116
|
-
return segmentBadges.START
|
|
135
|
+
return segmentBadges.START;
|
|
117
136
|
case segmentCategories.WALKING_TO_END:
|
|
118
|
-
return segmentBadges.END
|
|
137
|
+
return segmentBadges.END;
|
|
119
138
|
case segmentCategories.ELEVATOR:
|
|
120
|
-
return segmentBadges.ELEVATOR
|
|
139
|
+
return segmentBadges.ELEVATOR;
|
|
121
140
|
case segmentCategories.ELEVATOR_UP:
|
|
122
|
-
return segmentBadges.ELEVATOR_UP
|
|
141
|
+
return segmentBadges.ELEVATOR_UP;
|
|
123
142
|
case segmentCategories.ELEVATOR_DOWN:
|
|
124
|
-
return segmentBadges.ELEVATOR_DOWN
|
|
143
|
+
return segmentBadges.ELEVATOR_DOWN;
|
|
125
144
|
case segmentCategories.STAIRS:
|
|
126
|
-
return segmentBadges.STAIRS
|
|
145
|
+
return segmentBadges.STAIRS;
|
|
127
146
|
case segmentCategories.STAIRS_UP:
|
|
128
|
-
return segmentBadges.STAIRS_UP
|
|
147
|
+
return segmentBadges.STAIRS_UP;
|
|
129
148
|
case segmentCategories.STAIRS_DOWN:
|
|
130
|
-
return segmentBadges.STAIRS_DOWN
|
|
149
|
+
return segmentBadges.STAIRS_DOWN;
|
|
131
150
|
case segmentCategories.ESCALATOR:
|
|
132
|
-
return segmentBadges.ESCALATOR
|
|
151
|
+
return segmentBadges.ESCALATOR;
|
|
133
152
|
case segmentCategories.ESCALATOR_UP:
|
|
134
|
-
return segmentBadges.ESCALATOR_UP
|
|
153
|
+
return segmentBadges.ESCALATOR_UP;
|
|
135
154
|
case segmentCategories.ESCALATOR_DOWN:
|
|
136
|
-
return segmentBadges.ESCALATOR_DOWN
|
|
155
|
+
return segmentBadges.ESCALATOR_DOWN;
|
|
137
156
|
case segmentCategories.WALKING_TO_PORTAL:
|
|
138
157
|
case segmentCategories.WALK:
|
|
139
158
|
case segmentCategories.WALK_DOWN:
|
|
140
159
|
case segmentCategories.WALK_UP:
|
|
141
|
-
return segmentBadges.WALK
|
|
160
|
+
return segmentBadges.WALK;
|
|
142
161
|
case segmentCategories.TRAIN:
|
|
143
|
-
return segmentBadges.TRAIN
|
|
162
|
+
return segmentBadges.TRAIN;
|
|
144
163
|
case segmentCategories.TRAIN_UP:
|
|
145
|
-
return segmentBadges.TRAIN_UP
|
|
164
|
+
return segmentBadges.TRAIN_UP;
|
|
146
165
|
case segmentCategories.TRAIN_DOWN:
|
|
147
|
-
return segmentBadges.TRAIN_DOWN
|
|
166
|
+
return segmentBadges.TRAIN_DOWN;
|
|
148
167
|
case segmentCategories.BUS:
|
|
149
|
-
return segmentBadges.BUS
|
|
168
|
+
return segmentBadges.BUS;
|
|
150
169
|
case segmentCategories.BUS_UP:
|
|
151
|
-
return segmentBadges.BUS_UP
|
|
170
|
+
return segmentBadges.BUS_UP;
|
|
152
171
|
case segmentCategories.BUS_DOWN:
|
|
153
|
-
return segmentBadges.BUS_DOWN
|
|
172
|
+
return segmentBadges.BUS_DOWN;
|
|
154
173
|
case segmentCategories.SECURITY_CHECKPOINT:
|
|
155
|
-
return segmentBadges.SECURITY_CHECKPOINT
|
|
174
|
+
return segmentBadges.SECURITY_CHECKPOINT;
|
|
156
175
|
case segmentCategories.RAMP:
|
|
157
|
-
return segmentBadges.RAMP
|
|
176
|
+
return segmentBadges.RAMP;
|
|
158
177
|
case segmentCategories.RAMP_UP:
|
|
159
|
-
return segmentBadges.RAMP_UP
|
|
178
|
+
return segmentBadges.RAMP_UP;
|
|
160
179
|
case segmentCategories.RAMP_DOWN:
|
|
161
|
-
return segmentBadges.RAMP_DOWN
|
|
180
|
+
return segmentBadges.RAMP_DOWN;
|
|
162
181
|
default:
|
|
163
|
-
return segmentBadges.WALK
|
|
182
|
+
return segmentBadges.WALK;
|
|
164
183
|
}
|
|
165
184
|
}
|
|
166
185
|
|
|
167
|
-
function getAnimationAnchor
|
|
186
|
+
function getAnimationAnchor(segmentCategory, waypoints) {
|
|
168
187
|
let index;
|
|
169
188
|
switch (segmentCategory) {
|
|
170
189
|
case segmentCategories.START:
|
|
171
190
|
index = 0;
|
|
172
|
-
break
|
|
191
|
+
break;
|
|
173
192
|
case segmentCategories.WALKING_TO_END:
|
|
174
193
|
index = waypoints.length - 1;
|
|
175
|
-
break
|
|
194
|
+
break;
|
|
176
195
|
case segmentCategories.WALKING_TO_PORTAL:
|
|
177
196
|
index = Math.min(waypoints.length - 1, Math.ceil(waypoints.length / 2));
|
|
178
|
-
break
|
|
197
|
+
break;
|
|
179
198
|
default:
|
|
180
199
|
index = waypoints.length - 1;
|
|
181
200
|
}
|
|
182
|
-
return waypoints[index].position
|
|
201
|
+
return waypoints[index].position;
|
|
183
202
|
}
|
|
184
203
|
|
|
185
|
-
function getPrimaryText
|
|
204
|
+
function getPrimaryText(segments, index, startName, destinationName, floorIdToNameMap, T, securityPois, queueTypes) {
|
|
186
205
|
const segment = segments[index];
|
|
187
206
|
switch (segment.segmentCategory) {
|
|
188
207
|
case segmentCategories.START:
|
|
189
|
-
return getPositionName(segment.waypoints[0].position, startName)
|
|
208
|
+
return getPositionName(segment.waypoints[0].position, startName);
|
|
190
209
|
case segmentCategories.WALKING_TO_END:
|
|
191
|
-
return getPositionName(segment.waypoints[segment.waypoints.length - 1].position, destinationName)
|
|
210
|
+
return getPositionName(segment.waypoints[segment.waypoints.length - 1].position, destinationName);
|
|
192
211
|
case segmentCategories.WALKING_TO_SECURITY_CHECKPOINT: {
|
|
193
212
|
const lookAheadWaypoints = segments[index + 1].waypoints;
|
|
194
213
|
const laneName = getSecurityLaneName(queueTypes, lookAheadWaypoints);
|
|
@@ -197,17 +216,17 @@ function getPrimaryText (segments, index, startName, destinationName, floorIdToN
|
|
|
197
216
|
|
|
198
217
|
const poiTitle = getClosestSecurityPoiTitle(lookAheadWaypoints, securityPois);
|
|
199
218
|
const displayName = securityLane || poiTitle; // Use laneName if defined; otherwise, poiTitle
|
|
200
|
-
return displayName || T(`wayfinder:${segment.type}`)
|
|
219
|
+
return displayName || T(`wayfinder:${segment.type}`);
|
|
201
220
|
}
|
|
202
221
|
case segmentCategories.WALKING_TO_PORTAL:
|
|
203
|
-
return T(`wayfinder:${segments[index + 1].type}`)
|
|
222
|
+
return T(`wayfinder:${segments[index + 1].type}`);
|
|
204
223
|
case segmentCategories.SECURITY_CHECKPOINT: {
|
|
205
224
|
const laneName = getSecurityLaneName(queueTypes, segment.waypoints);
|
|
206
225
|
const translated = T(`wayfinder:Security Lane`);
|
|
207
226
|
const securityLane = laneName ? `${laneName} ${translated}` : null;
|
|
208
227
|
const poiTitle = getClosestSecurityPoiTitle(segment.waypoints, securityPois);
|
|
209
228
|
const displayName = securityLane || poiTitle; // Use securityLane if defined; otherwise, poiTitle
|
|
210
|
-
return displayName || getLevelName(segment, floorIdToNameMap)
|
|
229
|
+
return displayName || getLevelName(segment, floorIdToNameMap);
|
|
211
230
|
}
|
|
212
231
|
case segmentCategories.ELEVATOR:
|
|
213
232
|
case segmentCategories.ELEVATOR_DOWN:
|
|
@@ -218,91 +237,119 @@ function getPrimaryText (segments, index, startName, destinationName, floorIdToN
|
|
|
218
237
|
case segmentCategories.STAIRS:
|
|
219
238
|
case segmentCategories.STAIRS_DOWN:
|
|
220
239
|
case segmentCategories.STAIRS_UP:
|
|
221
|
-
return getLevelName(segment, floorIdToNameMap)
|
|
222
|
-
default:
|
|
240
|
+
return getLevelName(segment, floorIdToNameMap);
|
|
241
|
+
default:
|
|
242
|
+
return T(`wayfinder:${segment.type}`);
|
|
223
243
|
}
|
|
224
244
|
}
|
|
225
245
|
|
|
226
|
-
function getPositionName
|
|
227
|
-
if (position.name) {
|
|
228
|
-
|
|
246
|
+
function getPositionName(position, poiName) {
|
|
247
|
+
if (position.name) {
|
|
248
|
+
return position.name;
|
|
249
|
+
}
|
|
250
|
+
return poiName;
|
|
229
251
|
}
|
|
230
252
|
|
|
231
|
-
function getLevelName
|
|
232
|
-
return floorIdToNameMap[R.last(segment.waypoints).position.floorId]
|
|
253
|
+
function getLevelName(segment, floorIdToNameMap) {
|
|
254
|
+
return floorIdToNameMap[R.last(segment.waypoints).position.floorId];
|
|
233
255
|
}
|
|
234
256
|
|
|
235
|
-
function getSecondaryText
|
|
257
|
+
function getSecondaryText(segment, minutes, T, ui, direction, currentUnits, currentUnitsDistance) {
|
|
236
258
|
const zeroOrOtherKeys = translateZeroOrOther(minutes, T);
|
|
237
259
|
|
|
238
260
|
const travelVerb = 'Proceed';
|
|
239
261
|
switch (segment.segmentCategory) {
|
|
240
|
-
case segmentCategories.START:
|
|
241
|
-
|
|
242
|
-
case segmentCategories.
|
|
243
|
-
|
|
244
|
-
case segmentCategories.
|
|
245
|
-
|
|
246
|
-
case segmentCategories.
|
|
247
|
-
|
|
248
|
-
case segmentCategories.
|
|
249
|
-
|
|
262
|
+
case segmentCategories.START:
|
|
263
|
+
return T('wayfinder:Begin route at');
|
|
264
|
+
case segmentCategories.ELEVATOR:
|
|
265
|
+
return T('wayfinder:Take elevator to');
|
|
266
|
+
case segmentCategories.ELEVATOR_UP:
|
|
267
|
+
return T('wayfinder:Take elevator up to');
|
|
268
|
+
case segmentCategories.ELEVATOR_DOWN:
|
|
269
|
+
return T('wayfinder:Take elevator down to');
|
|
270
|
+
case segmentCategories.STAIRS:
|
|
271
|
+
return T('wayfinder:Take stairs to');
|
|
272
|
+
case segmentCategories.STAIRS_UP:
|
|
273
|
+
return T('wayfinder:Take stairs up to');
|
|
274
|
+
case segmentCategories.STAIRS_DOWN:
|
|
275
|
+
return T('wayfinder:Take stairs down to');
|
|
276
|
+
case segmentCategories.ESCALATOR:
|
|
277
|
+
return T('wayfinder:Take escalator to');
|
|
278
|
+
case segmentCategories.ESCALATOR_UP:
|
|
279
|
+
return T('wayfinder:Take escalator up to');
|
|
280
|
+
case segmentCategories.ESCALATOR_DOWN:
|
|
281
|
+
return T('wayfinder:Take escalator down to');
|
|
250
282
|
case segmentCategories.WALK:
|
|
251
283
|
case segmentCategories.WALKING_TO_SECURITY_CHECKPOINT:
|
|
252
284
|
case segmentCategories.WALKING_TO_PORTAL:
|
|
253
285
|
case segmentCategories.WALKING_TO_END: {
|
|
254
286
|
if (!ui) {
|
|
255
|
-
return zeroOrOtherKeys(`${travelVerb} <1 minute to`, `${travelVerb} xx minute to`)
|
|
287
|
+
return zeroOrOtherKeys(`${travelVerb} <1 minute to`, `${travelVerb} xx minute to`);
|
|
256
288
|
} else {
|
|
257
|
-
return createSecondaryTextWithHeading(currentUnitsDistance, currentUnits, direction, T)
|
|
289
|
+
return createSecondaryTextWithHeading(currentUnitsDistance, currentUnits, direction, T);
|
|
258
290
|
}
|
|
259
291
|
}
|
|
260
|
-
case segmentCategories.WALK_DOWN:
|
|
261
|
-
|
|
262
|
-
case segmentCategories.
|
|
263
|
-
|
|
292
|
+
case segmentCategories.WALK_DOWN:
|
|
293
|
+
return zeroOrOtherKeys(`${travelVerb} <1 minute down to`, `${travelVerb} xx minute down to`);
|
|
294
|
+
case segmentCategories.WALK_UP:
|
|
295
|
+
return zeroOrOtherKeys(`${travelVerb} <1 minute up to`, `${travelVerb} xx minute up to`);
|
|
296
|
+
case segmentCategories.TRAIN:
|
|
297
|
+
return zeroOrOtherKeys('Take train <1 minute', 'Take train xx minute');
|
|
298
|
+
case segmentCategories.BUS:
|
|
299
|
+
return zeroOrOtherKeys('Take bus <1 minute', 'Take bus xx minute');
|
|
264
300
|
case segmentCategories.SECURITY_CHECKPOINT: {
|
|
265
|
-
return T('wayfinder:Through')
|
|
301
|
+
return T('wayfinder:Through');
|
|
266
302
|
}
|
|
267
|
-
case segmentCategories.RAMP:
|
|
268
|
-
|
|
269
|
-
case segmentCategories.
|
|
270
|
-
|
|
303
|
+
case segmentCategories.RAMP:
|
|
304
|
+
return T('wayfinder:Take ramp to');
|
|
305
|
+
case segmentCategories.RAMP_UP:
|
|
306
|
+
return T('wayfinder:Take ramp up to');
|
|
307
|
+
case segmentCategories.RAMP_DOWN:
|
|
308
|
+
return T('wayfinder:Take ramp down to');
|
|
309
|
+
default:
|
|
310
|
+
return '';
|
|
271
311
|
}
|
|
272
312
|
}
|
|
273
313
|
|
|
274
314
|
const createSecondaryTextWithHeading = (currentUnitsDistance, currentUnits, direction, T) => {
|
|
275
315
|
if (currentUnitsDistance > 1) {
|
|
276
316
|
return currentUnits === 'meters'
|
|
277
|
-
? T(`wayfinder:Proceed __direction__ __count__ meter to_plural`, {
|
|
278
|
-
|
|
317
|
+
? T(`wayfinder:Proceed __direction__ __count__ meter to_plural`, {
|
|
318
|
+
direction,
|
|
319
|
+
count: currentUnitsDistance,
|
|
320
|
+
})
|
|
321
|
+
: T(`wayfinder:Proceed __direction__ __count__ yard to_plural`, {
|
|
322
|
+
direction,
|
|
323
|
+
count: currentUnitsDistance,
|
|
324
|
+
});
|
|
279
325
|
}
|
|
280
326
|
if (currentUnitsDistance <= 1) {
|
|
281
327
|
return currentUnits === 'meters'
|
|
282
|
-
? T(`wayfinder:Proceed __direction__ __count__ meter to`, {
|
|
283
|
-
|
|
328
|
+
? T(`wayfinder:Proceed __direction__ __count__ meter to`, {
|
|
329
|
+
direction,
|
|
330
|
+
count: currentUnitsDistance,
|
|
331
|
+
})
|
|
332
|
+
: T(`wayfinder:Proceed __direction__ __count__ yard to`, {
|
|
333
|
+
direction,
|
|
334
|
+
count: currentUnitsDistance,
|
|
335
|
+
});
|
|
284
336
|
}
|
|
285
337
|
};
|
|
286
338
|
|
|
287
|
-
const translateZeroOrOther = (count, T) => (zeroKey, otherKey) =>
|
|
288
|
-
? T('wayfinder:' + zeroKey)
|
|
289
|
-
: T('wayfinder:' + otherKey, { count });
|
|
339
|
+
const translateZeroOrOther = (count, T) => (zeroKey, otherKey) =>
|
|
340
|
+
count === 0 ? T('wayfinder:' + zeroKey) : T('wayfinder:' + otherKey, { count });
|
|
290
341
|
|
|
291
|
-
const checkIfAccessible = R.compose(
|
|
292
|
-
R.not, R.includes(R.__, ['escalator', 'stairs']), R.toLower, R.prop('type'));
|
|
342
|
+
const checkIfAccessible = R.compose(R.not, R.includes(R.__, ['escalator', 'stairs']), R.toLower, R.prop('type'));
|
|
293
343
|
|
|
294
344
|
const getSecurityLaneName = (queueTypes, waypoints) => {
|
|
295
345
|
const lane = findPropWaypoints('securityLane')(waypoints);
|
|
296
|
-
if (!lane) return
|
|
346
|
+
if (!lane) return;
|
|
297
347
|
const types = R.prop(lane.type, queueTypes);
|
|
298
348
|
const laneType = R.find(R.propEq(lane.id, 'id'), types);
|
|
299
|
-
return R.prop('displayText', laneType)
|
|
349
|
+
return R.prop('displayText', laneType);
|
|
300
350
|
};
|
|
301
351
|
|
|
302
|
-
const findPropWaypoints = propName => R.compose(
|
|
303
|
-
R.prop(propName),
|
|
304
|
-
R.find(R.prop(propName)),
|
|
305
|
-
R.drop(1)); // because first waypoint is the end of previous segment and can be security checkpoint
|
|
352
|
+
const findPropWaypoints = propName => R.compose(R.prop(propName), R.find(R.prop(propName)), R.drop(1)); // because first waypoint is the end of previous segment and can be security checkpoint
|
|
306
353
|
|
|
307
354
|
/**
|
|
308
355
|
* Given an array of waypoints (with exactly one having portalType "Security Checkpoint")
|
|
@@ -314,29 +361,22 @@ const findPropWaypoints = propName => R.compose(
|
|
|
314
361
|
* @returns {string|null} - The name of the closest security POI, or null if none found.
|
|
315
362
|
*/
|
|
316
363
|
const getClosestSecurityPoiTitle = (waypoints, securityPois) => {
|
|
317
|
-
if (!waypoints || waypoints.length === 0) return null
|
|
364
|
+
if (!waypoints || waypoints.length === 0) return null;
|
|
318
365
|
|
|
319
366
|
const checkpointWaypoint = waypoints[0];
|
|
320
367
|
const { lat, lng, floorId } = checkpointWaypoint.position;
|
|
321
368
|
// Use all POIs with a valid position on the same floor as the checkpoint.
|
|
322
|
-
const sameFloorCandidates = securityPois.filter(
|
|
323
|
-
poi => poi.position && poi.position.floorId === floorId
|
|
324
|
-
);
|
|
369
|
+
const sameFloorCandidates = securityPois.filter(poi => poi.position && poi.position.floorId === floorId);
|
|
325
370
|
let closest = null;
|
|
326
371
|
let minDistance = Infinity;
|
|
327
372
|
sameFloorCandidates.forEach(poi => {
|
|
328
|
-
const d = geodesy.distance(
|
|
329
|
-
lat,
|
|
330
|
-
lng,
|
|
331
|
-
poi.position.latitude,
|
|
332
|
-
poi.position.longitude
|
|
333
|
-
);
|
|
373
|
+
const d = geodesy.distance(lat, lng, poi.position.latitude, poi.position.longitude);
|
|
334
374
|
if (d < minDistance) {
|
|
335
375
|
minDistance = d;
|
|
336
376
|
closest = poi;
|
|
337
377
|
}
|
|
338
378
|
});
|
|
339
|
-
return closest ? closest.name : null
|
|
379
|
+
return closest ? closest.name : null;
|
|
340
380
|
};
|
|
341
381
|
|
|
342
382
|
module.exports = getSteps;
|