@opentripplanner/trip-details 7.0.0 → 8.0.0

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.
Files changed (68) hide show
  1. package/esm/components/departure-date.js +42 -0
  2. package/esm/components/departure-date.js.map +1 -0
  3. package/esm/components/emissions.js +68 -0
  4. package/esm/components/emissions.js.map +1 -0
  5. package/esm/{fare-table.js → components/fare-table.js} +6 -6
  6. package/esm/components/fare-table.js.map +1 -0
  7. package/esm/components/fares.js +151 -0
  8. package/esm/components/fares.js.map +1 -0
  9. package/esm/components/flex-booking-info.js +51 -0
  10. package/esm/components/flex-booking-info.js.map +1 -0
  11. package/esm/components/time-active.js +69 -0
  12. package/esm/components/time-active.js.map +1 -0
  13. package/esm/index.js +40 -289
  14. package/esm/index.js.map +1 -1
  15. package/esm/trip-detail.js +4 -2
  16. package/esm/trip-detail.js.map +1 -1
  17. package/esm/types.js.map +1 -1
  18. package/lib/components/departure-date.d.ts +10 -0
  19. package/lib/components/departure-date.d.ts.map +1 -0
  20. package/lib/components/departure-date.js +51 -0
  21. package/lib/components/departure-date.js.map +1 -0
  22. package/lib/components/emissions.d.ts +8 -0
  23. package/lib/components/emissions.d.ts.map +1 -0
  24. package/lib/components/emissions.js +75 -0
  25. package/lib/components/emissions.js.map +1 -0
  26. package/lib/{fare-table.d.ts → components/fare-table.d.ts} +1 -1
  27. package/lib/components/fare-table.d.ts.map +1 -0
  28. package/lib/{fare-table.js → components/fare-table.js} +6 -6
  29. package/lib/components/fare-table.js.map +1 -0
  30. package/lib/components/fares.d.ts +10 -0
  31. package/lib/components/fares.d.ts.map +1 -0
  32. package/lib/components/fares.js +162 -0
  33. package/lib/components/fares.js.map +1 -0
  34. package/lib/components/flex-booking-info.d.ts +6 -0
  35. package/lib/components/flex-booking-info.d.ts.map +1 -0
  36. package/lib/components/flex-booking-info.js +47 -0
  37. package/lib/components/flex-booking-info.js.map +1 -0
  38. package/lib/components/time-active.d.ts +14 -0
  39. package/lib/components/time-active.d.ts.map +1 -0
  40. package/lib/components/time-active.js +79 -0
  41. package/lib/components/time-active.js.map +1 -0
  42. package/lib/index.d.ts +2 -2
  43. package/lib/index.d.ts.map +1 -1
  44. package/lib/index.js +27 -262
  45. package/lib/index.js.map +1 -1
  46. package/lib/trip-detail.d.ts +2 -1
  47. package/lib/trip-detail.d.ts.map +1 -1
  48. package/lib/trip-detail.js +4 -2
  49. package/lib/trip-detail.js.map +1 -1
  50. package/lib/types.d.ts +20 -19
  51. package/lib/types.d.ts.map +1 -1
  52. package/lib/types.js.map +1 -1
  53. package/package.json +3 -3
  54. package/src/TripDetails.story.tsx +26 -28
  55. package/src/__snapshots__/TripDetails.story.tsx.snap +108 -108
  56. package/src/components/departure-date.tsx +53 -0
  57. package/src/components/emissions.tsx +97 -0
  58. package/src/{fare-table.tsx → components/fare-table.tsx} +4 -4
  59. package/src/components/fares.tsx +205 -0
  60. package/src/components/flex-booking-info.tsx +57 -0
  61. package/src/components/time-active.tsx +90 -0
  62. package/src/index.tsx +28 -365
  63. package/src/trip-detail.tsx +8 -2
  64. package/src/types.ts +18 -17
  65. package/tsconfig.tsbuildinfo +1 -1
  66. package/esm/fare-table.js.map +0 -1
  67. package/lib/fare-table.d.ts.map +0 -1
  68. package/lib/fare-table.js.map +0 -1
