@opentripplanner/core-utils 4.10.0 → 4.11.2
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/esm/deprecated.js +10 -1
- package/esm/deprecated.js.map +1 -1
- package/esm/itinerary.js +3 -3
- package/esm/itinerary.js.map +1 -1
- package/esm/map.js +3 -3
- package/esm/map.js.map +1 -1
- package/esm/profile.js +1 -1
- package/esm/profile.js.map +1 -1
- package/esm/query-params.js +29 -7
- package/esm/query-params.js.map +1 -1
- package/esm/query.js +1 -1
- package/esm/query.js.map +1 -1
- package/esm/time.js +2 -2
- package/esm/time.js.map +1 -1
- package/lib/deprecated.js +9 -1
- package/lib/deprecated.js.map +1 -1
- package/lib/itinerary.js +3 -3
- package/lib/itinerary.js.map +1 -1
- package/lib/map.js +2 -2
- package/lib/map.js.map +1 -1
- package/lib/profile.js +1 -1
- package/lib/profile.js.map +1 -1
- package/lib/query-params.js +25 -7
- package/lib/query-params.js.map +1 -1
- package/lib/query.js +1 -1
- package/lib/query.js.map +1 -1
- package/lib/time.js +2 -2
- package/lib/time.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/__snapshots__/query-params.js.snap +15 -6
- package/src/__tests__/__snapshots__/query.js.snap +19 -0
- package/src/__tests__/query.js +8 -0
- package/src/deprecated.js +9 -1
- package/src/itinerary.js +7 -3
- package/src/map.js +9 -7
- package/src/profile.js +1 -1
- package/src/query-params.js +30 -8
- package/src/query.js +1 -0
- package/src/time.js +2 -2
package/src/map.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
getPlaceName,
|
|
3
|
+
isTransit,
|
|
4
|
+
isFlex,
|
|
5
|
+
toSentenceCase,
|
|
6
|
+
isAccessMode
|
|
7
|
+
} from "./itinerary";
|
|
2
8
|
|
|
3
9
|
import {
|
|
4
10
|
coordsToString,
|
|
@@ -102,15 +108,11 @@ export function itineraryToTransitive(
|
|
|
102
108
|
});
|
|
103
109
|
|
|
104
110
|
itin.legs.forEach((leg, idx) => {
|
|
105
|
-
if (
|
|
106
|
-
leg.mode === "WALK" ||
|
|
107
|
-
leg.mode === "BICYCLE" ||
|
|
108
|
-
leg.mode === "CAR" ||
|
|
109
|
-
leg.mode === "MICROMOBILITY"
|
|
110
|
-
) {
|
|
111
|
+
if (isAccessMode(leg.mode)) {
|
|
111
112
|
let fromPlaceId;
|
|
112
113
|
if (leg.from.bikeShareId) {
|
|
113
114
|
fromPlaceId = `bicycle_rent_station_${leg.from.bikeShareId}`;
|
|
115
|
+
// TODO: does this need to change to be OTP2 compatible?
|
|
114
116
|
} else if (leg.from.vertexType === "VEHICLERENTAL") {
|
|
115
117
|
fromPlaceId = `escooter_rent_station_${leg.from.name}`;
|
|
116
118
|
} else if (
|
package/src/profile.js
CHANGED
package/src/query-params.js
CHANGED
|
@@ -168,7 +168,14 @@ const queryParams = [
|
|
|
168
168
|
name: "maxWalkDistance",
|
|
169
169
|
routingTypes: ["ITINERARY"],
|
|
170
170
|
applicable: query =>
|
|
171
|
-
|
|
171
|
+
/* Since this query variable isn't in this list, it's not included in the generated query
|
|
172
|
+
* It does however allow us to determine if we should show the OTP1 max walk distance
|
|
173
|
+
* dropdown or the OTP2 walk reluctance slider
|
|
174
|
+
*/
|
|
175
|
+
!query.otp2 &&
|
|
176
|
+
query.mode &&
|
|
177
|
+
hasTransit(query.mode) &&
|
|
178
|
+
query.mode.indexOf("WALK") !== -1,
|
|
172
179
|
default: 1207, // 3/4 mi.
|
|
173
180
|
selector: "DROPDOWN",
|
|
174
181
|
label: "Maximum Walk",
|
|
@@ -271,7 +278,8 @@ const queryParams = [
|
|
|
271
278
|
{
|
|
272
279
|
/* optimize -- how to optimize a trip (non-bike, non-micromobility trips) */
|
|
273
280
|
name: "optimize",
|
|
274
|
-
applicable: query =>
|
|
281
|
+
applicable: query =>
|
|
282
|
+
!query.otp2 && hasTransit(query.mode) && !hasBike(query.mode),
|
|
275
283
|
routingTypes: ["ITINERARY"],
|
|
276
284
|
default: "QUICK",
|
|
277
285
|
selector: "DROPDOWN",
|
|
@@ -291,7 +299,7 @@ const queryParams = [
|
|
|
291
299
|
{
|
|
292
300
|
/* optimizeBike -- how to optimize an bike-based trip */
|
|
293
301
|
name: "optimizeBike",
|
|
294
|
-
applicable: query => hasBike(query.mode),
|
|
302
|
+
applicable: query => !query.otp2 && hasBike(query.mode),
|
|
295
303
|
routingTypes: ["ITINERARY"],
|
|
296
304
|
default: "SAFE",
|
|
297
305
|
selector: "DROPDOWN",
|
|
@@ -390,6 +398,23 @@ const queryParams = [
|
|
|
390
398
|
]
|
|
391
399
|
},
|
|
392
400
|
|
|
401
|
+
{
|
|
402
|
+
name: "walkReluctance",
|
|
403
|
+
routingTypes: ["ITINERARY", "PROFILE"],
|
|
404
|
+
selector: "SLIDER",
|
|
405
|
+
low: 0.5,
|
|
406
|
+
high: 20,
|
|
407
|
+
step: 0.5,
|
|
408
|
+
label: "walk reluctance",
|
|
409
|
+
labelLow: "More Walking",
|
|
410
|
+
labelHigh: "More Transit",
|
|
411
|
+
applicable: query =>
|
|
412
|
+
/* Since this query variable isn't in this list, it's not included in the generated query
|
|
413
|
+
* It does however allow us to determine if we should show the OTP1 max walk distance
|
|
414
|
+
* dropdown or the OTP2 walk reluctance slider
|
|
415
|
+
*/
|
|
416
|
+
!!query.otp2 && query.mode && query.mode.indexOf("WALK") !== -1
|
|
417
|
+
},
|
|
393
418
|
{
|
|
394
419
|
/* maxBikeTime -- the maximum time the user will spend biking in minutes */
|
|
395
420
|
name: "maxBikeTime",
|
|
@@ -536,7 +561,8 @@ const queryParams = [
|
|
|
536
561
|
applicable: query =>
|
|
537
562
|
query.mode &&
|
|
538
563
|
query.mode.indexOf("MICROMOBILITY") !== -1 &&
|
|
539
|
-
query.mode.indexOf("MICROMOBILITY_RENT") === -1
|
|
564
|
+
query.mode.indexOf("MICROMOBILITY_RENT") === -1 &&
|
|
565
|
+
query.mode.indexOf("SCOOTER") === -1,
|
|
540
566
|
options: [
|
|
541
567
|
{
|
|
542
568
|
text: "Kid's hoverboard (6mph)",
|
|
@@ -673,10 +699,6 @@ const queryParams = [
|
|
|
673
699
|
name: "maxPreTransitTime",
|
|
674
700
|
routingTypes: ["ITINERARY"]
|
|
675
701
|
},
|
|
676
|
-
{
|
|
677
|
-
name: "walkReluctance",
|
|
678
|
-
routingTypes: ["ITINERARY"]
|
|
679
|
-
},
|
|
680
702
|
{
|
|
681
703
|
name: "waitReluctance",
|
|
682
704
|
routingTypes: ["ITINERARY"]
|
package/src/query.js
CHANGED
package/src/time.js
CHANGED
|
@@ -109,9 +109,9 @@ export function formatDuration(seconds) {
|
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
111
|
* Formats an elapsed time in seconds, minutes, hours duration for display in narrative
|
|
112
|
-
* TODO: internationalization
|
|
113
112
|
* @param {number} seconds duration in seconds
|
|
114
|
-
* @
|
|
113
|
+
* @param {object} region an object that allows internationalization of the time
|
|
114
|
+
* @returns {string} formatted text representation
|
|
115
115
|
*/
|
|
116
116
|
export function formatDurationWithSeconds(seconds, region) {
|
|
117
117
|
return formatDurationLikeMoment(seconds, { enabled: true, code: region });
|