@opentripplanner/trip-details 9.1.3 → 9.2.1

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/lib/index.js CHANGED
@@ -47,6 +47,7 @@ function TripDetails({
47
47
  DepartureDetails = null,
48
48
  FareDetails = null,
49
49
  itinerary,
50
+ mediumRiderWhitelist,
50
51
  showApproximateMinutesActive,
51
52
  TimeActiveDetails = _timeActive.DefaultTimeActiveDetails
52
53
  }) {
@@ -64,7 +65,8 @@ function TripDetails({
64
65
  }), /*#__PURE__*/_react.default.createElement(_fares.default, {
65
66
  itinerary: itinerary,
66
67
  FareDetails: FareDetails,
67
- defaultFareType: defaultFareType
68
+ defaultFareType: defaultFareType,
69
+ mediumRiderWhitelist: mediumRiderWhitelist
68
70
  }), /*#__PURE__*/_react.default.createElement(_timeActive.default, {
69
71
  itinerary: itinerary,
70
72
  TimeActiveDetails: TimeActiveDetails,
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_reactIntl","_flat","S","_interopRequireWildcard","exports","Styled","_flexBookingInfo","_faresV2Table","_emissions","_fares","_timeActive","_departureDate","_enUS","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","defaultMessages","flatten","defaultEnglishMessages","cn","className","arg1","TripDetails","co2Config","defaultFareType","DepartureDetails","FareDetails","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 { TripDetailsProps } from \"./types\";\nimport FlexBookingInfo from \"./components/flex-booking-info\";\nimport FaresV2Table from \"./components/fares-v2-table\";\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 defaultFareType,\n DepartureDetails = null,\n FareDetails = null,\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\n <S.TripDetailsBody>\n <DepartureDate\n itinerary={itinerary}\n DepartureDetails={DepartureDetails}\n />\n <Fares\n itinerary={itinerary}\n FareDetails={FareDetails}\n defaultFareType={defaultFareType}\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>\n );\n}\n\nexport default TripDetails;\n\n// Rename styled components for export.\nexport { S as Styled, FaresV2Table };\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAA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AAgB,EAAEA;EAAiB,CACpC,CAAC,eACF5C,MAAA,CAAA0B,OAAA,CAAAwB,aAAA,CAACtC,MAAA,CAAAc,OAAK;IACJoB,SAAS,EAAEA,SAAU;IACrBD,WAAW,EAAEA,WAAY;IACzBF,eAAe,EAAEA;EAAgB,CAClC,CAAC,eACF3C,MAAA,CAAA0B,OAAA,CAAAwB,aAAA,CAACrC,WAAA,CAAAa,OAAU;IACToB,SAAS,EAAEA,SAAU;IACrBE,iBAAiB,EAAEA,iBAAkB;IACrCD,4BAA4B,EAAEA;EAA6B,CAC5D,CAAC,eACF/C,MAAA,CAAA0B,OAAA,CAAAwB,aAAA,CAACzC,gBAAA,CAAAiB,OAAe;IAACoB,SAAS,EAAEA;EAAU,CAAE,CAAC,eACzC9C,MAAA,CAAA0B,OAAA,CAAAwB,aAAA,CAACvC,UAAA,CAAAe,OAAS;IAACoB,SAAS,EAAEA,SAAU;IAACJ,SAAS,EAAEA;EAAU,CAAE,CACvC,CACN,CAAC;AAEpB;AAAC,IAAAe,QAAA,GAAAlD,OAAA,CAAAmB,OAAA,GAEce,WAAW,EAE1B","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_reactIntl","_flat","S","_interopRequireWildcard","exports","Styled","_flexBookingInfo","_faresV2Table","_emissions","_fares","_timeActive","_departureDate","_enUS","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","defaultMessages","flatten","defaultEnglishMessages","cn","className","arg1","TripDetails","co2Config","defaultFareType","DepartureDetails","FareDetails","itinerary","mediumRiderWhitelist","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 { TripDetailsProps } from \"./types\";\nimport FlexBookingInfo from \"./components/flex-booking-info\";\nimport FaresV2Table from \"./components/fares-v2-table\";\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 defaultFareType,\n DepartureDetails = null,\n FareDetails = null,\n itinerary,\n mediumRiderWhitelist,\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\n <S.TripDetailsBody>\n <DepartureDate\n itinerary={itinerary}\n DepartureDetails={DepartureDetails}\n />\n <Fares\n itinerary={itinerary}\n FareDetails={FareDetails}\n defaultFareType={defaultFareType}\n mediumRiderWhitelist={mediumRiderWhitelist}\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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A0B,OAAA,CAAAyB,aAAA,CAAC9C,CAAC,CAACoD,eAAe,qBAChBzD,MAAA,CAAA0B,OAAA,CAAAyB,aAAA,CAACrC,cAAA,CAAAY,OAAa;IACZoB,SAAS,EAAEA,SAAU;IACrBF,gBAAgB,EAAEA;EAAiB,CACpC,CAAC,eACF5C,MAAA,CAAA0B,OAAA,CAAAyB,aAAA,CAACvC,MAAA,CAAAc,OAAK;IACJoB,SAAS,EAAEA,SAAU;IACrBD,WAAW,EAAEA,WAAY;IACzBF,eAAe,EAAEA,eAAgB;IACjCI,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC,eACF/C,MAAA,CAAA0B,OAAA,CAAAyB,aAAA,CAACtC,WAAA,CAAAa,OAAU;IACToB,SAAS,EAAEA,SAAU;IACrBG,iBAAiB,EAAEA,iBAAkB;IACrCD,4BAA4B,EAAEA;EAA6B,CAC5D,CAAC,eACFhD,MAAA,CAAA0B,OAAA,CAAAyB,aAAA,CAAC1C,gBAAA,CAAAiB,OAAe;IAACoB,SAAS,EAAEA;EAAU,CAAE,CAAC,eACzC9C,MAAA,CAAA0B,OAAA,CAAAyB,aAAA,CAACxC,UAAA,CAAAe,OAAS;IAACoB,SAAS,EAAEA,SAAU;IAACJ,SAAS,EAAEA;EAAU,CAAE,CACvC,CACN,CAAC;AAEpB;AAAC,IAAAgB,QAAA,GAAAnD,OAAA,CAAAmB,OAAA,GAEce,WAAW,EAE1B","ignoreList":[]}
package/lib/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { FareProductSelector, Itinerary, Leg, MassUnitOption, Money } from "@opentripplanner/types";
1
+ import type { FareProductSelector, Itinerary, Leg, MassUnitOption, MediumRiderWhitelist, Money } from "@opentripplanner/types";
2
2
  export interface TimeActiveDetailsProps {
3
3
  bikeMinutes: number;
4
4
  minutesActive?: number;
@@ -45,6 +45,10 @@ export interface TripDetailsProps {
45
45
  * Itinerary that the user has selected to view, contains multiple legs.
46
46
  */
47
47
  itinerary: Itinerary;
48
+ /**
49
+ * A whitelist of medium-rider pairs to be shown. All others will be hidden.
50
+ */
51
+ mediumRiderWhitelist?: MediumRiderWhitelist;
48
52
  /**
49
53
  * show the '~' symbol in the trip details panel
50
54
  */
@@ -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;AAID,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,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACjB;;KAEC;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;OAEG;IACH,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAC5D;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAA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;IAC5D;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAClD;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C;;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// 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 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?: FareProductSelector;\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 * 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 MediumRiderWhitelist,\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// 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 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?: FareProductSelector;\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 * Itinerary that the user has selected to view, contains multiple legs.\n */\n itinerary: Itinerary;\n /**\n * A whitelist of medium-rider pairs to be shown. All others will be hidden.\n */\n mediumRiderWhitelist?: MediumRiderWhitelist;\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,11 +1,14 @@
1
1
  {
2
2
  "name": "@opentripplanner/trip-details",
3
- "version": "9.1.3",
3
+ "version": "9.2.1",
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",
7
7
  "types": "lib/index.d.js",
8
- "repository": "https://github.com/opentripplanner/otp-ui.git",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/opentripplanner/otp-ui.git"
11
+ },
9
12
  "homepage": "https://github.com/opentripplanner/otp-ui#readme",
10
13
  "author": "Evan Siroky",
11
14
  "license": "MIT",
@@ -15,10 +18,10 @@
15
18
  "@styled-icons/fa-solid": "^10.34.0",
16
19
  "flat": "^5.0.2",
17
20
  "react-animate-height": "^3.0.4",
18
- "@opentripplanner/core-utils": "^16.0.3"
21
+ "@opentripplanner/core-utils": "^16.3.0"
19
22
  },
20
23
  "devDependencies": {
21
- "@opentripplanner/types": "^8.4.0"
24
+ "@opentripplanner/types": "^8.7.1"
22
25
  },
23
26
  "peerDependencies": {
24
27
  "react": "^18.2.0",
@@ -90,8 +90,9 @@ function createTripDetailsTemplate(
90
90
  DepartureDetails,
91
91
  FareDetails,
92
92
  itinerary,
93
- TimeActiveDetails,
94
- showApproximateMinutesActive
93
+ mediumRiderWhitelist,
94
+ showApproximateMinutesActive,
95
+ TimeActiveDetails
95
96
  }: TripDetailsProps): ReactElement => {
96
97
  return (
97
98
  <Component
@@ -100,6 +101,7 @@ function createTripDetailsTemplate(
100
101
  DepartureDetails={DepartureDetails}
101
102
  FareDetails={FareDetails}
102
103
  itinerary={itinerary}
104
+ mediumRiderWhitelist={mediumRiderWhitelist}
103
105
  showApproximateMinutesActive={showApproximateMinutesActive}
104
106
  TimeActiveDetails={TimeActiveDetails}
105
107
  />
@@ -166,6 +168,16 @@ export const LegFareProductsItinerary = makeStory({
166
168
  defaultFareType: { mediumId: "electronic", riderCategoryId: "regular" }
167
169
  });
168
170
 
171
+ // export const LegFareProductsWithSpecialFareTableFeatures = makeStory({
172
+ // itinerary: TODO: MISSING DATA!,
173
+ // defaultFareType: { mediumId: "electronic", riderCategoryId: "regular" },
174
+ // showApproximateMinutesActive: true,
175
+ // mediumRiderWhitelist: [
176
+ // { medium: "electronic", rider: "regular" },
177
+ // { medium: "electronic", rider: "senior" }
178
+ // ]
179
+ // });
180
+
169
181
  // The render of this itinerary is uninteresting, but the test
170
182
  // is if we can parse an OTP2 itinerary without crashing
171
183
  export const OTP2EScooterRentalTransitItinerary = makeStory({
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-underscore-dangle */
2
2
  import React from "react";
3
- import { Leg } from "@opentripplanner/types";
3
+ import { Leg, MediumRiderWhitelist } from "@opentripplanner/types";
4
4
  import coreUtils from "@opentripplanner/core-utils";
5
5
  import { FormattedMessage, useIntl } from "react-intl";
6
6
  import styled from "styled-components";
@@ -72,15 +72,16 @@ const categorySorter = (favoriteId?: string) => (
72
72
  return aId > bId ? 1 : -1;
73
73
  };
74
74
 
75
- // TODO: This component currently can only show one type of fare per medium
76
75
  const FaresV2Table = ({
77
76
  legs,
78
77
  favoriteMediumId,
79
- favoriteRiderCategoryId
78
+ favoriteRiderCategoryId,
79
+ mediumRiderWhitelist
80
80
  }: {
81
81
  legs: Leg[];
82
82
  favoriteMediumId?: string;
83
83
  favoriteRiderCategoryId?: string;
84
+ mediumRiderWhitelist?: MediumRiderWhitelist;
84
85
  }): JSX.Element => {
85
86
  const intl = useIntl();
86
87
 
@@ -114,6 +115,13 @@ const FaresV2Table = ({
114
115
  fp.product?.riderCategory?.id === rmp.rider?.id &&
115
116
  fp.product?.medium?.id === rmp.medium?.id
116
117
  )
118
+ )
119
+ .filter(
120
+ pair =>
121
+ !mediumRiderWhitelist ||
122
+ mediumRiderWhitelist?.find(
123
+ p => p.medium === pair.medium?.id && p.rider === pair.rider?.id
124
+ )
117
125
  );
118
126
 
119
127
  // Ensure we have at least one rider/medium
@@ -124,7 +132,7 @@ const FaresV2Table = ({
124
132
  mediums.push({ name: "Regular", id: null });
125
133
  }
126
134
 
127
- // Keep track of seen fare ids to indicate transfers
135
+ // Keep track of seen fare ids to indicate transfers.
128
136
  const productUseIds: Set<string> = new Set();
129
137
 
130
138
  const rows = [
@@ -136,7 +144,7 @@ const FaresV2Table = ({
136
144
  </th>,
137
145
  ...transitLegs.map(leg => (
138
146
  <th key={leg.tripId} scope="col">
139
- {getLegRouteName(leg)}
147
+ {getLegRouteName(leg, intl)}
140
148
  </th>
141
149
  )),
142
150
  transitLegs.length > 1 ? (
@@ -1,7 +1,11 @@
1
1
  import React, { ReactElement } from "react";
2
2
  import { FormattedMessage } from "react-intl";
3
3
  import coreUtils from "@opentripplanner/core-utils";
4
- import { FareProductSelector, Itinerary } from "@opentripplanner/types";
4
+ import {
5
+ FareProductSelector,
6
+ Itinerary,
7
+ MediumRiderWhitelist
8
+ } from "@opentripplanner/types";
5
9
  import { MoneyBillAlt } from "@styled-icons/fa-solid";
6
10
  import { flatten } from "flat";
7
11
  import * as S from "../styled";
@@ -17,6 +21,7 @@ export interface FaresProps {
17
21
  itinerary: Itinerary;
18
22
  FareDetails?: React.ElementType<FareDetailsProps>;
19
23
  defaultFareType?: FareProductSelector;
24
+ mediumRiderWhitelist?: MediumRiderWhitelist;
20
25
  }
21
26
 
22
27
  // HACK: We should flatten the messages loaded above because
@@ -28,7 +33,8 @@ const defaultMessages: Record<string, string> = flatten(defaultEnglishMessages);
28
33
  export default function Fares({
29
34
  itinerary,
30
35
  FareDetails,
31
- defaultFareType
36
+ defaultFareType,
37
+ mediumRiderWhitelist
32
38
  }: FaresProps): ReactElement | null {
33
39
  // process the transit fare
34
40
  const fareResult = coreUtils.itinerary.calculateTncFares(itinerary);
@@ -99,6 +105,7 @@ export default function Fares({
99
105
  </summary>
100
106
  <FaresV2Table
101
107
  legs={itinerary.legs}
108
+ mediumRiderWhitelist={mediumRiderWhitelist}
102
109
  favoriteMediumId={
103
110
  Array.isArray(defaultFareType?.mediumId)
104
111
  ? defaultFareType?.mediumId[0]
package/src/index.tsx CHANGED
@@ -33,6 +33,7 @@ export function TripDetails({
33
33
  DepartureDetails = null,
34
34
  FareDetails = null,
35
35
  itinerary,
36
+ mediumRiderWhitelist,
36
37
  showApproximateMinutesActive,
37
38
  TimeActiveDetails = DefaultTimeActiveDetails
38
39
  }: TripDetailsProps): ReactElement {
@@ -56,6 +57,7 @@ export function TripDetails({
56
57
  itinerary={itinerary}
57
58
  FareDetails={FareDetails}
58
59
  defaultFareType={defaultFareType}
60
+ mediumRiderWhitelist={mediumRiderWhitelist}
59
61
  />
60
62
  <TimeActive
61
63
  itinerary={itinerary}
package/src/types.ts CHANGED
@@ -5,6 +5,7 @@ import type {
5
5
  Itinerary,
6
6
  Leg,
7
7
  MassUnitOption,
8
+ MediumRiderWhitelist,
8
9
  Money
9
10
  } from "@opentripplanner/types";
10
11
 
@@ -59,6 +60,10 @@ export interface TripDetailsProps {
59
60
  * Itinerary that the user has selected to view, contains multiple legs.
60
61
  */
61
62
  itinerary: Itinerary;
63
+ /**
64
+ * A whitelist of medium-rider pairs to be shown. All others will be hidden.
65
+ */
66
+ mediumRiderWhitelist?: MediumRiderWhitelist;
62
67
  /**
63
68
  * show the '~' symbol in the trip details panel
64
69
  */
package/tsconfig.json CHANGED
@@ -4,7 +4,6 @@
4
4
  "composite": true,
5
5
  "outDir": "./lib",
6
6
  "rootDir": "./src",
7
- "target": "ES2019",
8
7
  "skipLibCheck": true
9
8
  },
10
9
  "include": ["src/**/*"],