package/lib/index.js CHANGED
@@ -13,20 +13,17 @@ Object.defineProperty(exports, "FareLegTable", {
13
13
  exports.Styled = void 0;
14
14
  exports.TripDetails = TripDetails;
15
15
  exports.default = void 0;
16
- var _coreUtils = _interopRequireDefault(require("@opentripplanner/core-utils"));
17
16
  var _react = _interopRequireDefault(require("react"));
18
17
  var _reactIntl = require("react-intl");
19
- var _CalendarAlt = require("@styled-icons/fa-solid/CalendarAlt");
20
- var _Heartbeat = require("@styled-icons/fa-solid/Heartbeat");
21
- var _MoneyBillAlt = require("@styled-icons/fa-solid/MoneyBillAlt");
22
- var _Leaf = require("@styled-icons/fa-solid/Leaf");
23
- var _Route = require("@styled-icons/fa-solid/Route");
24
18
  var _flat = require("flat");
25
19
  var S = _interopRequireWildcard(require("./styled"));
26
20
  exports.Styled = S;
27
- var _tripDetail = _interopRequireDefault(require("./trip-detail"));
28
- var _fareTable = _interopRequireDefault(require("./fare-table"));
29
- var _utils = require("./utils");
21
+ var _fareTable = _interopRequireDefault(require("./components/fare-table"));
22
+ var _flexBookingInfo = _interopRequireDefault(require("./components/flex-booking-info"));
23
+ var _emissions = _interopRequireDefault(require("./components/emissions"));
24
+ var _fares = _interopRequireDefault(require("./components/fares"));
25
+ var _timeActive = _interopRequireWildcard(require("./components/time-active"));
26
+ var _departureDate = _interopRequireDefault(require("./components/departure-date"));
30
27
  var _enUS = _interopRequireDefault(require("../i18n/en-US.yml"));
31
28
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
32
29
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -37,31 +34,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
37
34
  // - the yaml loader for webpack returns a nested object,
38
35
  // - the yaml loader for jest returns messages with flattened ids.
39
36
  const defaultMessages = (0, _flat.flatten)(_enUS.default);
40
- function CO2DescriptionLink(contents) {
41
- return /*#__PURE__*/_react.default.createElement("a", {
42
- href: "https://www.itf-oecd.org/sites/default/files/life-cycle-assessment-calculations-2020.xlsx",
43
- rel: "noopener noreferrer",
44
- target: "_blank"
45
- }, contents);
46
- }
47
- /**
48
- * Default rendering if no component is provided for the TimeActiveDetails
49
- * slot in the TripDetails component.
50
- */
51
- function DefaultTimeActiveDetails({
52
- bikeMinutes,
53
- walkMinutes
54
- }) {
55
- return /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
56
- defaultMessage: defaultMessages["otpUi.TripDetails.timeActiveDescription"],
57
- description: "Text describing the walking and biking durations of a trip.",
58
- id: "otpUi.TripDetails.timeActiveDescription",
59
- values: {
60
- bikeMinutes,
61
- strong: _utils.boldText,
62
- walkMinutes
63
- }
64
- });
37
+ function cn(className, arg1) {
38
+ return className ? `${className} ${arg1}` : arg1;
65
39
  }
66
40
 
67
41
  /**
@@ -70,246 +44,37 @@ function DefaultTimeActiveDetails({
70
44
  function TripDetails({
71
45
  className = "",
72
46
  co2Config,
73
- defaultFareType,
74
47
  DepartureDetails = null,
75
- displayTimeActive = true,
76
48
  FareDetails = null,
77
- fareDetailsLayout,
78
- fareKeyNameMap = {},
49
+ fareConfig,
79
50
  itinerary,
80
51
  showApproximateMinutesActive,
81
- TimeActiveDetails = DefaultTimeActiveDetails
52
+ TimeActiveDetails = _timeActive.DefaultTimeActiveDetails
82
53
  }) {
83
- // process the transit fare
84
- const fareResult = _coreUtils.default.itinerary.calculateTncFares(itinerary);
85
- const {
86
- currencyCode,
87
- maxTNCFare,
88
- minTNCFare
89
- } = fareResult;
90
- const {
91
- companies,
92
- fareTypes
93
- } = itinerary.legs.reduce((prev, leg) => {
94
- if (leg.rideHailingEstimate) {
95
- prev.companies = leg.rideHailingEstimate.provider.id;
96
- }
97
- if (leg.fareProducts) {
98
- leg.fareProducts.forEach(fp => {
99
- var _fp$product$medium, _fp$product$riderCate;
100
- const mediumId = (_fp$product$medium = fp.product.medium) === null || _fp$product$medium === void 0 ? void 0 : _fp$product$medium.id;
101
- const riderCategoryId = (_fp$product$riderCate = fp.product.riderCategory) === null || _fp$product$riderCate === void 0 ? void 0 : _fp$product$riderCate.id;
102
- if (!prev.fareTypes.find(ft => ft.mediumId === mediumId && ft.riderCategoryId === riderCategoryId)) {
103
- prev.fareTypes.push({
104
- mediumId,
105
- riderCategoryId
106
- });
107
- }
108
- });
109
- }
110
- return prev;
111
- }, {
112
- companies: "",
113
- fareTypes: []
114
- });
115
- let fare;
116
- if (fareTypes.length > 0 && defaultFareType) {
117
- var _defaultFareTotal$cur;
118
- const defaultFareTotal = _coreUtils.default.itinerary.getItineraryCost(itinerary.legs, defaultFareType.mediumId, defaultFareType.riderCategoryId);
119
- // Depending on if there are additional fares to display either render a <span> or a <details>
120
- const TransitFareWrapper = fareTypes.length > 1 ? S.TransitFare : S.TransitFareSingle;
121
- const fareNameFallback = /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
122
- defaultMessage: defaultMessages["otpUi.TripDetails.transitFare"],
123
- description: "Text showing the price of tickets on public transportation.",
124
- id: "otpUi.TripDetails.transitFare"
125
- });
126
- fare = defaultFareTotal !== undefined && /*#__PURE__*/_react.default.createElement(S.Fare, null, /*#__PURE__*/_react.default.createElement(TransitFareWrapper, null, /*#__PURE__*/_react.default.createElement("summary", {
127
- style: {
128
- display: fareTypes.length > 1 ? "list-item" : ""
129
- }
130
- }, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
131
- defaultMessage: defaultMessages["otpUi.TripDetails.transitFareEntry"],
132
- description: "Text showing the price of tickets on public transportation.",
133
- id: "otpUi.TripDetails.transitFareEntry",
134
- values: {
135
- name: fareKeyNameMap[defaultFareType.headerKey] || fareNameFallback,
136
- strong: _utils.boldText,
137
- value: (0, _utils.renderFare)(((_defaultFareTotal$cur = defaultFareTotal.currency) === null || _defaultFareTotal$cur === void 0 ? void 0 : _defaultFareTotal$cur.code) || "USD", defaultFareTotal === null || defaultFareTotal === void 0 ? void 0 : defaultFareTotal.amount)
138
- }
139
- })), fareDetailsLayout ?
140
- /*#__PURE__*/
141
- // Show full ƒare details by leg
142
- _react.default.createElement(_fareTable.default, {
143
- layout: fareDetailsLayout,
144
- legs: itinerary.legs
145
- }) :
146
- // Just show the fares for each payment type
147
- fareTypes.map(fareType => {
148
- var _defaultFareTotal$cur2, _defaultFareTotal$cur3;
149
- // Don't show the default fare twice!
150
- if (fareType) {
151
- return null;
152
- }
153
- return /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
154
- defaultMessage: defaultMessages["otpUi.TripDetails.transitFareEntry"],
155
- description: "Text showing the price of tickets on public transportation.",
156
- id: "otpUi.TripDetails.transitFareEntry",
157
- key: Object.values(fareType).join("-"),
158
- values: {
159
- name: fareKeyNameMap[defaultFareType.headerKey] || fareNameFallback,
160
- strong: _utils.boldText,
161
- value: (0, _utils.renderFare)(((_defaultFareTotal$cur2 = defaultFareTotal.currency) === null || _defaultFareTotal$cur2 === void 0 ? void 0 : _defaultFareTotal$cur2.code) || "USD", (defaultFareTotal === null || defaultFareTotal === void 0 ? void 0 : defaultFareTotal.amount) / (defaultFareTotal === null || defaultFareTotal === void 0 || (_defaultFareTotal$cur3 = defaultFareTotal.currency) === null || _defaultFareTotal$cur3 === void 0 ? void 0 : _defaultFareTotal$cur3.digits))
162
- }
163
- });
164
- })));
165
- }
166
- const tncFare = minTNCFare !== 0 && /*#__PURE__*/_react.default.createElement(S.Fare, null, /*#__PURE__*/_react.default.createElement(S.TNCFare, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
167
- defaultMessage: defaultMessages["otpUi.TripDetails.tncFare"],
168
- description: "Text showing the price paid to transportation network companies.",
169
- id: "otpUi.TripDetails.tncFare",
170
- values: {
171
- companies:
172
- /*#__PURE__*/
173
- // S.TNCFareCompanies capitalizes the TNC company ID (e.g. "COMPANY")
174
- // after it is converted to lowercase, so it renders as "Company".
175
- _react.default.createElement(S.TNCFareCompanies, null, companies.toLowerCase()),
176
- maxTNCFare: (0, _utils.renderFare)(currencyCode, maxTNCFare),
177
- minTNCFare: (0, _utils.renderFare)(currencyCode, minTNCFare),
178
- strong: _utils.boldText
179
- }
180
- })));
181
- const departureDate = new Date(itinerary.startTime);
182
-
183
- // Compute total time spent active.
184
-
185
- // TODO: separate into two reducers
186
- let walkDurationSeconds = 0;
187
- let bikeDurationSeconds = 0;
188
- itinerary.legs.forEach(leg => {
189
- if (leg.mode.startsWith("WALK")) walkDurationSeconds += leg.duration;
190
- if (leg.mode.startsWith("BICYCLE")) bikeDurationSeconds += leg.duration;
191
- });
192
- const bikeMinutes = Math.round(bikeDurationSeconds / 60);
193
- const walkMinutes = Math.round(walkDurationSeconds / 60);
194
- const minutesActive = bikeMinutes + walkMinutes;
195
-
196
- // Calculate CO₂ if it's not provided by the itinerary
197
- const co2 = itinerary.co2 || (co2Config === null || co2Config === void 0 ? void 0 : co2Config.enabled) && _coreUtils.default.itinerary.calculateEmissions(itinerary, co2Config === null || co2Config === void 0 ? void 0 : co2Config.carbonIntensity, co2Config === null || co2Config === void 0 ? void 0 : co2Config.units);
198
-
199
- // Parse flex info and generate appropriate strings
200
- const containsFlex = itinerary.legs.some(_coreUtils.default.itinerary.isFlex);
201
- const pickupBookingInfo = itinerary.legs.map(leg => leg.pickupBookingInfo).filter(info => !!info);
202
- const dropOffBookingInfo = itinerary.legs.map(leg => leg.dropOffBookingInfo).filter(info => !!info);
203
- const totalDistance = itinerary.legs.reduce((total, leg) => total + leg.distance, 0);
204
54
  return /*#__PURE__*/_react.default.createElement(S.TripDetails, {
205
- className: className
55
+ className: cn(className, "trip-details")
206
56
  }, /*#__PURE__*/_react.default.createElement(S.TripDetailsHeader, {
207
57
  id: "trip-details-header"
208
58
  }, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
209
59
  defaultMessage: defaultMessages["otpUi.TripDetails.title"],
210
60
  description: "Title (heading) text of the component.",
211
61
  id: "otpUi.TripDetails.title"
212
- })), /*#__PURE__*/_react.default.createElement(S.TripDetailsBody, null, /*#__PURE__*/_react.default.createElement(_tripDetail.default
213
- // Any custom description for the Departure message needs to be handled by the slot.
214
- , {
215
- description: DepartureDetails && /*#__PURE__*/_react.default.createElement(DepartureDetails, {
216
- departureDate: departureDate
217
- }),
218
- icon: /*#__PURE__*/_react.default.createElement(_CalendarAlt.CalendarAlt, {
219
- size: 17
220
- }),
221
- summary: /*#__PURE__*/_react.default.createElement(S.Timing, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
222
- defaultMessage: defaultMessages["otpUi.TripDetails.departure"],
223
- description: "Text showing the departure date/time for a trip.",
224
- id: "otpUi.TripDetails.departure",
225
- values: {
226
- departureDate,
227
- strong: _utils.boldText
228
- }
229
- }))
230
- }), !!fare && /*#__PURE__*/_react.default.createElement(_tripDetail.default
231
- // Any custom description for the transit fare needs to be handled by the slot.
232
- , {
233
- description: FareDetails && /*#__PURE__*/_react.default.createElement(FareDetails, {
234
- legs: itinerary.legs,
235
- maxTNCFare: maxTNCFare,
236
- minTNCFare: minTNCFare
237
- }),
238
- icon: /*#__PURE__*/_react.default.createElement(_MoneyBillAlt.MoneyBillAlt, {
239
- size: 17
240
- }),
241
- summary: fare
242
- }), tncFare && /*#__PURE__*/_react.default.createElement(_tripDetail.default
243
- // Any custom description for the transit fare needs to be handled by the slot.
244
- , {
245
- description: FareDetails && /*#__PURE__*/_react.default.createElement(FareDetails, {
246
- legs: itinerary.legs,
247
- maxTNCFare: maxTNCFare,
248
- minTNCFare: minTNCFare
249
- }),
250
- icon: /*#__PURE__*/_react.default.createElement(_MoneyBillAlt.MoneyBillAlt, {
251
- size: 17
252
- }),
253
- summary: tncFare
254
- }), displayTimeActive && minutesActive > 0 && /*#__PURE__*/_react.default.createElement(_tripDetail.default, {
255
- icon: /*#__PURE__*/_react.default.createElement(_Heartbeat.Heartbeat, {
256
- size: 17
257
- }),
258
- summary: /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
259
- defaultMessage: defaultMessages["otpUi.TripDetails.minutesActive"],
260
- description: "Text showing the number of minutes spent walking or biking throughout trip.",
261
- id: "otpUi.TripDetails.minutesActive",
262
- values: {
263
- approximatePrefix: showApproximateMinutesActive,
264
- minutes: minutesActive,
265
- strong: _utils.boldText
266
- }
267
- }),
268
- description: TimeActiveDetails && /*#__PURE__*/_react.default.createElement(TimeActiveDetails, {
269
- bikeMinutes: bikeMinutes,
270
- walkMinutes: walkMinutes
271
- })
272
- }), co2 > 0 && (co2Config === null || co2Config === void 0 ? void 0 : co2Config.enabled) && /*#__PURE__*/_react.default.createElement(_tripDetail.default, {
273
- icon: /*#__PURE__*/_react.default.createElement(_Leaf.Leaf, {
274
- size: 17
275
- }),
276
- summary: /*#__PURE__*/_react.default.createElement(S.CO2Summary, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
277
- defaultMessage: defaultMessages["otpUi.TripDetails.co2"],
278
- description: "Text showing the quantity of CO\u2082 emitted by this trip.",
279
- id: "otpUi.TripDetails.co2",
280
- values: {
281
- co2: /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedNumber, {
282
- value: Math.round(co2)
283
- // eslint-disable-next-line react/style-prop-object
284
- ,
285
- style: "unit",
286
- unit: (co2Config === null || co2Config === void 0 ? void 0 : co2Config.units) || "gram",
287
- unitDisplay: "narrow"
288
- }),
289
- strong: _utils.boldText
290
- }
291
- })),
292
- description: /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
293
- defaultMessage: defaultMessages["otpUi.TripDetails.co2description"],
294
- description: "Text explaining how the CO\u2082 emissions are calculated.",
295
- id: "otpUi.TripDetails.co2description",
296
- values: {
297
- link: CO2DescriptionLink,
298
- totalDistance
299
- }
300
- })
301
- }), containsFlex && /*#__PURE__*/_react.default.createElement(_tripDetail.default, {
302
- summary: /*#__PURE__*/_react.default.createElement(S.FlexSummary, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
303
- defaultMessage: defaultMessages["otpUi.TripDetails.tripIncludesFlex"],
304
- description: "Text stating that portions of the trip include a flex (on-demand) transit service.",
305
- id: "otpUi.TripDetails.tripIncludesFlex",
306
- values: {
307
- extraMessage: [...new Set([...pickupBookingInfo.map(info => info.message), ...dropOffBookingInfo.map(info => info.message)])].join(" ")
308
- }
309
- })),
310
- icon: /*#__PURE__*/_react.default.createElement(_Route.Route, {
311
- size: 17
312
- })
62
+ })), /*#__PURE__*/_react.default.createElement(S.TripDetailsBody, null, /*#__PURE__*/_react.default.createElement(_departureDate.default, {
63
+ itinerary: itinerary,
64
+ DepartureDetails: DepartureDetails
65
+ }), /*#__PURE__*/_react.default.createElement(_fares.default, {
66
+ itinerary: itinerary,
67
+ fareConfig: fareConfig,
68
+ FareDetails: FareDetails
69
+ }), /*#__PURE__*/_react.default.createElement(_timeActive.default, {
70
+ itinerary: itinerary,
71
+ TimeActiveDetails: TimeActiveDetails,
72
+ showApproximateMinutesActive: showApproximateMinutesActive
73
+ }), /*#__PURE__*/_react.default.createElement(_flexBookingInfo.default, {
74
+ itinerary: itinerary
75
+ }), /*#__PURE__*/_react.default.createElement(_emissions.default, {
76
+ itinerary: itinerary,
77
+ co2Config: co2Config
313
78
  })));
314
79
  }
315
80
  var _default = exports.default = TripDetails; // Rename styled components for export.
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_coreUtils","_interopRequireDefault","require","_react","_reactIntl","_CalendarAlt","_Heartbeat","_MoneyBillAlt","_Leaf","_Route","_flat","S","_interopRequireWildcard","exports","Styled","_tripDetail","_fareTable","_utils","_enUS","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","defaultMessages","flatten","defaultEnglishMessages","CO2DescriptionLink","contents","createElement","href","rel","target","DefaultTimeActiveDetails","bikeMinutes","walkMinutes","FormattedMessage","defaultMessage","description","id","values","strong","boldText","TripDetails","className","co2Config","defaultFareType","DepartureDetails","displayTimeActive","FareDetails","fareDetailsLayout","fareKeyNameMap","itinerary","showApproximateMinutesActive","TimeActiveDetails","fareResult","coreUtils","calculateTncFares","currencyCode","maxTNCFare","minTNCFare","companies","fareTypes","legs","reduce","prev","leg","rideHailingEstimate","provider","fareProducts","forEach","fp","_fp$product$medium","_fp$product$riderCate","mediumId","product","medium","riderCategoryId","riderCategory","find","ft","push","fare","length","_defaultFareTotal$cur","defaultFareTotal","getItineraryCost","TransitFareWrapper","TransitFare","TransitFareSingle","fareNameFallback","undefined","Fare","style","display","name","headerKey","value","renderFare","currency","code","amount","layout","map","fareType","_defaultFareTotal$cur2","_defaultFareTotal$cur3","key","join","digits","tncFare","TNCFare","TNCFareCompanies","toLowerCase","departureDate","Date","startTime","walkDurationSeconds","bikeDurationSeconds","mode","startsWith","duration","Math","round","minutesActive","co2","enabled","calculateEmissions","carbonIntensity","units","containsFlex","some","isFlex","pickupBookingInfo","filter","info","dropOffBookingInfo","totalDistance","total","distance","TripDetailsHeader","TripDetailsBody","icon","CalendarAlt","size","summary","Timing","MoneyBillAlt","Heartbeat","approximatePrefix","minutes","Leaf","CO2Summary","FormattedNumber","unit","unitDisplay","link","FlexSummary","extraMessage","Set","message","Route","_default"],"sources":["../src/index.tsx"],"sourcesContent":["import coreUtils from \"@opentripplanner/core-utils\";\nimport { FareProductSelector } from \"@opentripplanner/types\";\nimport React, { ReactElement, ReactNode } from \"react\";\nimport { FormattedMessage, FormattedNumber } from \"react-intl\";\nimport { CalendarAlt } from \"@styled-icons/fa-solid/CalendarAlt\";\nimport { Heartbeat } from \"@styled-icons/fa-solid/Heartbeat\";\nimport { MoneyBillAlt } from \"@styled-icons/fa-solid/MoneyBillAlt\";\nimport { Leaf } from \"@styled-icons/fa-solid/Leaf\";\nimport { Route } from \"@styled-icons/fa-solid/Route\";\nimport { flatten } from \"flat\";\nimport * as S from \"./styled\";\nimport TripDetail from \"./trip-detail\";\nimport FareLegTable from \"./fare-table\";\nimport { boldText, renderFare } from \"./utils\";\n\nimport { TimeActiveDetailsProps, TripDetailsProps } from \"./types\";\n\n// Load the default messages.\nimport defaultEnglishMessages from \"../i18n/en-US.yml\";\n\n// HACK: We should flatten the messages loaded above because\n// the YAML loaders behave differently between webpack and our version of jest:\n// - the yaml loader for webpack returns a nested object,\n// - the yaml loader for jest returns messages with flattened ids.\nconst defaultMessages: Record<string, string> = flatten(defaultEnglishMessages);\n\nfunction CO2DescriptionLink(contents: ReactNode): ReactElement {\n return (\n <a\n href=\"https://www.itf-oecd.org/sites/default/files/life-cycle-assessment-calculations-2020.xlsx\"\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n {contents}\n </a>\n );\n}\n/**\n * Default rendering if no component is provided for the TimeActiveDetails\n * slot in the TripDetails component.\n */\nfunction DefaultTimeActiveDetails({\n bikeMinutes,\n walkMinutes\n}: TimeActiveDetailsProps): ReactElement {\n return (\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.timeActiveDescription\"]\n }\n description=\"Text describing the walking and biking durations of a trip.\"\n id=\"otpUi.TripDetails.timeActiveDescription\"\n values={{\n bikeMinutes,\n strong: boldText,\n walkMinutes\n }}\n />\n );\n}\n\n/**\n * Renders trip details such as departure instructions, fare amount, and minutes active.\n */\nexport function TripDetails({\n className = \"\",\n co2Config,\n defaultFareType,\n DepartureDetails = null,\n displayTimeActive = true,\n FareDetails = null,\n fareDetailsLayout,\n fareKeyNameMap = {},\n itinerary,\n showApproximateMinutesActive,\n TimeActiveDetails = DefaultTimeActiveDetails\n}: TripDetailsProps): ReactElement {\n // process the transit fare\n const fareResult = coreUtils.itinerary.calculateTncFares(itinerary);\n const { currencyCode, maxTNCFare, minTNCFare } = fareResult;\n\n const { companies, fareTypes } = itinerary.legs.reduce<{\n companies: string;\n fareTypes: FareProductSelector[];\n }>(\n (prev, leg) => {\n if (leg.rideHailingEstimate) {\n prev.companies = leg.rideHailingEstimate.provider.id;\n }\n\n if (leg.fareProducts) {\n leg.fareProducts.forEach(fp => {\n const mediumId = fp.product.medium?.id;\n const riderCategoryId = fp.product.riderCategory?.id;\n if (\n !prev.fareTypes.find(\n ft =>\n ft.mediumId === mediumId &&\n ft.riderCategoryId === riderCategoryId\n )\n ) {\n prev.fareTypes.push({ mediumId, riderCategoryId });\n }\n });\n }\n return prev;\n },\n { companies: \"\", fareTypes: [] }\n );\n\n let fare;\n if (fareTypes.length > 0 && defaultFareType) {\n const defaultFareTotal = coreUtils.itinerary.getItineraryCost(\n itinerary.legs,\n defaultFareType.mediumId,\n defaultFareType.riderCategoryId\n );\n // Depending on if there are additional fares to display either render a <span> or a <details>\n const TransitFareWrapper =\n fareTypes.length > 1 ? S.TransitFare : S.TransitFareSingle;\n\n const fareNameFallback = (\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.transitFare\"]}\n description=\"Text showing the price of tickets on public transportation.\"\n id=\"otpUi.TripDetails.transitFare\"\n />\n );\n\n fare = defaultFareTotal !== undefined && (\n <S.Fare>\n <TransitFareWrapper>\n <summary style={{ display: fareTypes.length > 1 ? \"list-item\" : \"\" }}>\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.transitFareEntry\"]\n }\n description=\"Text showing the price of tickets on public transportation.\"\n id=\"otpUi.TripDetails.transitFareEntry\"\n values={{\n name:\n fareKeyNameMap[defaultFareType.headerKey] || fareNameFallback,\n strong: boldText,\n value: renderFare(\n defaultFareTotal.currency?.code || \"USD\",\n defaultFareTotal?.amount\n )\n }}\n />\n </summary>\n {fareDetailsLayout ? (\n // Show full ƒare details by leg\n <FareLegTable layout={fareDetailsLayout} legs={itinerary.legs} />\n ) : (\n // Just show the fares for each payment type\n fareTypes.map(fareType => {\n // Don't show the default fare twice!\n if (fareType) {\n return null;\n }\n return (\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.transitFareEntry\"]\n }\n description=\"Text showing the price of tickets on public transportation.\"\n id=\"otpUi.TripDetails.transitFareEntry\"\n key={Object.values(fareType).join(\"-\")}\n values={{\n name:\n fareKeyNameMap[defaultFareType.headerKey] ||\n fareNameFallback,\n strong: boldText,\n value: renderFare(\n defaultFareTotal.currency?.code || \"USD\",\n defaultFareTotal?.amount /\n defaultFareTotal?.currency?.digits\n )\n }}\n />\n );\n })\n )}\n </TransitFareWrapper>\n </S.Fare>\n );\n }\n const tncFare = minTNCFare !== 0 && (\n <S.Fare>\n <S.TNCFare>\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.tncFare\"]}\n description=\"Text showing the price paid to transportation network companies.\"\n id=\"otpUi.TripDetails.tncFare\"\n values={{\n companies: (\n // S.TNCFareCompanies capitalizes the TNC company ID (e.g. \"COMPANY\")\n // after it is converted to lowercase, so it renders as \"Company\".\n <S.TNCFareCompanies>{companies.toLowerCase()}</S.TNCFareCompanies>\n ),\n maxTNCFare: renderFare(currencyCode, maxTNCFare),\n minTNCFare: renderFare(currencyCode, minTNCFare),\n strong: boldText\n }}\n />\n </S.TNCFare>\n </S.Fare>\n );\n\n const departureDate = new Date(itinerary.startTime);\n\n // Compute total time spent active.\n\n // TODO: separate into two reducers\n let walkDurationSeconds = 0;\n let bikeDurationSeconds = 0;\n itinerary.legs.forEach(leg => {\n if (leg.mode.startsWith(\"WALK\")) walkDurationSeconds += leg.duration;\n if (leg.mode.startsWith(\"BICYCLE\")) bikeDurationSeconds += leg.duration;\n });\n const bikeMinutes = Math.round(bikeDurationSeconds / 60);\n const walkMinutes = Math.round(walkDurationSeconds / 60);\n const minutesActive = bikeMinutes + walkMinutes;\n\n // Calculate CO₂ if it's not provided by the itinerary\n const co2 =\n itinerary.co2 ||\n (co2Config?.enabled &&\n coreUtils.itinerary.calculateEmissions(\n itinerary,\n co2Config?.carbonIntensity,\n co2Config?.units\n ));\n\n // Parse flex info and generate appropriate strings\n const containsFlex = itinerary.legs.some(coreUtils.itinerary.isFlex);\n const pickupBookingInfo = itinerary.legs\n .map(leg => leg.pickupBookingInfo)\n .filter(info => !!info);\n const dropOffBookingInfo = itinerary.legs\n .map(leg => leg.dropOffBookingInfo)\n .filter(info => !!info);\n const totalDistance = itinerary.legs.reduce(\n (total, leg) => total + leg.distance,\n 0\n );\n\n return (\n <S.TripDetails className={className}>\n {/* this can be presentation as S.TripDetails is already labeled by this */}\n <S.TripDetailsHeader id=\"trip-details-header\">\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.title\"]}\n description=\"Title (heading) text of the component.\"\n id=\"otpUi.TripDetails.title\"\n />\n </S.TripDetailsHeader>\n <S.TripDetailsBody>\n <TripDetail\n // Any custom description for the Departure message needs to be handled by the slot.\n description={\n DepartureDetails && (\n <DepartureDetails departureDate={departureDate} />\n )\n }\n icon={<CalendarAlt size={17} />}\n summary={\n <S.Timing>\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.departure\"]}\n description=\"Text showing the departure date/time for a trip.\"\n id=\"otpUi.TripDetails.departure\"\n values={{\n departureDate,\n strong: boldText\n }}\n />\n </S.Timing>\n }\n />\n {!!fare && (\n <TripDetail\n // Any custom description for the transit fare needs to be handled by the slot.\n description={\n FareDetails && (\n <FareDetails\n legs={itinerary.legs}\n maxTNCFare={maxTNCFare}\n minTNCFare={minTNCFare}\n />\n )\n }\n icon={<MoneyBillAlt size={17} />}\n summary={fare}\n />\n )}\n {tncFare && (\n <TripDetail\n // Any custom description for the transit fare needs to be handled by the slot.\n description={\n FareDetails && (\n <FareDetails\n legs={itinerary.legs}\n maxTNCFare={maxTNCFare}\n minTNCFare={minTNCFare}\n />\n )\n }\n icon={<MoneyBillAlt size={17} />}\n summary={tncFare}\n />\n )}\n {displayTimeActive && minutesActive > 0 && (\n <TripDetail\n icon={<Heartbeat size={17} />}\n summary={\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.minutesActive\"]\n }\n description=\"Text showing the number of minutes spent walking or biking throughout trip.\"\n id=\"otpUi.TripDetails.minutesActive\"\n values={{\n approximatePrefix: showApproximateMinutesActive,\n minutes: minutesActive,\n strong: boldText\n }}\n />\n }\n description={\n TimeActiveDetails && (\n <TimeActiveDetails\n bikeMinutes={bikeMinutes}\n walkMinutes={walkMinutes}\n />\n )\n }\n />\n )}\n {co2 > 0 && co2Config?.enabled && (\n <TripDetail\n icon={<Leaf size={17} />}\n summary={\n <S.CO2Summary>\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.co2\"]}\n description=\"Text showing the quantity of CO₂ emitted by this trip.\"\n id=\"otpUi.TripDetails.co2\"\n values={{\n co2: (\n <FormattedNumber\n value={Math.round(co2)}\n // eslint-disable-next-line react/style-prop-object\n style=\"unit\"\n unit={co2Config?.units || \"gram\"}\n unitDisplay=\"narrow\"\n />\n ),\n strong: boldText\n }}\n />\n </S.CO2Summary>\n }\n description={\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.co2description\"]\n }\n description=\"Text explaining how the CO₂ emissions are calculated.\"\n id=\"otpUi.TripDetails.co2description\"\n values={{\n link: CO2DescriptionLink,\n totalDistance\n }}\n />\n }\n />\n )}\n {containsFlex && (\n <TripDetail\n summary={\n <S.FlexSummary>\n <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.tripIncludesFlex\"]\n }\n description=\"Text stating that portions of the trip include a flex (on-demand) transit service.\"\n id=\"otpUi.TripDetails.tripIncludesFlex\"\n values={{\n extraMessage: [\n ...new Set([\n ...pickupBookingInfo.map(info => info.message),\n ...dropOffBookingInfo.map(info => info.message)\n ])\n ].join(\" \")\n }}\n />\n </S.FlexSummary>\n }\n icon={<Route size={17} />}\n />\n )}\n </S.TripDetailsBody>\n </S.TripDetails>\n );\n}\n\nexport default TripDetails;\n\n// Rename styled components for export.\nexport { S as Styled, FareLegTable };\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAA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A,CAAAsB,OAAA,CAAAmB,aAAA,CAACjC,CAAC,CAACiK,WAAW,qBACZzK,MAAA,CAAAsB,OAAA,CAAAmB,aAAA,CAACxC,UAAA,CAAA+C,gBAAgB;MACfC,cAAc,EACZb,eAAe,CAAC,oCAAoC,CACrD;MACDc,WAAW,EAAC,oFAAoF;MAChGC,EAAE,EAAC,oCAAoC;MACvCC,MAAM,EAAE;QACNsH,YAAY,EAAE,CACZ,GAAG,IAAIC,GAAG,CAAC,CACT,GAAG1B,iBAAiB,CAAC9B,GAAG,CAACgC,IAAI,IAAIA,IAAI,CAACyB,OAAO,CAAC,EAC9C,GAAGxB,kBAAkB,CAACjC,GAAG,CAACgC,IAAI,IAAIA,IAAI,CAACyB,OAAO,CAAC,CAChD,CAAC,CACH,CAACpD,IAAI,CAAC,GAAG;MACZ;IAAE,CACH,CACY,CAChB;IACDkC,IAAI,eAAE1J,MAAA,CAAAsB,OAAA,CAAAmB,aAAA,CAACnC,MAAA,CAAAuK,KAAK;MAACjB,IAAI,EAAE;IAAG,CAAE;EAAE,CAC3B,CAEc,CACN,CAAC;AAEpB;AAAC,IAAAkB,QAAA,GAAApK,OAAA,CAAAY,OAAA,GAEciC,WAAW,EAE1B","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_reactIntl","_flat","S","_interopRequireWildcard","exports","Styled","_fareTable","_flexBookingInfo","_emissions","_fares","_timeActive","_departureDate","_enUS","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","defaultMessages","flatten","defaultEnglishMessages","cn","className","arg1","TripDetails","co2Config","DepartureDetails","FareDetails","fareConfig","itinerary","showApproximateMinutesActive","TimeActiveDetails","DefaultTimeActiveDetails","createElement","TripDetailsHeader","id","FormattedMessage","defaultMessage","description","TripDetailsBody","_default"],"sources":["../src/index.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { FormattedMessage } from \"react-intl\";\nimport { flatten } from \"flat\";\nimport * as S from \"./styled\";\nimport FareLegTable from \"./components/fare-table\";\nimport { TripDetailsProps } from \"./types\";\nimport FlexBookingInfo from \"./components/flex-booking-info\";\nimport Emissions from \"./components/emissions\";\nimport Fares from \"./components/fares\";\nimport TimeActive, { DefaultTimeActiveDetails } from \"./components/time-active\";\nimport DepartureDate from \"./components/departure-date\";\n\n// Load the default messages.\nimport defaultEnglishMessages from \"../i18n/en-US.yml\";\n\n// HACK: We should flatten the messages loaded above because\n// the YAML loaders behave differently between webpack and our version of jest:\n// - the yaml loader for webpack returns a nested object,\n// - the yaml loader for jest returns messages with flattened ids.\nconst defaultMessages: Record<string, string> = flatten(defaultEnglishMessages);\n\nfunction cn(className: string, arg1: string): string {\n return className ? `${className} ${arg1}` : arg1;\n}\n\n/**\n * Renders trip details such as departure instructions, fare amount, and minutes active.\n */\nexport function TripDetails({\n className = \"\",\n co2Config,\n DepartureDetails = null,\n FareDetails = null,\n fareConfig,\n itinerary,\n showApproximateMinutesActive,\n TimeActiveDetails = DefaultTimeActiveDetails\n}: TripDetailsProps): ReactElement {\n return (\n <S.TripDetails className={cn(className, \"trip-details\")}>\n {/* this can be presentation as S.TripDetails is already labeled by this */}\n <S.TripDetailsHeader id=\"trip-details-header\">\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.title\"]}\n description=\"Title (heading) text of the component.\"\n id=\"otpUi.TripDetails.title\"\n />\n </S.TripDetailsHeader>\n <S.TripDetailsBody>\n <DepartureDate\n itinerary={itinerary}\n DepartureDetails={DepartureDetails}\n />\n <Fares\n itinerary={itinerary}\n fareConfig={fareConfig}\n FareDetails={FareDetails}\n />\n <TimeActive\n itinerary={itinerary}\n TimeActiveDetails={TimeActiveDetails}\n showApproximateMinutesActive={showApproximateMinutesActive}\n />\n <FlexBookingInfo itinerary={itinerary} />\n <Emissions itinerary={itinerary} co2Config={co2Config} />\n </S.TripDetailsBody>\n </S.TripDetails>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AAyB,CAAE;IAC3DoB,WAAW,EAAC,wCAAwC;IACpDH,EAAE,EAAC;EAAyB,CAC7B,CACkB,CAAC,eACtBrD,MAAA,CAAAsB,OAAA,CAAA6B,aAAA,CAAC9C,CAAC,CAACoD,eAAe,qBAChBzD,MAAA,CAAAsB,OAAA,CAAA6B,aAAA,CAACrC,cAAA,CAAAQ,OAAa;IACZyB,SAAS,EAAEA,SAAU;IACrBH,gBAAgB,EAAEA;EAAiB,CACpC,CAAC,eACF5C,MAAA,CAAAsB,OAAA,CAAA6B,aAAA,CAACvC,MAAA,CAAAU,OAAK;IACJyB,SAAS,EAAEA,SAAU;IACrBD,UAAU,EAAEA,UAAW;IACvBD,WAAW,EAAEA;EAAY,CAC1B,CAAC,eACF7C,MAAA,CAAAsB,OAAA,CAAA6B,aAAA,CAACtC,WAAA,CAAAS,OAAU;IACTyB,SAAS,EAAEA,SAAU;IACrBE,iBAAiB,EAAEA,iBAAkB;IACrCD,4BAA4B,EAAEA;EAA6B,CAC5D,CAAC,eACFhD,MAAA,CAAAsB,OAAA,CAAA6B,aAAA,CAACzC,gBAAA,CAAAY,OAAe;IAACyB,SAAS,EAAEA;EAAU,CAAE,CAAC,eACzC/C,MAAA,CAAAsB,OAAA,CAAA6B,aAAA,CAACxC,UAAA,CAAAW,OAAS;IAACyB,SAAS,EAAEA,SAAU;IAACJ,SAAS,EAAEA;EAAU,CAAE,CACvC,CACN,CAAC;AAEpB;AAAC,IAAAe,QAAA,GAAAnD,OAAA,CAAAe,OAAA,GAEcoB,WAAW,EAE1B","ignoreList":[]}
@@ -1,9 +1,10 @@
1
1
  import { ReactElement } from "react";
2
2
  type Props = {
3
+ className?: string;
3
4
  description?: ReactElement | string;
4
5
  icon: ReactElement;
5
6
  summary: ReactElement | string;
6
7
  };
7
- declare const TripDetail: ({ icon, summary, description }: Props) => JSX.Element;
8
+ declare const TripDetail: ({ icon, summary, description, className }: Props) => JSX.Element;
8
9
  export default TripDetail;
9
10
  //# sourceMappingURL=trip-detail.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trip-detail.d.ts","sourceRoot":"","sources":["../src/trip-detail.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAQtD,KAAK,KAAK,GAAG;IACX,WAAW,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IACpC,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,YAAY,GAAG,MAAM,CAAC;CAChC,CAAC;AAsBF,QAAA,MAAM,UAAU,mCAAoC,KAAK,KAAG,WAmD3D,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"trip-detail.d.ts","sourceRoot":"","sources":["../src/trip-detail.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAQtD,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IACpC,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,YAAY,GAAG,MAAM,CAAC;CAChC,CAAC;AAsBF,QAAA,MAAM,UAAU,8CAKb,KAAK,KAAG,WAmDV,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -33,7 +33,8 @@ function uuidv4() {
33
33
  const TripDetail = ({
34
34
  icon,
35
35
  summary,
36
- description
36
+ description,
37
+ className
37
38
  }) => {
38
39
  const intl = (0, _reactIntl.useIntl)();
39
40
  const [expanded, setExpanded] = (0, _react.useState)(false);
@@ -42,7 +43,8 @@ const TripDetail = ({
42
43
  setExpanded(!expanded);
43
44
  };
44
45
  return /*#__PURE__*/_react.default.createElement(S.TripDetail, {
45
- role: "group"
46
+ role: "group",
47
+ className: className
46
48
  }, /*#__PURE__*/_react.default.createElement(S.TripDetailIcon, {
47
49
  role: "presentation"
48
50
  }, icon), /*#__PURE__*/_react.default.createElement(S.TripDetailSummary, null, summary, description && /*#__PURE__*/_react.default.createElement(S.ExpandButton, {
@@ -1 +1 @@
1
- {"version":3,"file":"trip-detail.js","names":["_react","_interopRequireWildcard","require","_QuestionCircle","_TimesCircle","_reactAnimateHeight","_interopRequireDefault","_reactIntl","S","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","isRunningJest","process","env","JEST_WORKER_ID","undefined","uuidv4","replace","c","Math","random","v","toString","TripDetail","icon","summary","description","intl","useIntl","expanded","setExpanded","useState","id","toggle","createElement","role","TripDetailIcon","TripDetailSummary","ExpandButton","formatMessage","onClick","tabIndex","QuestionCircle","size","duration","height","TripDetailDescription","HideButton","TimesCircle","_default","exports"],"sources":["../src/trip-detail.tsx"],"sourcesContent":["import React, { ReactElement, useState } from \"react\";\nimport { QuestionCircle } from \"@styled-icons/fa-solid/QuestionCircle\";\nimport { TimesCircle } from \"@styled-icons/fa-solid/TimesCircle\";\n\nimport AnimateHeight from \"react-animate-height\";\nimport { useIntl } from \"react-intl\";\nimport * as S from \"./styled\";\n\ntype Props = {\n description?: ReactElement | string;\n icon: ReactElement;\n summary: ReactElement | string;\n};\n\n// TODO: Remove these two helper methods by moving to semantically correct HTML\n/**\n * Copied from https://stackoverflow.com/questions/50940640/how-to-determine-if-jest-is-running-the-code-or-not\n */\nfunction isRunningJest() {\n return process.env.JEST_WORKER_ID !== undefined;\n}\n\nfunction uuidv4(): string {\n if (isRunningJest()) return \"mocked-random-id\";\n\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function(c) {\n // eslint-disable-next-line no-bitwise\n const r = (Math.random() * 16) | 0;\n // eslint-disable-next-line no-bitwise\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\nconst TripDetail = ({ icon, summary, description }: Props): JSX.Element => {\n const intl = useIntl();\n const [expanded, setExpanded] = useState(false);\n\n const id = uuidv4();\n\n const toggle = (): void => {\n setExpanded(!expanded);\n };\n\n return (\n <S.TripDetail role=\"group\">\n <S.TripDetailIcon role=\"presentation\">{icon}</S.TripDetailIcon>\n {/* TODO: Adjust the summary and description to be a `summary`/`details` pair, therefore semantically correct */}\n {/* https://github.com/opentripplanner/otp-ui/pull/530#discussion_r1074006057 */}\n <S.TripDetailSummary>\n {summary}\n {description && (\n <S.ExpandButton\n aria-label={\n expanded\n ? intl.formatMessage({\n id: \"otpUi.TripDetails.hideDetail\"\n })\n : intl.formatMessage({\n id: \"otpUi.TripDetails.showDetail\"\n })\n }\n aria-controls={id}\n aria-expanded={expanded}\n id=\"expand-button\"\n onClick={toggle}\n tabIndex={0}\n >\n <QuestionCircle size=\"0.92em\" />\n </S.ExpandButton>\n )}\n </S.TripDetailSummary>\n <AnimateHeight duration={300} height={expanded ? \"auto\" : 0}>\n <S.TripDetailDescription aria-labelledby=\"expand-button\" id={id}>\n {/** This button isn't needed for screen readers as the main expand-button is\n * more convenient.\n */}\n <S.HideButton role=\"presentation\" onClick={() => setExpanded(false)}>\n <TimesCircle size=\"0.92em\" />\n </S.HideButton>\n {description}\n </S.TripDetailDescription>\n </AnimateHeight>\n </S.TripDetail>\n );\n};\n\nexport default TripDetail;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,mBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,CAAA,GAAAP,uBAAA,CAAAC,OAAA;AAA8B,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CA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,eAAA,CAAAyD,cAAc;IAACC,IAAI,EAAC;EAAQ,CAAE,CACjB,CAEC,CAAC,eACtB7D,MAAA,CAAAe,OAAA,CAAAqC,aAAA,CAAC/C,mBAAA,CAAAU,OAAa;IAAC+C,QAAQ,EAAE,GAAI;IAACC,MAAM,EAAEhB,QAAQ,GAAG,MAAM,GAAG;EAAE,gBAC1D/C,MAAA,CAAAe,OAAA,CAAAqC,aAAA,CAAC5C,CAAC,CAACwD,qBAAqB;IAAC,mBAAgB,eAAe;IAACd,EAAE,EAAEA;EAAG,gBAI9DlD,MAAA,CAAAe,OAAA,CAAAqC,aAAA,CAAC5C,CAAC,CAACyD,UAAU;IAACZ,IAAI,EAAC,cAAc;IAACK,OAAO,EAAEA,CAAA,KAAMV,WAAW,CAAC,KAAK;EAAE,gBAClEhD,MAAA,CAAAe,OAAA,CAAAqC,aAAA,CAAChD,YAAA,CAAA8D,WAAW;IAACL,IAAI,EAAC;EAAQ,CAAE,CAChB,CAAC,EACdjB,WACsB,CACZ,CACH,CAAC;AAEnB,CAAC;AAAC,IAAAuB,QAAA,GAAAC,OAAA,CAAArD,OAAA,GAEa0B,UAAU","ignoreList":[]}
1
+ {"version":3,"file":"trip-detail.js","names":["_react","_interopRequireWildcard","require","_QuestionCircle","_TimesCircle","_reactAnimateHeight","_interopRequireDefault","_reactIntl","S","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","isRunningJest","process","env","JEST_WORKER_ID","undefined","uuidv4","replace","c","Math","random","v","toString","TripDetail","icon","summary","description","className","intl","useIntl","expanded","setExpanded","useState","id","toggle","createElement","role","TripDetailIcon","TripDetailSummary","ExpandButton","formatMessage","onClick","tabIndex","QuestionCircle","size","duration","height","TripDetailDescription","HideButton","TimesCircle","_default","exports"],"sources":["../src/trip-detail.tsx"],"sourcesContent":["import React, { ReactElement, useState } from \"react\";\nimport { QuestionCircle } from \"@styled-icons/fa-solid/QuestionCircle\";\nimport { TimesCircle } from \"@styled-icons/fa-solid/TimesCircle\";\n\nimport AnimateHeight from \"react-animate-height\";\nimport { useIntl } from \"react-intl\";\nimport * as S from \"./styled\";\n\ntype Props = {\n className?: string;\n description?: ReactElement | string;\n icon: ReactElement;\n summary: ReactElement | string;\n};\n\n// TODO: Remove these two helper methods by moving to semantically correct HTML\n/**\n * Copied from https://stackoverflow.com/questions/50940640/how-to-determine-if-jest-is-running-the-code-or-not\n */\nfunction isRunningJest() {\n return process.env.JEST_WORKER_ID !== undefined;\n}\n\nfunction uuidv4(): string {\n if (isRunningJest()) return \"mocked-random-id\";\n\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function(c) {\n // eslint-disable-next-line no-bitwise\n const r = (Math.random() * 16) | 0;\n // eslint-disable-next-line no-bitwise\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\nconst TripDetail = ({\n icon,\n summary,\n description,\n className\n}: Props): JSX.Element => {\n const intl = useIntl();\n const [expanded, setExpanded] = useState(false);\n\n const id = uuidv4();\n\n const toggle = (): void => {\n setExpanded(!expanded);\n };\n\n return (\n <S.TripDetail role=\"group\" className={className}>\n <S.TripDetailIcon role=\"presentation\">{icon}</S.TripDetailIcon>\n {/* TODO: Adjust the summary and description to be a `summary`/`details` pair, therefore semantically correct */}\n {/* https://github.com/opentripplanner/otp-ui/pull/530#discussion_r1074006057 */}\n <S.TripDetailSummary>\n {summary}\n {description && (\n <S.ExpandButton\n aria-label={\n expanded\n ? intl.formatMessage({\n id: \"otpUi.TripDetails.hideDetail\"\n })\n : intl.formatMessage({\n id: \"otpUi.TripDetails.showDetail\"\n })\n }\n aria-controls={id}\n aria-expanded={expanded}\n id=\"expand-button\"\n onClick={toggle}\n tabIndex={0}\n >\n <QuestionCircle size=\"0.92em\" />\n </S.ExpandButton>\n )}\n </S.TripDetailSummary>\n <AnimateHeight duration={300} height={expanded ? \"auto\" : 0}>\n <S.TripDetailDescription aria-labelledby=\"expand-button\" id={id}>\n {/** This button isn't needed for screen readers as the main expand-button is\n * more convenient.\n */}\n <S.HideButton role=\"presentation\" onClick={() => setExpanded(false)}>\n <TimesCircle size=\"0.92em\" />\n </S.HideButton>\n {description}\n </S.TripDetailDescription>\n </AnimateHeight>\n </S.TripDetail>\n );\n};\n\nexport default TripDetail;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,mBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,CAAA,GAAAP,uBAAA,CAAAC,OAAA;AAA8B,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAA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AAK;EAAE,gBAClEjD,MAAA,CAAAe,OAAA,CAAAsC,aAAA,CAACjD,YAAA,CAAA+D,WAAW;IAACL,IAAI,EAAC;EAAQ,CAAE,CAChB,CAAC,EACdlB,WACsB,CACZ,CACH,CAAC;AAEnB,CAAC;AAAC,IAAAwB,QAAA,GAAAC,OAAA,CAAAtD,OAAA,GAEa0B,UAAU","ignoreList":[]}
package/lib/types.d.ts CHANGED
@@ -39,6 +39,24 @@ export interface FareDetailsProps {
39
39
  maxTNCFare: number;
40
40
  minTNCFare: number;
41
41
  }
42
+ export interface FareConfig {
43
+ /**
44
+ * Determines which transit fare should be displayed by default, should there be multiple transit fare types.
45
+ */
46
+ defaultFareType?: {
47
+ headerKey: string;
48
+ } & FareProductSelector;
49
+ /**
50
+ * Column and table configuration for fare details/fare by leg table.
51
+ */
52
+ fareDetailsLayout?: FareTableLayout[];
53
+ /**
54
+ * Mapping between fare keys and human-readable names for them.
55
+ */
56
+ fareKeyNameMap?: {
57
+ [name: string]: string;
58
+ };
59
+ }
42
60
  export interface TripDetailsProps {
43
61
  /**
44
62
  * Used for additional styling with styled components for example.
@@ -48,35 +66,18 @@ export interface TripDetailsProps {
48
66
  * Object containing the CO₂ config.
49
67
  */
50
68
  co2Config?: CO2ConfigType;
51
- /**
52
- * Determines which transit fare should be displayed by default, should there be multiple transit fare types.
53
- */
54
- defaultFareType?: {
55
- headerKey: string;
56
- } & FareProductSelector;
57
69
  /**
58
70
  * Slot for a custom component to render the expandable section for departure.
59
71
  */
60
72
  DepartureDetails?: React.ElementType<DepartureDetailsProps>;
61
- /**
62
- * If this is set to true, a row will be added to the trip details displaying how
63
- * many minutes in total the user will spend walking or biking.
64
- */
65
- displayTimeActive?: boolean;
66
73
  /**
67
74
  * Slot for a custom component to render the expandable section for fares.
68
75
  */
69
76
  FareDetails?: React.ElementType<FareDetailsProps>;
70
77
  /**
71
- * Column and table configuration for fare details/fare by leg table.
72
- */
73
- fareDetailsLayout?: FareTableLayout[];
74
- /**
75
- * Mapping between fare keys and human-readable names for them.
78
+ * Configuration for fare details/fare by leg table.
76
79
  */
77
- fareKeyNameMap?: {
78
- [name: string]: string;
79
- };
80
+ fareConfig?: FareConfig;
80
81
  /**
81
82
  * Itinerary that the user has selected to view, contains multiple legs.
82
83
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,SAAS,EACT,GAAG,EACH,cAAc,EACd,KAAK,EACL,MAAM,wBAAwB,CAAC;AAEjC,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,IAAI,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,CAAC,mBAAmB,GAAG;QAC3B,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC,EAAE,CAAA;IACJ,SAAS,EAAE,MAAM,CAAC;CACnB;AACD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;IAC3B,IAAI,EAAE,GAAG,EAAE,CAAC;CACb;AAGD,MAAM,MAAM,UAAU,GAAG,CAAC,mBAAmB,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC,EAAE,CAAA;AAEnE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CA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AS,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC;;OAEG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;CAC/D"}
package/lib/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["// Prettier does not recognize the import type syntax.\n// eslint-disable-next-line prettier/prettier\nimport type { \n FareProductSelector, \n Itinerary, \n Leg, \n MassUnitOption,\n Money\n } from \"@opentripplanner/types\";\n\nexport interface TimeActiveDetailsProps {\n bikeMinutes: number;\n minutesActive?: number;\n walkMinutes: number;\n}\n\nexport interface CO2ConfigType {\n carbonIntensity?: Record<string, number>;\n units?: MassUnitOption;\n enabled?: boolean;\n}\n\nexport interface DepartureDetailsProps {\n departureDate: Date;\n}\n\n/**\n * This is the interface used to define the layout for a particular fare table.\n * The table with be rendered with the columns defined here,\n * with each row being an individual transit leg from the itinerary.\n */\nexport interface FareTableLayout {\n cols: (FareProductSelector & {\n columnHeaderKey: string;\n })[]\n headerKey: string;\n}\n/**\n * Interface containing the lgs and the layout of the fare table.\n */\nexport interface FareLegTableProps {\n layout?: FareTableLayout[];\n legs: Leg[];\n}\n\n// Total fare amount corresponding to a fare key\nexport type FareTotals = (FareProductSelector & { price: Money })[]\n\nexport interface FareDetailsProps {\n legs: Leg[];\n maxTNCFare: number;\n minTNCFare: number;\n}\n\n\nexport interface TripDetailsProps {\n /**\n * Used for additional styling with styled components for example.\n */\n className?: string;\n /**\n * Object containing the CO₂ config.\n */\n co2Config?: CO2ConfigType;\n /**\n * Determines which transit fare should be displayed by default, should there be multiple transit fare types.\n */\n defaultFareType?: { headerKey: string } & FareProductSelector;\n /**\n * Slot for a custom component to render the expandable section for departure.\n */\n DepartureDetails?: React.ElementType<DepartureDetailsProps>;\n /**\n * If this is set to true, a row will be added to the trip details displaying how\n * many minutes in total the user will spend walking or biking.\n */\n displayTimeActive?: boolean;\n /**\n * Slot for a custom component to render the expandable section for fares.\n */\n FareDetails?: React.ElementType<FareDetailsProps>;\n /**\n * Column and table configuration for fare details/fare by leg table.\n */\n fareDetailsLayout?: FareTableLayout[];\n /**\n * Mapping between fare keys and human-readable names for them.\n */\n fareKeyNameMap?: {\n [name: string]: string;\n };\n /**\n * Itinerary that the user has selected to view, contains multiple legs.\n */\n itinerary: Itinerary;\n /**\n * show the '~' symbol in the trip details panel\n */\n showApproximateMinutesActive?: boolean;\n /**\n * Slot for a custom component to render the expandable section for time active.\n */\n TimeActiveDetails?: React.ElementType<TimeActiveDetailsProps>;\n}"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["// Prettier does not recognize the import type syntax.\n// eslint-disable-next-line prettier/prettier\nimport type { \n FareProductSelector, \n Itinerary, \n Leg, \n MassUnitOption,\n Money\n } from \"@opentripplanner/types\";\n\nexport interface TimeActiveDetailsProps {\n bikeMinutes: number;\n minutesActive?: number;\n walkMinutes: number;\n}\n\nexport interface CO2ConfigType {\n carbonIntensity?: Record<string, number>;\n units?: MassUnitOption;\n enabled?: boolean;\n}\n\nexport interface DepartureDetailsProps {\n departureDate: Date;\n}\n\n/**\n * This is the interface used to define the layout for a particular fare table.\n * The table with be rendered with the columns defined here,\n * with each row being an individual transit leg from the itinerary.\n */\nexport interface FareTableLayout {\n cols: (FareProductSelector & {\n columnHeaderKey: string;\n })[]\n headerKey: string;\n}\n/**\n * Interface containing the lgs and the layout of the fare table.\n */\nexport interface FareLegTableProps {\n layout?: FareTableLayout[];\n legs: Leg[];\n}\n\n// Total fare amount corresponding to a fare key\nexport type FareTotals = (FareProductSelector & { price: Money })[]\n\nexport interface FareDetailsProps {\n legs: Leg[];\n maxTNCFare: number;\n minTNCFare: number;\n}\n\nexport interface FareConfig {\n /**\n * Determines which transit fare should be displayed by default, should there be multiple transit fare types.\n */\n defaultFareType?: { headerKey: string } & FareProductSelector;\n /**\n * Column and table configuration for fare details/fare by leg table.\n */\n fareDetailsLayout?: FareTableLayout[];\n /**\n * Mapping between fare keys and human-readable names for them.\n */\n fareKeyNameMap?: {\n [name: string]: string;\n };\n}\n\nexport interface TripDetailsProps {\n /**\n * Used for additional styling with styled components for example.\n */\n className?: string;\n /**\n * Object containing the CO₂ config.\n */\n co2Config?: CO2ConfigType;\n /**\n * Slot for a custom component to render the expandable section for departure.\n */\n DepartureDetails?: React.ElementType<DepartureDetailsProps>;\n /**\n * Slot for a custom component to render the expandable section for fares.\n */\n FareDetails?: React.ElementType<FareDetailsProps>;\n /**\n * Configuration for fare details/fare by leg table.\n */\n fareConfig?: FareConfig;\n /**\n * Itinerary that the user has selected to view, contains multiple legs.\n */\n itinerary: Itinerary;\n /**\n * show the '~' symbol in the trip details panel\n */\n showApproximateMinutesActive?: boolean;\n /**\n * Slot for a custom component to render the expandable section for time active.\n */\n TimeActiveDetails?: React.ElementType<TimeActiveDetailsProps>;\n}"],"mappings":"","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentripplanner/trip-details",
3
- "version": "7.0.0",
3
+ "version": "8.0.0",
4
4
  "description": "A component for displaying details about a trip planning itinerary",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",
@@ -14,11 +14,11 @@
14
14
  "@styled-icons/fa-solid": "^10.34.0",
15
15
  "flat": "^5.0.2",
16
16
  "react-animate-height": "^3.0.4",
17
- "@opentripplanner/core-utils": "13.0.0"
17
+ "@opentripplanner/core-utils": "13.0.1"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@types/flat": "^5.0.2",
21
- "@opentripplanner/types": "6.5.2"
21
+ "@opentripplanner/types": "6.5.3"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": "^18.2.0",