@opentripplanner/trip-details 9.2.0 → 9.3.0-alpha.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.
Files changed (53) hide show
  1. package/esm/components/departure-date.js +18 -8
  2. package/esm/components/departure-date.js.map +1 -1
  3. package/esm/components/fares-v2-table.js +7 -3
  4. package/esm/components/fares-v2-table.js.map +1 -1
  5. package/esm/components/fares.js +3 -1
  6. package/esm/components/fares.js.map +1 -1
  7. package/esm/components/time-active.js +2 -2
  8. package/esm/components/time-active.js.map +1 -1
  9. package/esm/components/transit-time.js +36 -0
  10. package/esm/components/transit-time.js.map +1 -0
  11. package/esm/index.js +18 -5
  12. package/esm/index.js.map +1 -1
  13. package/esm/types.js.map +1 -1
  14. package/i18n/en-US.yml +6 -0
  15. package/i18n/fr.yml +6 -0
  16. package/lib/components/departure-date.d.ts +3 -2
  17. package/lib/components/departure-date.d.ts.map +1 -1
  18. package/lib/components/departure-date.js +18 -8
  19. package/lib/components/departure-date.js.map +1 -1
  20. package/lib/components/fares-v2-table.d.ts +3 -2
  21. package/lib/components/fares-v2-table.d.ts.map +1 -1
  22. package/lib/components/fares-v2-table.js +6 -4
  23. package/lib/components/fares-v2-table.js.map +1 -1
  24. package/lib/components/fares.d.ts +3 -2
  25. package/lib/components/fares.d.ts.map +1 -1
  26. package/lib/components/fares.js +3 -1
  27. package/lib/components/fares.js.map +1 -1
  28. package/lib/components/time-active.d.ts +3 -3
  29. package/lib/components/time-active.d.ts.map +1 -1
  30. package/lib/components/time-active.js +2 -2
  31. package/lib/components/time-active.js.map +1 -1
  32. package/lib/components/transit-time.d.ts +7 -0
  33. package/lib/components/transit-time.d.ts.map +1 -0
  34. package/lib/components/transit-time.js +40 -0
  35. package/lib/components/transit-time.js.map +1 -0
  36. package/lib/index.d.ts +1 -1
  37. package/lib/index.d.ts.map +1 -1
  38. package/lib/index.js +16 -5
  39. package/lib/index.js.map +1 -1
  40. package/lib/types.d.ts +15 -1
  41. package/lib/types.d.ts.map +1 -1
  42. package/lib/types.js.map +1 -1
  43. package/package.json +3 -3
  44. package/src/TripDetails.story.tsx +40 -5
  45. package/src/__snapshots__/TripDetails.story.tsx.snap +313 -0
  46. package/src/components/departure-date.tsx +24 -13
  47. package/src/components/fares-v2-table.tsx +11 -3
  48. package/src/components/fares.tsx +9 -2
  49. package/src/components/time-active.tsx +4 -4
  50. package/src/components/transit-time.tsx +40 -0
  51. package/src/index.tsx +16 -3
  52. package/src/types.ts +20 -5
  53. package/tsconfig.tsbuildinfo +1 -1
@@ -15,9 +15,14 @@ import defaultEnglishMessages from "../../i18n/en-US.yml";
15
15
  // - the yaml loader for jest returns messages with flattened ids.
16
16
  var defaultMessages = flatten(defaultEnglishMessages);
17
17
  export default function DepartureDate(_ref) {
18
- var itinerary = _ref.itinerary,
19
- DepartureDetails = _ref.DepartureDetails;
20
- var departureDate = new Date(itinerary.startTime);
18
+ var startTime = _ref.startTime,
19
+ DepartureDetails = _ref.DepartureDetails,
20
+ isBoarding = _ref.isBoarding;
21
+ var departureDate = new Date(startTime);
22
+ var values = {
23
+ departureDate: departureDate,
24
+ strong: boldText
25
+ };
21
26
  return /*#__PURE__*/React.createElement(TripDetail, {
22
27
  className: "departure-date"
23
28
  // Any custom description for the Departure message needs to be handled by the slot.
@@ -28,14 +33,19 @@ export default function DepartureDate(_ref) {
28
33
  icon: /*#__PURE__*/React.createElement(CalendarAlt, {
29
34
  size: 17
30
35
  }),
31
- summary: /*#__PURE__*/React.createElement(S.Timing, null, /*#__PURE__*/React.createElement(FormattedMessage, {
36
+ summary:
37
+ /*#__PURE__*/
38
+ // TODO: is there a way to do this without `isBoarding`?
39
+ React.createElement(S.Timing, null, isBoarding ? /*#__PURE__*/React.createElement(FormattedMessage, {
40
+ defaultMessage: defaultMessages["otpUi.TripDetails.boarding"],
41
+ description: "Text showing when to board the first transit leg.",
42
+ id: "otpUi.TripDetails.boarding",
43
+ values: values
44
+ }) : /*#__PURE__*/React.createElement(FormattedMessage, {
32
45
  defaultMessage: defaultMessages["otpUi.TripDetails.departure"],
33
46
  description: "Text showing the departure date/time for a trip.",
34
47
  id: "otpUi.TripDetails.departure",
35
- values: {
36
- departureDate: departureDate,
37
- strong: boldText
38
- }
48
+ values: values
39
49
  }))
40
50
  });
41
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"departure-date.js","names":["React","FormattedMessage","CalendarAlt","flatten","boldText","TripDetail","S","defaultEnglishMessages","defaultMessages","DepartureDate","_ref","itinerary","DepartureDetails","departureDate","Date","startTime","createElement","className","description","icon","size","summary","Timing","defaultMessage","id","values","strong"],"sources":["../../src/components/departure-date.tsx"],"sourcesContent":["import { Itinerary } from \"@opentripplanner/types\";\nimport React, { ReactElement } from \"react\";\nimport { FormattedMessage } from \"react-intl\";\nimport { CalendarAlt } from \"@styled-icons/fa-solid/CalendarAlt\";\nimport flatten from \"flat\";\nimport { boldText } from \"../utils\";\nimport { DepartureDetailsProps } from \"../types\";\nimport TripDetail from \"../trip-detail\";\nimport * as S from \"../styled\";\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\ninterface DepartureDateProps {\n itinerary: Itinerary;\n DepartureDetails?: React.ElementType<DepartureDetailsProps>;\n}\n\nexport default function DepartureDate({\n itinerary,\n DepartureDetails\n}: DepartureDateProps): ReactElement {\n const departureDate = new Date(itinerary.startTime);\n return (\n <TripDetail\n className=\"departure-date\"\n // Any custom description for the Departure message needs to be handled by the slot.\n description={\n DepartureDetails && <DepartureDetails departureDate={departureDate} />\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 tr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CACO;EACX,CACF,CAAC;AAEN","ignoreList":[]}
1
+ {"version":3,"file":"departure-date.js","names":["React","FormattedMessage","CalendarAlt","flatten","boldText","TripDetail","S","defaultEnglishMessages","defaultMessages","DepartureDate","_ref","startTime","DepartureDetails","isBoarding","departureDate","Date","values","strong","createElement","className","description","icon","size","summary","Timing","defaultMessage","id"],"sources":["../../src/components/departure-date.tsx"],"sourcesContent":["import { Itinerary } from \"@opentripplanner/types\";\nimport React, { ReactElement } from \"react\";\nimport { FormattedMessage } from \"react-intl\";\nimport { CalendarAlt } from \"@styled-icons/fa-solid/CalendarAlt\";\nimport flatten from \"flat\";\nimport { boldText } from \"../utils\";\nimport { DepartureDetailsProps } from \"../types\";\nimport TripDetail from \"../trip-detail\";\nimport * as S from \"../styled\";\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\ninterface DepartureDateProps {\n startTime: Itinerary[\"startTime\"];\n DepartureDetails?: React.ElementType<DepartureDetailsProps>;\n isBoarding: boolean;\n}\n\nexport default function DepartureDate({\n startTime,\n DepartureDetails,\n isBoarding\n}: DepartureDateProps): ReactElement {\n const departureDate = new Date(startTime);\n const values = { departureDate, strong: boldText };\n\n return (\n <TripDetail\n className=\"departure-date\"\n // Any custom description for the Departure message needs to be handled by the slot.\n description={\n DepartureDetails && <DepartureDetails departureDate={departureDate} />\n }\n icon={<CalendarAlt size={17} />}\n summary={\n // TODO: is there a way to do this without `isBoarding`?\n <S.Timing>\n {isBoarding ? (\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.boarding\"]}\n description=\"Text showing when to board the first transit leg.\"\n id=\"otpUi.TripDetails.boarding\"\n values={values}\n />\n ) : (\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={values}\n />\n )}\n </S.Timing>\n }\n />\n );\n}\n"],"mappings":"AACA,OAAOA,KAAK,MAAwB,OAAO;AAC3C,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,WAAW,QAAQ,oCAAoC;AAChE,OAAOC,OAAO,MAAM,MAAM;AAC1B,SAASC,QAAQ,QAAQ,UAAU;AAEnC,OAAOC,UAAU,MAAM,gBAAgB;AACvC,OAAO,KAAKC,CAAC,MAAM,WAAW;;AAE9B;AACA,OAAOC,sBAAsB,MAAM,sBAAsB;;AAEzD;AACA;AACA;AACA;AACA,IAAMC,eAAuC,GAAGL,OAAO,CAACI,sBAAsB,CAAC;AAQ/E,eAAe,SAASE,aAAaA,CAAAC,IAAA,EAIA;EAAA,IAHnCC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,gBAAgB,GAAAF,IAAA,CAAhBE,gBAAgB;IAChBC,UAAU,GAAAH,IAAA,CAAVG,UAAU;EAEV,IAAMC,aAAa,GAAG,IAAIC,IAAI,CAACJ,SAAS,CAAC;EACzC,IAAMK,MAAM,GAAG;IAAEF,aAAa,EAAbA,aAAa;IAAEG,MAAM,EAAEb;EAAS,CAAC;EAElD,oBACEJ,KAAA,CAAAkB,aAAA,CAACb,UAAU;IACTc,SAAS,EAAC;IACV;IAAA;IACAC,WAAW,EACTR,gBAAgB,iBAAIZ,KAAA,CAAAkB,aAAA,CAACN,gBAAgB;MAACE,aAAa,EAAEA;IAAc,CAAE,CACtE;IACDO,IAAI,eAAErB,KAAA,CAAAkB,aAAA,CAAChB,WAAW;MAACoB,IAAI,EAAE;IAAG,CAAE,CAAE;IAChCC,OAAO;IAAA;IACL;IACAvB,KAAA,CAAAkB,aAAA,CAACZ,CAAC,CAACkB,MAAM,QACNX,UAAU,gBACTb,KAAA,CAAAkB,aAAA,CAACjB,gBAAgB;MACfwB,cAAc,EAAEjB,eAAe,CAAC,4BAA4B,CAAE;MAC9DY,WAAW,EAAC,mDAAmD;MAC/DM,EAAE,EAAC,4BAA4B;MAC/BV,MAAM,EAAEA;IAAO,CAChB,CAAC,gBAEFhB,KAAA,CAAAkB,aAAA,CAACjB,gBAAgB;MACfwB,cAAc,EAAEjB,eAAe,CAAC,6BAA6B,CAAE;MAC/DY,WAAW,EAAC,kDAAkD;MAC9DM,EAAE,EAAC,6BAA6B;MAChCV,MAAM,EAAEA;IAAO,CAChB,CAEK;EACX,CACF,CAAC;AAEN","ignoreList":[]}
@@ -47,12 +47,11 @@ var categorySorter = function categorySorter(favoriteId) {
47
47
  return aId > bId ? 1 : -1;
48
48
  };
49
49
  };
50
-
51
- // TODO: This component currently can only show one type of fare per medium
52
50
  var FaresV2Table = function FaresV2Table(_ref) {
53
51
  var legs = _ref.legs,
54
52
  favoriteMediumId = _ref.favoriteMediumId,
55
- favoriteRiderCategoryId = _ref.favoriteRiderCategoryId;
53
+ favoriteRiderCategoryId = _ref.favoriteRiderCategoryId,
54
+ mediumRiderWhitelist = _ref.mediumRiderWhitelist;
56
55
  var intl = useIntl();
57
56
  var transitLegs = legs.filter(function (leg) {
58
57
  return leg.transitLeg;
@@ -87,6 +86,11 @@ var FaresV2Table = function FaresV2Table(_ref) {
87
86
  var _fp$product3, _rmp$rider, _fp$product4, _rmp$medium;
88
87
  return ((_fp$product3 = fp.product) === null || _fp$product3 === void 0 || (_fp$product3 = _fp$product3.riderCategory) === null || _fp$product3 === void 0 ? void 0 : _fp$product3.id) === ((_rmp$rider = rmp.rider) === null || _rmp$rider === void 0 ? void 0 : _rmp$rider.id) && ((_fp$product4 = fp.product) === null || _fp$product4 === void 0 || (_fp$product4 = _fp$product4.medium) === null || _fp$product4 === void 0 ? void 0 : _fp$product4.id) === ((_rmp$medium = rmp.medium) === null || _rmp$medium === void 0 ? void 0 : _rmp$medium.id);
89
88
  });
89
+ }).filter(function (pair) {
90
+ return !mediumRiderWhitelist || (mediumRiderWhitelist === null || mediumRiderWhitelist === void 0 ? void 0 : mediumRiderWhitelist.find(function (p) {
91
+ var _pair$medium, _pair$rider;
92
+ return p.medium === ((_pair$medium = pair.medium) === null || _pair$medium === void 0 ? void 0 : _pair$medium.id) && p.rider === ((_pair$rider = pair.rider) === null || _pair$rider === void 0 ? void 0 : _pair$rider.id);
93
+ }));
90
94
  });
91
95
 
92
96
  // Ensure we have at least one rider/medium
@@ -1 +1 @@
1
- {"version":3,"file":"fares-v2-table.js","names":["React","coreUtils","FormattedMessage","useIntl","styled","Transfer","renderFare","InvisibleA11yCaption","InvisibleA11yLabel","_coreUtils$itinerary","itinerary","getLegCost","getItineraryCost","descope","getLegRouteName","FailDash","createElement","Fragment","id","TransferIcon","withConfig","displayName","componentId","StripedTable","table","categoryReducer","acc","cur","some","m","push","categorySorter","favoriteId","a","b","aId","bId","FaresV2Table","_ref","legs","favoriteMediumId","favoriteRiderCategoryId","intl","transitLegs","filter","leg","transitLeg","fareProducts","flatMap","mediums","map","fp","_fp$product","product","medium","reduce","sort","riders","_fp$product2","riderCategory","riderMediumPairs","rider","rmp","_fp$product3","_rmp$rider","_fp$product4","_rmp$medium","length","name","productUseIds","Set","rows","key","style","textAlign","scope","concat","_toConsumableArray","tripId","forEach","index","currentRowIndex","_medium$id","_rider$id","_dependentAlternateFa","_legPrice$currency","_legPrice$currency2","_getLegCost","Array","from","alternateFareProducts","isDependent","appliedFareProduct","productUseId","legPrice","add","dependentAlternateFareProducts","originalAmount","price","amount","newCell","defaultMessage","title","Number","isNaN","formatMessage","description","transferAmount","formatNumber","currency","code","currencyDisplay","size","nextRowIndex","_medium$id2","_rider$id2","fare","undefined","r"],"sources":["../../src/components/fares-v2-table.tsx"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport React from \"react\";\nimport { Leg } from \"@opentripplanner/types\";\nimport coreUtils from \"@opentripplanner/core-utils\";\nimport { FormattedMessage, useIntl } from \"react-intl\";\nimport styled from \"styled-components\";\nimport { Transfer } from \"@styled-icons/boxicons-regular/Transfer\";\n\nimport { renderFare } from \"../utils\";\nimport { InvisibleA11yCaption, InvisibleA11yLabel } from \"../styled\";\n\nconst {\n getLegCost,\n getItineraryCost,\n descope,\n getLegRouteName\n} = coreUtils.itinerary;\n\nconst FailDash = (\n <>\n -\n <InvisibleA11yLabel>\n <FormattedMessage id=\"otpUi.TripDetails.legMissingFareInfo\" />\n </InvisibleA11yLabel>\n </>\n);\n\nconst TransferIcon = styled(Transfer)`\n padding-right: 0.25ch;\n`;\n\nconst StripedTable = styled.table`\n text-align: right;\n\n tr td,\n tr th {\n padding: 4px;\n }\n\n tr td:nth-of-type(2n + 1),\n tr th:nth-of-type(2n) {\n background: #cccccc55;\n border-color: #cccccc55;\n }\n`;\n\ntype IdNamePair = { id: string; name: string };\n\n// Removes duplicates\nconst categoryReducer = (acc: IdNamePair[], cur: IdNamePair) => {\n if (!acc.some(m => descope(m?.id) === descope(cur?.id))) {\n acc.push(cur);\n }\n return acc;\n};\n\n// Put the preferred medium first, and then all the others alphabetical\nconst categorySorter = (favoriteId?: string) => (\n a: IdNamePair,\n b: IdNamePair\n): number => {\n const aId = descope(a?.id);\n const bId = descope(b?.id);\n\n if (favoriteId && aId === favoriteId) {\n return -1;\n }\n if (favoriteId && bId === favoriteId) {\n return 1;\n }\n\n return aId > bId ? 1 : -1;\n};\n\n// TODO: This component currently can only show one type of fare per medium\nconst FaresV2Table = ({\n legs,\n favoriteMediumId,\n favoriteRiderCategoryId\n}: {\n legs: Leg[];\n favoriteMediumId?: string;\n favoriteRiderCategoryId?: string;\n}): JSX.Element => {\n const intl = useIntl();\n\n const transitLegs = legs.filter(leg => leg.transitLeg);\n\n // Get all fare products across all legs\n const fareProducts = transitLegs.flatMap(leg => leg.fareProducts);\n\n // Reduce these into mediums and riders\n const mediums = fareProducts\n .map(fp => fp.product?.medium)\n .reduce(categoryReducer, [])\n .sort(categorySorter(favoriteMediumId));\n const riders = fareProducts\n .map(fp => fp.product?.riderCategory)\n .reduce(categoryReducer, [])\n .sort(categorySorter(favoriteRiderCategoryId));\n\n // Generate the pairs of riders and mediums, but filter out ones\n // that never occur in the FareProducts\n const riderMediumPairs = mediums\n .flatMap(medium =>\n riders.map(rider => ({\n medium,\n rider\n }))\n )\n .filter(rmp =>\n fareProducts.some(\n fp =>\n fp.product?.riderCategory?.id === rmp.rider?.id &&\n fp.product?.medium?.id === rmp.medium?.id\n )\n );\n\n // Ensure we have at least one rider/medium\n if (riders.length === 0) {\n riders.push({ name: \"Fare\", id: null });\n }\n if (mediums.length === 0) {\n mediums.push({ name: \"Regular\", id: null });\n }\n\n // Keep track of seen fare ids to indicate transfers.\n const productUseIds: Set<string> = new Set();\n\n const rows = [\n [\n <th key=\"faretitle\" style={{ textAlign: \"left\" }} scope=\"col\">\n <InvisibleA11yLabel>\n <FormattedMessage id=\"otpUi.TripDetails.fareCategory\" />\n </InvisibleA11yLabel>\n </th>,\n ...transitLegs.map(leg => (\n <th key={leg.tripId} scope=\"col\">\n {getLegRouteName(leg, intl)}\n </th>\n )),\n transitLegs.length > 1 ? (\n <th key=\"total\" style={{ textAlign: \"right\" }} scope=\"col\">\n <em>\n <FormattedMessage id=\"otpUi.TripDetails.total\" />\n </em>\n </th>\n ) : (\n <></>\n )\n ]\n ];\n\n // non-transit legs don't have fares\n transitLegs.forEach((leg, index) => {\n riderMediumPairs.forEach((rmp, currentRowIndex) => {\n const { medium, rider } = rmp;\n const {\n alternateFareProducts,\n isDependent,\n appliedFareProduct,\n productUseId\n } = getLegCost(\n leg,\n descope(medium?.id ?? null),\n descope(rider?.id ?? null),\n Array.from(productUseIds)\n );\n const legPrice = appliedFareProduct?.legPrice;\n\n productUseIds.add(productUseId);\n\n // Only consider alternateFareProducts if current product is dependent\n const dependentAlternateFareProducts =\n isDependent && alternateFareProducts;\n\n // Calculate pre-tranfer amount either via alternate fare or fare-id matching (price.originalAmount)\n const originalAmount =\n dependentAlternateFareProducts?.[0]?.price.amount - legPrice?.amount ||\n appliedFareProduct?.price.amount - legPrice?.amount;\n\n const newCell = (\n <>\n {/* Only render the list of fare types once */}\n {index === 0 && (\n <th style={{ textAlign: \"left\" }} scope=\"row\">\n {medium?.id && (\n <>\n <FormattedMessage\n id={`config.fares.media.${descope(medium.id)}`}\n defaultMessage={medium.name}\n />{\" \"}\n </>\n )}\n {rider?.id && (\n <FormattedMessage\n id={`config.fares.riderCategory.${descope(rider.id)}`}\n defaultMessage={rider.name}\n />\n )}\n {!medium?.id && !rider?.id ? FailDash : null}\n </th>\n )}\n <td\n style={{ textAlign: legPrice ? \"right\" : \"center\" }}\n title={\n !Number.isNaN(originalAmount) &&\n originalAmount > 0 &&\n index > 0 &&\n intl.formatMessage(\n {\n description:\n \"Text explaining the transfer discount applied to this fare.\",\n id: \"otpUi.TripDetails.transferDiscountExplanation\"\n },\n {\n transferAmount: intl.formatNumber(originalAmount, {\n currency: legPrice?.currency?.code,\n currencyDisplay: \"narrowSymbol\",\n style: \"currency\"\n })\n }\n )\n }\n >\n {!Number.isNaN(originalAmount) &&\n originalAmount > 0 &&\n index > 0 && <TransferIcon size={16} />}\n {/* Leg Price will always be defined if the fare product has a price */}\n {legPrice\n ? renderFare(legPrice?.currency?.code, legPrice?.amount)\n : FailDash}\n </td>\n </>\n );\n const nextRowIndex = currentRowIndex + 1;\n if (!rows[nextRowIndex]) {\n rows[nextRowIndex] = [];\n }\n rows[nextRowIndex].push(newCell);\n\n // Generate final column\n if (index === transitLegs.length - 1 && transitLegs.length > 1) {\n const fare = getItineraryCost(\n legs,\n descope(medium?.id ?? null),\n descope(rider?.id ?? null),\n true\n );\n rows[nextRowIndex].push(\n <td\n style={{ textAlign: fare?.amount ? \"right\" : \"center\" }}\n title={\n fare?.amount === undefined &&\n intl.formatMessage({\n id: \"otpUi.TripDetails.missingFareTotal\"\n })\n }\n >\n <em>\n {fare?.amount !== undefined\n ? renderFare(fare?.currency.code, fare?.amount)\n : FailDash}\n </em>\n </td>\n );\n }\n });\n });\n\n return (\n <StripedTable>\n <InvisibleA11yCaption>\n <FormattedMessage id=\"otpUi.TripDetails.transitFareTable\" />\n </InvisibleA11yCaption>\n {rows.map((r, index) => (\n <tr key={index}>{r}</tr>\n ))}\n </StripedTable>\n );\n};\n\nexport default FaresV2Table;\n"],"mappings":";AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,SAAS,MAAM,6BAA6B;AACnD,SAASC,gBAAgB,EAAEC,OAAO,QAAQ,YAAY;AACtD,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,QAAQ,QAAQ,yCAAyC;AAElE,SAASC,UAAU,QAAQ,UAAU;AACrC,SAASC,oBAAoB,EAAEC,kBAAkB,QAAQ,WAAW;AAEpE,IAAAC,oBAAA,GAKIR,SAAS,CAACS,SAAS;EAJrBC,UAAU,GAAAF,oBAAA,CAAVE,UAAU;EACVC,gBAAgB,GAAAH,oBAAA,CAAhBG,gBAAgB;EAChBC,OAAO,GAAAJ,oBAAA,CAAPI,OAAO;EACPC,eAAe,GAAAL,oBAAA,CAAfK,eAAe;AAGjB,IAAMC,QAAQ,gBACZf,KAAA,CAAAgB,aAAA,CAAAhB,KAAA,CAAAiB,QAAA,QAAE,GAEA,eAAAjB,KAAA,CAAAgB,aAAA,CAACR,kBAAkB,qBACjBR,KAAA,CAAAgB,aAAA,CAACd,gBAAgB;EAACgB,EAAE,EAAC;AAAsC,CAAE,CAC3C,CACpB,CACH;AAED,IAAMC,YAAY,GAAGf,MAAM,CAACC,QAAQ,CAAC,CAAAe,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,6BAEpC;AAED,IAAMC,YAAY,GAAGnB,MAAM,CAACoB,KAAK,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+IAahC;AAID;AACA,IAAMG,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,GAAiB,EAAEC,GAAe,EAAK;EAC9D,IAAI,CAACD,GAAG,CAACE,IAAI,CAAC,UAAAC,CAAC;IAAA,OAAIh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EF,oBACEf,KAAA,CAAAgB,aAAA,CAACO,YAAY,qBACXvB,KAAA,CAAAgB,aAAA,CAACT,oBAAoB,qBACnBP,KAAA,CAAAgB,aAAA,CAACd,gBAAgB;IAACgB,EAAE,EAAC;EAAoC,CAAE,CACvC,CAAC,EACtBqD,IAAI,CAACrB,GAAG,CAAC,UAACoE,CAAC,EAAEtC,KAAK;IAAA,oBACjBhF,KAAA,CAAAgB,aAAA;MAAIwD,GAAG,EAAEQ;IAAM,GAAEsC,CAAM,CAAC;EAAA,CACzB,CACW,CAAC;AAEnB,CAAC;AAED,eAAejF,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"fares-v2-table.js","names":["React","coreUtils","FormattedMessage","useIntl","styled","Transfer","renderFare","InvisibleA11yCaption","InvisibleA11yLabel","_coreUtils$itinerary","itinerary","getLegCost","getItineraryCost","descope","getLegRouteName","FailDash","createElement","Fragment","id","TransferIcon","withConfig","displayName","componentId","StripedTable","table","categoryReducer","acc","cur","some","m","push","categorySorter","favoriteId","a","b","aId","bId","FaresV2Table","_ref","legs","favoriteMediumId","favoriteRiderCategoryId","mediumRiderWhitelist","intl","transitLegs","filter","leg","transitLeg","fareProducts","flatMap","mediums","map","fp","_fp$product","product","medium","reduce","sort","riders","_fp$product2","riderCategory","riderMediumPairs","rider","rmp","_fp$product3","_rmp$rider","_fp$product4","_rmp$medium","pair","find","p","_pair$medium","_pair$rider","length","name","productUseIds","Set","rows","key","style","textAlign","scope","concat","_toConsumableArray","tripId","forEach","index","currentRowIndex","_medium$id","_rider$id","_dependentAlternateFa","_legPrice$currency","_legPrice$currency2","_getLegCost","Array","from","alternateFareProducts","isDependent","appliedFareProduct","productUseId","legPrice","add","dependentAlternateFareProducts","originalAmount","price","amount","newCell","defaultMessage","title","Number","isNaN","formatMessage","description","transferAmount","formatNumber","currency","code","currencyDisplay","size","nextRowIndex","_medium$id2","_rider$id2","fare","undefined","r"],"sources":["../../src/components/fares-v2-table.tsx"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport React from \"react\";\nimport { Leg, MediumRiderWhitelist } from \"@opentripplanner/types\";\nimport coreUtils from \"@opentripplanner/core-utils\";\nimport { FormattedMessage, useIntl } from \"react-intl\";\nimport styled from \"styled-components\";\nimport { Transfer } from \"@styled-icons/boxicons-regular/Transfer\";\n\nimport { renderFare } from \"../utils\";\nimport { InvisibleA11yCaption, InvisibleA11yLabel } from \"../styled\";\n\nconst {\n getLegCost,\n getItineraryCost,\n descope,\n getLegRouteName\n} = coreUtils.itinerary;\n\nconst FailDash = (\n <>\n -\n <InvisibleA11yLabel>\n <FormattedMessage id=\"otpUi.TripDetails.legMissingFareInfo\" />\n </InvisibleA11yLabel>\n </>\n);\n\nconst TransferIcon = styled(Transfer)`\n padding-right: 0.25ch;\n`;\n\nconst StripedTable = styled.table`\n text-align: right;\n\n tr td,\n tr th {\n padding: 4px;\n }\n\n tr td:nth-of-type(2n + 1),\n tr th:nth-of-type(2n) {\n background: #cccccc55;\n border-color: #cccccc55;\n }\n`;\n\ntype IdNamePair = { id: string; name: string };\n\n// Removes duplicates\nconst categoryReducer = (acc: IdNamePair[], cur: IdNamePair) => {\n if (!acc.some(m => descope(m?.id) === descope(cur?.id))) {\n acc.push(cur);\n }\n return acc;\n};\n\n// Put the preferred medium first, and then all the others alphabetical\nconst categorySorter = (favoriteId?: string) => (\n a: IdNamePair,\n b: IdNamePair\n): number => {\n const aId = descope(a?.id);\n const bId = descope(b?.id);\n\n if (favoriteId && aId === favoriteId) {\n return -1;\n }\n if (favoriteId && bId === favoriteId) {\n return 1;\n }\n\n return aId > bId ? 1 : -1;\n};\n\nconst FaresV2Table = ({\n legs,\n favoriteMediumId,\n favoriteRiderCategoryId,\n mediumRiderWhitelist\n}: {\n legs: Leg[];\n favoriteMediumId?: string;\n favoriteRiderCategoryId?: string;\n mediumRiderWhitelist?: MediumRiderWhitelist;\n}): JSX.Element => {\n const intl = useIntl();\n\n const transitLegs = legs.filter(leg => leg.transitLeg);\n\n // Get all fare products across all legs\n const fareProducts = transitLegs.flatMap(leg => leg.fareProducts);\n\n // Reduce these into mediums and riders\n const mediums = fareProducts\n .map(fp => fp.product?.medium)\n .reduce(categoryReducer, [])\n .sort(categorySorter(favoriteMediumId));\n const riders = fareProducts\n .map(fp => fp.product?.riderCategory)\n .reduce(categoryReducer, [])\n .sort(categorySorter(favoriteRiderCategoryId));\n\n // Generate the pairs of riders and mediums, but filter out ones\n // that never occur in the FareProducts\n const riderMediumPairs = mediums\n .flatMap(medium =>\n riders.map(rider => ({\n medium,\n rider\n }))\n )\n .filter(rmp =>\n fareProducts.some(\n fp =>\n fp.product?.riderCategory?.id === rmp.rider?.id &&\n fp.product?.medium?.id === rmp.medium?.id\n )\n )\n .filter(\n pair =>\n !mediumRiderWhitelist ||\n mediumRiderWhitelist?.find(\n p => p.medium === pair.medium?.id && p.rider === pair.rider?.id\n )\n );\n\n // Ensure we have at least one rider/medium\n if (riders.length === 0) {\n riders.push({ name: \"Fare\", id: null });\n }\n if (mediums.length === 0) {\n mediums.push({ name: \"Regular\", id: null });\n }\n\n // Keep track of seen fare ids to indicate transfers.\n const productUseIds: Set<string> = new Set();\n\n const rows = [\n [\n <th key=\"faretitle\" style={{ textAlign: \"left\" }} scope=\"col\">\n <InvisibleA11yLabel>\n <FormattedMessage id=\"otpUi.TripDetails.fareCategory\" />\n </InvisibleA11yLabel>\n </th>,\n ...transitLegs.map(leg => (\n <th key={leg.tripId} scope=\"col\">\n {getLegRouteName(leg, intl)}\n </th>\n )),\n transitLegs.length > 1 ? (\n <th key=\"total\" style={{ textAlign: \"right\" }} scope=\"col\">\n <em>\n <FormattedMessage id=\"otpUi.TripDetails.total\" />\n </em>\n </th>\n ) : (\n <></>\n )\n ]\n ];\n\n // non-transit legs don't have fares\n transitLegs.forEach((leg, index) => {\n riderMediumPairs.forEach((rmp, currentRowIndex) => {\n const { medium, rider } = rmp;\n const {\n alternateFareProducts,\n isDependent,\n appliedFareProduct,\n productUseId\n } = getLegCost(\n leg,\n descope(medium?.id ?? null),\n descope(rider?.id ?? null),\n Array.from(productUseIds)\n );\n const legPrice = appliedFareProduct?.legPrice;\n\n productUseIds.add(productUseId);\n\n // Only consider alternateFareProducts if current product is dependent\n const dependentAlternateFareProducts =\n isDependent && alternateFareProducts;\n\n // Calculate pre-tranfer amount either via alternate fare or fare-id matching (price.originalAmount)\n const originalAmount =\n dependentAlternateFareProducts?.[0]?.price.amount - legPrice?.amount ||\n appliedFareProduct?.price.amount - legPrice?.amount;\n\n const newCell = (\n <>\n {/* Only render the list of fare types once */}\n {index === 0 && (\n <th style={{ textAlign: \"left\" }} scope=\"row\">\n {medium?.id && (\n <>\n <FormattedMessage\n id={`config.fares.media.${descope(medium.id)}`}\n defaultMessage={medium.name}\n />{\" \"}\n </>\n )}\n {rider?.id && (\n <FormattedMessage\n id={`config.fares.riderCategory.${descope(rider.id)}`}\n defaultMessage={rider.name}\n />\n )}\n {!medium?.id && !rider?.id ? FailDash : null}\n </th>\n )}\n <td\n style={{ textAlign: legPrice ? \"right\" : \"center\" }}\n title={\n !Number.isNaN(originalAmount) &&\n originalAmount > 0 &&\n index > 0 &&\n intl.formatMessage(\n {\n description:\n \"Text explaining the transfer discount applied to this fare.\",\n id: \"otpUi.TripDetails.transferDiscountExplanation\"\n },\n {\n transferAmount: intl.formatNumber(originalAmount, {\n currency: legPrice?.currency?.code,\n currencyDisplay: \"narrowSymbol\",\n style: \"currency\"\n })\n }\n )\n }\n >\n {!Number.isNaN(originalAmount) &&\n originalAmount > 0 &&\n index > 0 && <TransferIcon size={16} />}\n {/* Leg Price will always be defined if the fare product has a price */}\n {legPrice\n ? renderFare(legPrice?.currency?.code, legPrice?.amount)\n : FailDash}\n </td>\n </>\n );\n const nextRowIndex = currentRowIndex + 1;\n if (!rows[nextRowIndex]) {\n rows[nextRowIndex] = [];\n }\n rows[nextRowIndex].push(newCell);\n\n // Generate final column\n if (index === transitLegs.length - 1 && transitLegs.length > 1) {\n const fare = getItineraryCost(\n legs,\n descope(medium?.id ?? null),\n descope(rider?.id ?? null),\n true\n );\n rows[nextRowIndex].push(\n <td\n style={{ textAlign: fare?.amount ? \"right\" : \"center\" }}\n title={\n fare?.amount === undefined &&\n intl.formatMessage({\n id: \"otpUi.TripDetails.missingFareTotal\"\n })\n }\n >\n <em>\n {fare?.amount !== undefined\n ? renderFare(fare?.currency.code, fare?.amount)\n : FailDash}\n </em>\n </td>\n );\n }\n });\n });\n\n return (\n <StripedTable>\n <InvisibleA11yCaption>\n <FormattedMessage id=\"otpUi.TripDetails.transitFareTable\" />\n </InvisibleA11yCaption>\n {rows.map((r, index) => (\n <tr key={index}>{r}</tr>\n ))}\n </StripedTable>\n );\n};\n\nexport default FaresV2Table;\n"],"mappings":";AAAA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,SAAS,MAAM,6BAA6B;AACnD,SAASC,gBAAgB,EAAEC,OAAO,QAAQ,YAAY;AACtD,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,QAAQ,QAAQ,yCAAyC;AAElE,SAASC,UAAU,QAAQ,UAAU;AACrC,SAASC,oBAAoB,EAAEC,kBAAkB,QAAQ,WAAW;AAEpE,IAAAC,oBAAA,GAKIR,SAAS,CAACS,SAAS;EAJrBC,UAAU,GAAAF,oBAAA,CAAVE,UAAU;EACVC,gBAAgB,GAAAH,oBAAA,CAAhBG,gBAAgB;EAChBC,OAAO,GAAAJ,oBAAA,CAAPI,OAAO;EACPC,eAAe,GAAAL,oBAAA,CAAfK,eAAe;AAGjB,IAAMC,QAAQ,gBACZf,KAAA,CAAAgB,aAAA,CAAAhB,KAAA,CAAAiB,QAAA,QAAE,GAEA,eAAAjB,KAAA,CAAAgB,aAAA,CAACR,kBAAkB,qBACjBR,KAAA,CAAAgB,aAAA,CAACd,gBAAgB;EAACgB,EAAE,EAAC;AAAsC,CAAE,CAC3C,CACpB,CACH;AAED,IAAMC,YAAY,GAAGf,MAAM,CAACC,QAAQ,CAAC,CAAAe,UAAA;E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KAAK,CAAE5C,EAAE,cAAAuG,UAAA,cAAAA,UAAA,GAAI,IAAI,CAAC,EAC1B,IACF,CAAC;QACD5C,IAAI,CAAC0C,YAAY,CAAC,CAACzF,IAAI,cACrB9B,KAAA,CAAAgB,aAAA;UACE+D,KAAK,EAAE;YAAEC,SAAS,EAAE0C,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAEjB,MAAM,GAAG,OAAO,GAAG;UAAS,CAAE;UACxDG,KAAK,EACH,CAAAc,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEjB,MAAM,MAAKkB,SAAS,IAC1BhF,IAAI,CAACoE,aAAa,CAAC;YACjB7F,EAAE,EAAE;UACN,CAAC;QACF,gBAEDlB,KAAA,CAAAgB,aAAA,aACG,CAAA0G,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEjB,MAAM,MAAKkB,SAAS,GACvBrH,UAAU,CAACoH,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEP,QAAQ,CAACC,IAAI,EAAEM,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEjB,MAAM,CAAC,GAC7C1F,QACF,CACF,CACN,CAAC;MACH;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,oBACEf,KAAA,CAAAgB,aAAA,CAACO,YAAY,qBACXvB,KAAA,CAAAgB,aAAA,CAACT,oBAAoB,qBACnBP,KAAA,CAAAgB,aAAA,CAACd,gBAAgB;IAACgB,EAAE,EAAC;EAAoC,CAAE,CACvC,CAAC,EACtB2D,IAAI,CAAC1B,GAAG,CAAC,UAACyE,CAAC,EAAEtC,KAAK;IAAA,oBACjBtF,KAAA,CAAAgB,aAAA;MAAI8D,GAAG,EAAEQ;IAAM,GAAEsC,CAAM,CAAC;EAAA,CACzB,CACW,CAAC;AAEnB,CAAC;AAED,eAAevF,YAAY","ignoreList":[]}
@@ -19,7 +19,8 @@ export default function Fares(_ref) {
19
19
  var _defaultFareTotal$cur;
20
20
  var itinerary = _ref.itinerary,
21
21
  FareDetails = _ref.FareDetails,
22
- defaultFareType = _ref.defaultFareType;
22
+ defaultFareType = _ref.defaultFareType,
23
+ mediumRiderWhitelist = _ref.mediumRiderWhitelist;
23
24
  // process the transit fare
24
25
  var fareResult = coreUtils.itinerary.calculateTncFares(itinerary);
25
26
  var currencyCode = fareResult.currencyCode,
@@ -72,6 +73,7 @@ export default function Fares(_ref) {
72
73
  }
73
74
  })), /*#__PURE__*/React.createElement(FaresV2Table, {
74
75
  legs: itinerary.legs,
76
+ mediumRiderWhitelist: mediumRiderWhitelist,
75
77
  favoriteMediumId: Array.isArray(defaultFareType === null || defaultFareType === void 0 ? void 0 : defaultFareType.mediumId) ? defaultFareType === null || defaultFareType === void 0 ? void 0 : defaultFareType.mediumId[0] : defaultFareType === null || defaultFareType === void 0 ? void 0 : defaultFareType.mediumId,
76
78
  favoriteRiderCategoryId: Array.isArray(defaultFareType === null || defaultFareType === void 0 ? void 0 : defaultFareType.riderCategoryId) ? defaultFareType === null || defaultFareType === void 0 ? void 0 : defaultFareType.riderCategoryId[0] : defaultFareType === null || defaultFareType === void 0 ? void 0 : defaultFareType.riderCategoryId
77
79
  })));
@@ -1 +1 @@
1
- {"version":3,"file":"fares.js","names":["React","FormattedMessage","coreUtils","MoneyBillAlt","flatten","S","boldText","renderFare","TripDetail","FaresV2Table","defaultEnglishMessages","defaultMessages","Fares","_ref","_defaultFareTotal$cur","itinerary","FareDetails","defaultFareType","fareResult","calculateTncFares","currencyCode","maxTNCFare","minTNCFare","_itinerary$legs$reduc","legs","reduce","prev","leg","rideHailingEstimate","companies","provider","id","fareProducts","forEach","fp","_fp$product$medium","_fp$product$riderCate","mediumId","product","medium","riderCategoryId","riderCategory","fareTypes","find","ft","push","defaultFareTotal","getItineraryCost","fare","undefined","createElement","Fare","TransitFare","style","display","length","defaultMessage","description","values","name","strong","value","currency","code","amount","favoriteMediumId","Array","isArray","favoriteRiderCategoryId","tncFare","TNCFare","TNCFareCompanies","toLowerCase","Fragment","some","className","icon","size","summary"],"sources":["../../src/components/fares.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { FormattedMessage } from \"react-intl\";\nimport coreUtils from \"@opentripplanner/core-utils\";\nimport { FareProductSelector, Itinerary } from \"@opentripplanner/types\";\nimport { MoneyBillAlt } from \"@styled-icons/fa-solid\";\nimport { flatten } from \"flat\";\nimport * as S from \"../styled\";\nimport { boldText, renderFare } from \"../utils\";\nimport TripDetail from \"../trip-detail\";\nimport { FareDetailsProps } from \"../types\";\nimport FaresV2Table from \"./fares-v2-table\";\n\n// Load the default messages.\nimport defaultEnglishMessages from \"../../i18n/en-US.yml\";\n\nexport interface FaresProps {\n itinerary: Itinerary;\n FareDetails?: React.ElementType<FareDetailsProps>;\n defaultFareType?: FareProductSelector;\n}\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\nexport default function Fares({\n itinerary,\n FareDetails,\n defaultFareType\n}: FaresProps): ReactElement | null {\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 const defaultFareTotal = coreUtils.itinerary.getItineraryCost(\n itinerary.legs,\n defaultFareType?.mediumId || null,\n defaultFareType?.riderCategoryId || null\n );\n // Depending on if there are additional fares to display either render a <span> or a <details>\n const fare = defaultFareTotal !== undefined && (\n <S.Fare>\n <S.TransitFare>\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 <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.transitFare\"]\n }\n description=\"Text showing the price of tickets on public transportation.\"\n id=\"otpUi.TripDetails.transitFare\"\n />\n ),\n strong: boldText,\n value: renderFare(\n defaultFareTotal.currency?.code || \"USD\",\n defaultFareTotal?.amount\n )\n }}\n />\n </summary>\n <FaresV2Table\n legs={itinerary.legs}\n favoriteMediumId={\n Array.isArray(defaultFareType?.mediumId)\n ? defaultFareType?.mediumId[0]\n : defaultFareType?.mediumId\n }\n favoriteRiderCategoryId={\n Array.isArray(defaultFareType?.riderCategoryId)\n ? defaultFareType?.riderCategoryId[0]\n : defaultFareType?.riderCategoryId\n }\n />\n </S.TransitFare>\n </S.Fare>\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 return (\n <>\n {itinerary.legs.some(\n leg => leg.fareProducts && leg.fareProducts.length > 0\n ) && (\n <TripDetail\n className=\"fares\"\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 || <FaresV2Table legs={itinerary.legs} />}\n />\n )}\n\n {!!tncFare && (\n <TripDetail\n className=\"tnc-fare\"\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 </>\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAwB,OAAO;AAC3C,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,OAAOC,SAAS,MAAM,6BAA6B;AAEnD,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,OAAO,QAAQ,MAAM;AAC9B,OAAO,KAAKC,CAAC,MAAM,WAAW;AAC9B,SAASC,QAAQ,EAAEC,UAAU,QAAQ,UAAU;AAC/C,OAAOC,UAAU,MAAM,gBAAgB;AAEvC,OAAOC,YAAY,MAAM,kBAAkB;;AAE3C;AACA,OAAOC,sBAAsB,MAAM,sBAAsB;AAQzD;AACA;AACA;AACA;AACA,IAAMC,eAAuC,GAAGP,OAAO,CAACM,sBAAsB,CAAC;AAE/E,eAAe,SAASE,KAAKA,CAAAC,IAAA,EAIO;EAAA,IAAAC,qBAAA;EAAA,IAHlCC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,eAAe,GAAAJ,IAAA,CAAfI,eAAe;EAEf;EACA,IAAMC,UAAU,GAAGhB,SAAS,CAACa,SAAS,CAACI,iBAAiB,CAACJ,SAAS,CAAC;EACnE,IAAQK,YAAY,GAA6BF,UAAU,CAAnDE,YA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G,CAACK,YAAY,CAACuB,MAAM,GAAG,CAAC;EAAA,CACxD,CAAC,iBACCvD,KAAA,CAAAkD,aAAA,CAAC1C,UAAU;IACTmE,SAAS,EAAC;IACV;IAAA;IACAlB,WAAW,EACTzC,WAAW,iBACThB,KAAA,CAAAkD,aAAA,CAAClC,WAAW;MACVQ,IAAI,EAAET,SAAS,CAACS,IAAK;MACrBH,UAAU,EAAEA,UAAW;MACvBC,UAAU,EAAEA;IAAW,CACxB,CAEJ;IACDsD,IAAI,eAAE5E,KAAA,CAAAkD,aAAA,CAAC/C,YAAY;MAAC0E,IAAI,EAAE;IAAG,CAAE,CAAE;IACjCC,OAAO,EAAE9B,IAAI,iBAAIhD,KAAA,CAAAkD,aAAA,CAACzC,YAAY;MAACe,IAAI,EAAET,SAAS,CAACS;IAAK,CAAE;EAAE,CACzD,CACF,EAEA,CAAC,CAAC6C,OAAO,iBACRrE,KAAA,CAAAkD,aAAA,CAAC1C,UAAU;IACTmE,SAAS,EAAC;IACV;IAAA;IACAlB,WAAW,EACTzC,WAAW,iBACThB,KAAA,CAAAkD,aAAA,CAAClC,WAAW;MACVQ,IAAI,EAAET,SAAS,CAACS,IAAK;MACrBH,UAAU,EAAEA,UAAW;MACvBC,UAAU,EAAEA;IAAW,CACxB,CAEJ;IACDsD,IAAI,eAAE5E,KAAA,CAAAkD,aAAA,CAAC/C,YAAY;MAAC0E,IAAI,EAAE;IAAG,CAAE,CAAE;IACjCC,OAAO,EAAET;EAAQ,CAClB,CAEH,CAAC;AAEP","ignoreList":[]}
1
+ {"version":3,"file":"fares.js","names":["React","FormattedMessage","coreUtils","MoneyBillAlt","flatten","S","boldText","renderFare","TripDetail","FaresV2Table","defaultEnglishMessages","defaultMessages","Fares","_ref","_defaultFareTotal$cur","itinerary","FareDetails","defaultFareType","mediumRiderWhitelist","fareResult","calculateTncFares","currencyCode","maxTNCFare","minTNCFare","_itinerary$legs$reduc","legs","reduce","prev","leg","rideHailingEstimate","companies","provider","id","fareProducts","forEach","fp","_fp$product$medium","_fp$product$riderCate","mediumId","product","medium","riderCategoryId","riderCategory","fareTypes","find","ft","push","defaultFareTotal","getItineraryCost","fare","undefined","createElement","Fare","TransitFare","style","display","length","defaultMessage","description","values","name","strong","value","currency","code","amount","favoriteMediumId","Array","isArray","favoriteRiderCategoryId","tncFare","TNCFare","TNCFareCompanies","toLowerCase","Fragment","some","className","icon","size","summary"],"sources":["../../src/components/fares.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { FormattedMessage } from \"react-intl\";\nimport coreUtils from \"@opentripplanner/core-utils\";\nimport {\n FareProductSelector,\n Itinerary,\n MediumRiderWhitelist\n} from \"@opentripplanner/types\";\nimport { MoneyBillAlt } from \"@styled-icons/fa-solid\";\nimport { flatten } from \"flat\";\nimport * as S from \"../styled\";\nimport { boldText, renderFare } from \"../utils\";\nimport TripDetail from \"../trip-detail\";\nimport { FareDetailsProps } from \"../types\";\nimport FaresV2Table from \"./fares-v2-table\";\n\n// Load the default messages.\nimport defaultEnglishMessages from \"../../i18n/en-US.yml\";\n\nexport interface FaresProps {\n itinerary: Itinerary;\n FareDetails?: React.ElementType<FareDetailsProps>;\n defaultFareType?: FareProductSelector;\n mediumRiderWhitelist?: MediumRiderWhitelist;\n}\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\nexport default function Fares({\n itinerary,\n FareDetails,\n defaultFareType,\n mediumRiderWhitelist\n}: FaresProps): ReactElement | null {\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 const defaultFareTotal = coreUtils.itinerary.getItineraryCost(\n itinerary.legs,\n defaultFareType?.mediumId || null,\n defaultFareType?.riderCategoryId || null\n );\n // Depending on if there are additional fares to display either render a <span> or a <details>\n const fare = defaultFareTotal !== undefined && (\n <S.Fare>\n <S.TransitFare>\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 <FormattedMessage\n defaultMessage={\n defaultMessages[\"otpUi.TripDetails.transitFare\"]\n }\n description=\"Text showing the price of tickets on public transportation.\"\n id=\"otpUi.TripDetails.transitFare\"\n />\n ),\n strong: boldText,\n value: renderFare(\n defaultFareTotal.currency?.code || \"USD\",\n defaultFareTotal?.amount\n )\n }}\n />\n </summary>\n <FaresV2Table\n legs={itinerary.legs}\n mediumRiderWhitelist={mediumRiderWhitelist}\n favoriteMediumId={\n Array.isArray(defaultFareType?.mediumId)\n ? defaultFareType?.mediumId[0]\n : defaultFareType?.mediumId\n }\n favoriteRiderCategoryId={\n Array.isArray(defaultFareType?.riderCategoryId)\n ? defaultFareType?.riderCategoryId[0]\n : defaultFareType?.riderCategoryId\n }\n />\n </S.TransitFare>\n </S.Fare>\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 return (\n <>\n {itinerary.legs.some(\n leg => leg.fareProducts && leg.fareProducts.length > 0\n ) && (\n <TripDetail\n className=\"fares\"\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 || <FaresV2Table legs={itinerary.legs} />}\n />\n )}\n\n {!!tncFare && (\n <TripDetail\n className=\"tnc-fare\"\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 </>\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAwB,OAAO;AAC3C,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,OAAOC,SAAS,MAAM,6BAA6B;AAMnD,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,OAAO,QAAQ,MAAM;AAC9B,OAAO,KAAKC,CAAC,MAAM,WAAW;AAC9B,SAASC,QAAQ,EAAEC,UAAU,QAAQ,UAAU;AAC/C,OAAOC,UAAU,MAAM,gBAAgB;AAEvC,OAAOC,YAAY,MAAM,kBAAkB;;AAE3C;AACA,OAAOC,sBAAsB,MAAM,sBAAsB;AASzD;AACA;AACA;AACA;AACA,IAAMC,eAAuC,GAAGP,O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,eAAE7E,KAAA,CAAAmD,aAAA,CAAChD,YAAY;MAAC2E,IAAI,EAAE;IAAG,CAAE,CAAE;IACjCC,OAAO,EAAET;EAAQ,CAClB,CAEH,CAAC;AAEP","ignoreList":[]}
@@ -32,12 +32,12 @@ export function DefaultTimeActiveDetails(_ref) {
32
32
  });
33
33
  }
34
34
  export default function TimeActive(_ref2) {
35
- var itinerary = _ref2.itinerary,
35
+ var legs = _ref2.legs,
36
36
  TimeActiveDetails = _ref2.TimeActiveDetails,
37
37
  showApproximateMinutesActive = _ref2.showApproximateMinutesActive;
38
38
  var walkDurationSeconds = 0;
39
39
  var bikeDurationSeconds = 0;
40
- itinerary.legs.forEach(function (leg) {
40
+ legs.forEach(function (leg) {
41
41
  if (leg.mode.startsWith("WALK")) walkDurationSeconds += leg.duration;
42
42
  if (leg.mode.startsWith("BICYCLE")) bikeDurationSeconds += leg.duration;
43
43
  });
@@ -1 +1 @@
1
- {"version":3,"file":"time-active.js","names":["React","FormattedMessage","Heartbeat","flatten","TripDetail","boldText","defaultEnglishMessages","defaultMessages","DefaultTimeActiveDetails","_ref","bikeMinutes","walkMinutes","createElement","defaultMessage","description","id","values","strong","TimeActive","_ref2","itinerary","TimeActiveDetails","showApproximateMinutesActive","walkDurationSeconds","bikeDurationSeconds","legs","forEach","leg","mode","startsWith","duration","Math","round","minutesActive","className","icon","size","summary","approximatePrefix","minutes"],"sources":["../../src/components/time-active.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { FormattedMessage } from \"react-intl\";\nimport { Heartbeat } from \"@styled-icons/fa-solid/Heartbeat\";\nimport { Itinerary } from \"@opentripplanner/types\";\nimport flatten from \"flat\";\nimport TripDetail from \"../trip-detail\";\nimport { boldText } from \"../utils\";\nimport { TimeActiveDetailsProps } 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\n/**\n * Default rendering if no component is provided for the TimeActiveDetails\n * slot in the TripDetails component.\n */\nexport function 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\nexport default function TimeActive({\n itinerary,\n TimeActiveDetails,\n showApproximateMinutesActive\n}: {\n itinerary: Itinerary;\n TimeActiveDetails: React.ComponentType<TimeActiveDetailsProps>;\n showApproximateMinutesActive: boolean;\n}): JSX.Element | null {\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 if (minutesActive <= 0) return null;\n\n return (\n <TripDetail\n className=\"time-active\"\n icon={<Heartbeat size={17} />}\n summary={\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.minutesActive\"]}\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}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAwB,OAAO;A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EACzE,CAAC,CAAC;EACF,IAAMpB,WAAW,GAAGqB,IAAI,CAACC,KAAK,CAACR,mBAAmB,GAAG,EAAE,CAAC;EACxD,IAAMb,WAAW,GAAGoB,IAAI,CAACC,KAAK,CAACT,mBAAmB,GAAG,EAAE,CAAC;EACxD,IAAMU,aAAa,GAAGvB,WAAW,GAAGC,WAAW;EAE/C,IAAIsB,aAAa,IAAI,CAAC,EAAE,OAAO,IAAI;EAEnC,oBACEjC,KAAA,CAAAY,aAAA,CAACR,UAAU;IACT8B,SAAS,EAAC,aAAa;IACvBC,IAAI,eAAEnC,KAAA,CAAAY,aAAA,CAACV,SAAS;MAACkC,IAAI,EAAE;IAAG,CAAE,CAAE;IAC9BC,OAAO,eACLrC,KAAA,CAAAY,aAAA,CAACX,gBAAgB;MACfY,cAAc,EAAEN,eAAe,CAAC,iCAAiC,CAAE;MACnEO,WAAW,EAAC,6EAA6E;MACzFC,EAAE,EAAC,iCAAiC;MACpCC,MAAM,EAAE;QACNsB,iBAAiB,EAAEhB,4BAA4B;QAC/CiB,OAAO,EAAEN,aAAa;QACtBhB,MAAM,EAAEZ;MACV;IAAE,CACH,CACF;IACDS,WAAW,EACTO,iBAAiB,iBACfrB,KAAA,CAAAY,aAAA,CAACS,iBAAiB;MAChBX,WAAW,EAAEA,WAAY;MACzBC,WAAW,EAAEA;IAAY,CAC1B;EAEJ,CACF,CAAC;AAEN","ignoreList":[]}
1
+ {"version":3,"file":"time-active.js","names":["React","FormattedMessage","Heartbeat","flatten","TripDetail","boldText","defaultEnglishMessages","defaultMessages","DefaultTimeActiveDetails","_ref","bikeMinutes","walkMinutes","createElement","defaultMessage","description","id","values","strong","TimeActive","_ref2","legs","TimeActiveDetails","showApproximateMinutesActive","walkDurationSeconds","bikeDurationSeconds","forEach","leg","mode","startsWith","duration","Math","round","minutesActive","className","icon","size","summary","approximatePrefix","minutes"],"sources":["../../src/components/time-active.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { FormattedMessage } from \"react-intl\";\nimport { Heartbeat } from \"@styled-icons/fa-solid/Heartbeat\";\nimport { Leg } from \"@opentripplanner/types\";\nimport flatten from \"flat\";\nimport TripDetail from \"../trip-detail\";\nimport { boldText } from \"../utils\";\nimport { TimeActiveDetailsProps } 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\n/**\n * Default rendering if no component is provided for the TimeActiveDetails\n * slot in the TripDetails component.\n */\nexport function 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\nexport default function TimeActive({\n legs,\n TimeActiveDetails,\n showApproximateMinutesActive\n}: {\n legs: Leg[];\n TimeActiveDetails: React.ComponentType<TimeActiveDetailsProps>;\n showApproximateMinutesActive: boolean;\n}): JSX.Element | null {\n let walkDurationSeconds = 0;\n let bikeDurationSeconds = 0;\n 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 if (minutesActive <= 0) return null;\n\n return (\n <TripDetail\n className=\"time-active\"\n icon={<Heartbeat size={17} />}\n summary={\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.minutesActive\"]}\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}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAwB,OAAO;AAC3C,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,SAAS,QAAQ,kCAAkC;AAE5D,OAAOC,OAAO,MAAM,MAAM;AAC1B,OAAOC,UAAU,MAAM,gBAAgB;AACvC,SAASC,QAAQ,QAAQ,UAAU;AAGnC;AACA,OAAOC,sBAAsB,MAAM,sBAAsB;;AAEzD;AACA;AACA;AACA;AACA,IAAMC,eAAuC,GAAGJ,OAAO,CAACG,sBAAsB,CAAC;;AAE/E;AACA;AACA;AACA;AACA,OAAO,SAASE,wBAAwBA,CAAAC,IAAA,EAGC;EAAA,IAFvCC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,WAAW,GAAAF,IAAA,CAAXE,WAAW;EAEX,oBACEX,KAAA,CAAAY,aAAA,CAACX,gBAAgB;IACfY,cAAc,EACZN,eAAe,CAAC,yCAAyC,CAC1D;IACDO,WAAW,EAAC,6DAA6D;IACzEC,EAAE,EAAC,yCAAyC;IAC5CC,MAAM,EAAE;MACNN,WAAW,EAAXA,WAAW;MACXO,MAAM,EAAEZ,QAAQ;MAChBM,WAAW,EAAXA;IACF;EAAE,CACH,CAAC;AAEN;AAEA,eAAe,SAASO,UAAUA,CAAAC,KAAA,EAQX;EAAA,IAPrBC,IAAI,GAAAD,KAAA,CAAJC,IAAI;IACJC,iBAAiB,GAAAF,KAAA,CAAjBE,iBAAiB;IACjBC,4BAA4B,GAAAH,KAAA,CAA5BG,4BAA4B;EAM5B,IAAIC,mBAAmB,GAAG,CAAC;EAC3B,IAAIC,mBAAmB,GAAG,CAAC;EAC3BJ,IAAI,CAACK,OAAO,CAAC,UAAAC,GAAG,EAAI;IAClB,IAAIA,GAAG,CAACC,IAAI,CAACC,UAAU,CAAC,MAAM,CAAC,EAAEL,mBAAmB,IAAIG,GAAG,CAACG,QAAQ;IACpE,IAAIH,GAAG,CAACC,IAAI,CAACC,UAAU,CAAC,SAAS,CAAC,EAAEJ,mBAAmB,IAAIE,GAAG,CAACG,QAAQ;EACzE,CAAC,CAAC;EACF,IAAMnB,WAAW,GAAGoB,IAAI,CAACC,KAAK,CAACP,mBAAmB,GAAG,EAAE,CAAC;EACxD,IAAMb,WAAW,GAAGmB,IAAI,CAACC,KAAK,CAACR,mBAAmB,GAAG,EAAE,CAAC;EACxD,IAAMS,aAAa,GAAGtB,WAAW,GAAGC,WAAW;EAE/C,IAAIqB,aAAa,IAAI,CAAC,EAAE,OAAO,IAAI;EAEnC,oBACEhC,KAAA,CAAAY,aAAA,CAACR,UAAU;IACT6B,SAAS,EAAC,aAAa;IACvBC,IAAI,eAAElC,KAAA,CAAAY,aAAA,CAACV,SAAS;MAACiC,IAAI,EAAE;IAAG,CAAE,CAAE;IAC9BC,OAAO,eACLpC,KAAA,CAAAY,aAAA,CAACX,gBAAgB;MACfY,cAAc,EAAEN,eAAe,CAAC,iCAAiC,CAAE;MACnEO,WAAW,EAAC,6EAA6E;MACzFC,EAAE,EAAC,iCAAiC;MACpCC,MAAM,EAAE;QACNqB,iBAAiB,EAAEf,4BAA4B;QAC/CgB,OAAO,EAAEN,aAAa;QACtBf,MAAM,EAAEZ;MACV;IAAE,CACH,CACF;IACDS,WAAW,EACTO,iBAAiB,iBACfrB,KAAA,CAAAY,aAAA,CAACS,iBAAiB;MAChBX,WAAW,EAAEA,WAAY;MACzBC,WAAW,EAAEA;IAAY,CAC1B;EAEJ,CACF,CAAC;AAEN","ignoreList":[]}
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ import { FormattedMessage } from "react-intl";
3
+ import { Clock } from "@styled-icons/fa-solid/Clock";
4
+ import flatten from "flat";
5
+ import TripDetail from "../trip-detail";
6
+ import { boldText } from "../utils";
7
+ import defaultEnglishMessages from "../../i18n/en-US.yml";
8
+ var defaultMessages = flatten(defaultEnglishMessages);
9
+
10
+ /** Time on board transit vehicles, excluding transfer activity and waiting. */
11
+ export default function TransitTime(_ref) {
12
+ var legs = _ref.legs;
13
+ var transitLegs = legs.filter(function (leg) {
14
+ return leg.transitLeg;
15
+ });
16
+ if (transitLegs.length === 0) return null;
17
+ var minutes = Math.round(transitLegs.reduce(function (seconds, leg) {
18
+ return seconds + leg.duration;
19
+ }, 0) / 60);
20
+ return /*#__PURE__*/React.createElement(TripDetail, {
21
+ className: "transit-time",
22
+ icon: /*#__PURE__*/React.createElement(Clock, {
23
+ size: 17
24
+ }),
25
+ summary: /*#__PURE__*/React.createElement(FormattedMessage, {
26
+ defaultMessage: defaultMessages["otpUi.TripDetails.transitTime"],
27
+ description: "Time spent on board transit vehicles, excluding transfers and waiting.",
28
+ id: "otpUi.TripDetails.transitTime",
29
+ values: {
30
+ minutes: minutes,
31
+ strong: boldText
32
+ }
33
+ })
34
+ });
35
+ }
36
+ //# sourceMappingURL=transit-time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transit-time.js","names":["React","FormattedMessage","Clock","flatten","TripDetail","boldText","defaultEnglishMessages","defaultMessages","TransitTime","_ref","legs","transitLegs","filter","leg","transitLeg","length","minutes","Math","round","reduce","seconds","duration","createElement","className","icon","size","summary","defaultMessage","description","id","values","strong"],"sources":["../../src/components/transit-time.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { FormattedMessage } from \"react-intl\";\nimport { Clock } from \"@styled-icons/fa-solid/Clock\";\nimport { Leg } from \"@opentripplanner/types\";\nimport flatten from \"flat\";\nimport TripDetail from \"../trip-detail\";\nimport { boldText } from \"../utils\";\n\nimport defaultEnglishMessages from \"../../i18n/en-US.yml\";\n\nconst defaultMessages: Record<string, string> = flatten(defaultEnglishMessages);\n\n/** Time on board transit vehicles, excluding transfer activity and waiting. */\nexport default function TransitTime({\n legs\n}: {\n legs: Leg[];\n}): ReactElement | null {\n const transitLegs = legs.filter(leg => leg.transitLeg);\n if (transitLegs.length === 0) return null;\n\n const minutes = Math.round(\n transitLegs.reduce((seconds, leg) => seconds + leg.duration, 0) / 60\n );\n\n return (\n <TripDetail\n className=\"transit-time\"\n icon={<Clock size={17} />}\n summary={\n <FormattedMessage\n defaultMessage={defaultMessages[\"otpUi.TripDetails.transitTime\"]}\n description=\"Time spent on board transit vehicles, excluding transfers and waiting.\"\n id=\"otpUi.TripDetails.transitTime\"\n values={{ minutes, strong: boldText }}\n />\n }\n />\n );\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAwB,OAAO;AAC3C,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,KAAK,QAAQ,8BAA8B;AAEpD,OAAOC,OAAO,MAAM,MAAM;AAC1B,OAAOC,UAAU,MAAM,gBAAgB;AACvC,SAASC,QAAQ,QAAQ,UAAU;AAEnC,OAAOC,sBAAsB,MAAM,sBAAsB;AAEzD,IAAMC,eAAuC,GAAGJ,OAAO,CAACG,sBAAsB,CAAC;;AAE/E;AACA,eAAe,SAASE,WAAWA,CAAAC,IAAA,EAIX;EAAA,IAHtBC,IAAI,GAAAD,IAAA,CAAJC,IAAI;EAIJ,IAAMC,WAAW,GAAGD,IAAI,CAACE,MAAM,CAAC,UAAAC,GAAG;IAAA,OAAIA,GAAG,CAACC,UAAU;EAAA,EAAC;EACtD,IAAIH,WAAW,CAACI,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI;EAEzC,IAAMC,OAAO,GAAGC,IAAI,CAACC,KAAK,CACxBP,WAAW,CAACQ,MAAM,CAAC,UAACC,OAAO,EAAEP,GAAG;IAAA,OAAKO,OAAO,GAAGP,GAAG,CAACQ,QAAQ;EAAA,GAAE,CAAC,CAAC,GAAG,EACpE,CAAC;EAED,oBACErB,KAAA,CAAAsB,aAAA,CAAClB,UAAU;IACTmB,SAAS,EAAC,cAAc;IACxBC,IAAI,eAAExB,KAAA,CAAAsB,aAAA,CAACpB,KAAK;MAACuB,IAAI,EAAE;IAAG,CAAE,CAAE;IAC1BC,OAAO,eACL1B,KAAA,CAAAsB,aAAA,CAACrB,gBAAgB;MACf0B,cAAc,EAAEpB,eAAe,CAAC,+BAA+B,CAAE;MACjEqB,WAAW,EAAC,wEAAwE;MACpFC,EAAE,EAAC,+BAA+B;MAClCC,MAAM,EAAE;QAAEd,OAAO,EAAPA,OAAO;QAAEe,MAAM,EAAE1B;MAAS;IAAE,CACvC;EACF,CACF,CAAC;AAEN","ignoreList":[]}
package/esm/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { FormattedMessage } from "react-intl";
3
3
  import { flatten } from "flat";
4
+ import coreUtils from "@opentripplanner/core-utils";
4
5
  import * as S from "./styled";
5
6
  import FlexBookingInfo from "./components/flex-booking-info";
6
7
  import FaresV2Table from "./components/fares-v2-table";
@@ -8,6 +9,7 @@ import Emissions from "./components/emissions";
8
9
  import Fares from "./components/fares";
9
10
  import TimeActive, { DefaultTimeActiveDetails } from "./components/time-active";
10
11
  import DepartureDate from "./components/departure-date";
12
+ import TransitTime from "./components/transit-time";
11
13
 
12
14
  // Load the default messages.
13
15
  import defaultEnglishMessages from "../i18n/en-US.yml";
@@ -25,6 +27,7 @@ function cn(className, arg1) {
25
27
  * Renders trip details such as departure instructions, fare amount, and minutes active.
26
28
  */
27
29
  export function TripDetails(_ref) {
30
+ var _timing$legs$;
28
31
  var _ref$className = _ref.className,
29
32
  className = _ref$className === void 0 ? "" : _ref$className,
30
33
  co2Config = _ref.co2Config,
@@ -34,9 +37,15 @@ export function TripDetails(_ref) {
34
37
  _ref$FareDetails = _ref.FareDetails,
35
38
  FareDetails = _ref$FareDetails === void 0 ? null : _ref$FareDetails,
36
39
  itinerary = _ref.itinerary,
40
+ mediumRiderWhitelist = _ref.mediumRiderWhitelist,
37
41
  showApproximateMinutesActive = _ref.showApproximateMinutesActive,
42
+ _ref$showTransitTime = _ref.showTransitTime,
43
+ showTransitTime = _ref$showTransitTime === void 0 ? false : _ref$showTransitTime,
38
44
  _ref$TimeActiveDetail = _ref.TimeActiveDetails,
39
- TimeActiveDetails = _ref$TimeActiveDetail === void 0 ? DefaultTimeActiveDetails : _ref$TimeActiveDetail;
45
+ TimeActiveDetails = _ref$TimeActiveDetail === void 0 ? DefaultTimeActiveDetails : _ref$TimeActiveDetail,
46
+ _ref$transitOnly = _ref.transitOnly,
47
+ transitOnly = _ref$transitOnly === void 0 ? false : _ref$transitOnly;
48
+ var timing = coreUtils.itinerary.getItinerarySummaryTiming(itinerary, transitOnly);
40
49
  return /*#__PURE__*/React.createElement(S.TripDetails, {
41
50
  className: cn(className, "trip-details")
42
51
  }, /*#__PURE__*/React.createElement(S.TripDetailsHeader, {
@@ -46,14 +55,18 @@ export function TripDetails(_ref) {
46
55
  description: "Title (heading) text of the component.",
47
56
  id: "otpUi.TripDetails.title"
48
57
  })), /*#__PURE__*/React.createElement(S.TripDetailsBody, null, /*#__PURE__*/React.createElement(DepartureDate, {
49
- itinerary: itinerary,
50
- DepartureDetails: DepartureDetails
58
+ startTime: timing.startTime,
59
+ DepartureDetails: DepartureDetails,
60
+ isBoarding: transitOnly && ((_timing$legs$ = timing.legs[0]) === null || _timing$legs$ === void 0 ? void 0 : _timing$legs$.transitLeg) === true
61
+ }), showTransitTime && /*#__PURE__*/React.createElement(TransitTime, {
62
+ legs: itinerary.legs
51
63
  }), /*#__PURE__*/React.createElement(Fares, {
52
64
  itinerary: itinerary,
53
65
  FareDetails: FareDetails,
54
- defaultFareType: defaultFareType
66
+ defaultFareType: defaultFareType,
67
+ mediumRiderWhitelist: mediumRiderWhitelist
55
68
  }), /*#__PURE__*/React.createElement(TimeActive, {
56
- itinerary: itinerary,
69
+ legs: timing.legs,
57
70
  TimeActiveDetails: TimeActiveDetails,
58
71
  showApproximateMinutesActive: showApproximateMinutesActive
59
72
  }), /*#__PURE__*/React.createElement(FlexBookingInfo, {
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","FormattedMessage","flatten","S","FlexBookingInfo","FaresV2Table","Emissions","Fares","TimeActive","DefaultTimeActiveDetails","DepartureDate","defaultEnglishMessages","defaultMessages","cn","className","arg1","concat","TripDetails","_ref","_ref$className","co2Config","defaultFareType","_ref$DepartureDetails","DepartureDetails","_ref$FareDetails","FareDetails","itinerary","showApproximateMinutesActive","_ref$TimeActiveDetail","TimeActiveDetails","createElement","TripDetailsHeader","id","defaultMessage","description","TripDetailsBody","Styled"],"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,OAAOA,KAAK,MAAwB,OAAO;AAC3C,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,OAAO,QAAQ,MAAM;AAC9B,OAAO,KAAKC,CAAC,MAAM,UAAU;AAE7B,OAAOC,eAAe,MAAM,gCAAgC;AAC5D,OAAOC,YAAY,MAAM,6BAA6B;AACtD,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,UAAU,IAAIC,wBAAwB,QAAQ,0BAA0B;AAC/E,OAAOC,aAAa,MAAM,6BAA6B;;AAEvD;AACA,OAAOC,sBAAsB,MAAM,mBAAmB;;AAEtD;AACA;AACA;AACA;AACA,IAAMC,eAAuC,GAAGV,OAAO,CAACS,sBAAsB,CAAC;AAE/E,SAASE,EAAEA,CAACC,SAAiB,EAAEC,IAAY,EAAU;EACnD,OAAOD,SAAS,MAAAE,MAAA,CAAMF,SAAS,OAAAE,MAAA,CAAID,IAAI,IAAKA,IAAI;AAClD;;AAEA;AACA;AACA;AACA,OAAO,SAASE,WAAWA,CAAAC,IAAA,EASQ;EAAA,IAAAC,c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,KAAA,CAAA8B,aAAA,CAACtB,UAAU;IACTkB,SAAS,EAAEA,SAAU;IACrBG,iBAAiB,EAAEA,iBAAkB;IACrCF,4BAA4B,EAAEA;EAA6B,CAC5D,CAAC,eACF3B,KAAA,CAAA8B,aAAA,CAAC1B,eAAe;IAACsB,SAAS,EAAEA;EAAU,CAAE,CAAC,eACzC1B,KAAA,CAAA8B,aAAA,CAACxB,SAAS;IAACoB,SAAS,EAAEA,SAAU;IAACN,SAAS,EAAEA;EAAU,CAAE,CACvC,CACN,CAAC;AAEpB;AAEA,eAAeH,WAAW;;AAE1B;AACA,SAASd,CAAC,IAAIiC,MAAM,EAAE/B,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","FormattedMessage","flatten","coreUtils","S","FlexBookingInfo","FaresV2Table","Emissions","Fares","TimeActive","DefaultTimeActiveDetails","DepartureDate","TransitTime","defaultEnglishMessages","defaultMessages","cn","className","arg1","concat","TripDetails","_ref","_timing$legs$","_ref$className","co2Config","defaultFareType","_ref$DepartureDetails","DepartureDetails","_ref$FareDetails","FareDetails","itinerary","mediumRiderWhitelist","showApproximateMinutesActive","_ref$showTransitTime","showTransitTime","_ref$TimeActiveDetail","TimeActiveDetails","_ref$transitOnly","transitOnly","timing","getItinerarySummaryTiming","createElement","TripDetailsHeader","id","defaultMessage","description","TripDetailsBody","startTime","isBoarding","legs","transitLeg","Styled"],"sources":["../src/index.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { FormattedMessage } from \"react-intl\";\nimport { flatten } from \"flat\";\nimport coreUtils from \"@opentripplanner/core-utils\";\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\";\nimport TransitTime from \"./components/transit-time\";\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 showTransitTime = false,\n TimeActiveDetails = DefaultTimeActiveDetails,\n transitOnly = false\n}: TripDetailsProps): ReactElement {\n const timing = coreUtils.itinerary.getItinerarySummaryTiming(\n itinerary,\n transitOnly\n );\n\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 startTime={timing.startTime}\n DepartureDetails={DepartureDetails}\n isBoarding={transitOnly && timing.legs[0]?.transitLeg === true}\n />\n {showTransitTime && <TransitTime legs={itinerary.legs} />}\n <Fares\n itinerary={itinerary}\n FareDetails={FareDetails}\n defaultFareType={defaultFareType}\n mediumRiderWhitelist={mediumRiderWhitelist}\n />\n <TimeActive\n legs={timing.legs}\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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AAW;IAACoC,IAAI,EAAEnB,SAAS,CAACmB;EAAK,CAAE,CAAC,eACzDhD,KAAA,CAAAwC,aAAA,CAAChC,KAAK;IACJqB,SAAS,EAAEA,SAAU;IACrBD,WAAW,EAAEA,WAAY;IACzBJ,eAAe,EAAEA,eAAgB;IACjCM,oBAAoB,EAAEA;EAAqB,CAC5C,CAAC,eACF9B,KAAA,CAAAwC,aAAA,CAAC/B,UAAU;IACTuC,IAAI,EAAEV,MAAM,CAACU,IAAK;IAClBb,iBAAiB,EAAEA,iBAAkB;IACrCJ,4BAA4B,EAAEA;EAA6B,CAC5D,CAAC,eACF/B,KAAA,CAAAwC,aAAA,CAACnC,eAAe;IAACwB,SAAS,EAAEA;EAAU,CAAE,CAAC,eACzC7B,KAAA,CAAAwC,aAAA,CAACjC,SAAS;IAACsB,SAAS,EAAEA,SAAU;IAACN,SAAS,EAAEA;EAAU,CAAE,CACvC,CACN,CAAC;AAEpB;AAEA,eAAeJ,WAAW;;AAE1B;AACA,SAASf,CAAC,IAAI8C,MAAM,EAAE5C,YAAY","ignoreList":[]}
package/esm/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 * Show time on board transit vehicles, excluding transfers and waiting.\n */\n showTransitTime?: boolean;\n /**\n * Slot for a custom component to render the expandable section for time active.\n */\n TimeActiveDetails?: React.ElementType<TimeActiveDetailsProps>;\n /**\n * Use the first transit departure and count only transfer activity between\n * the first and last transit legs.\n * Defaults to false. Trips without transit retain their full-journey timing.\n */\n transitOnly?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
package/i18n/en-US.yml CHANGED
@@ -1,5 +1,8 @@
1
1
  otpUi:
2
2
  TripDetails:
3
+ boarding: >-
4
+ Board <strong>{departureDate, date, long}</strong> at
5
+ <strong>{departureDate, time, short}</strong>
3
6
  co2: "CO₂ Emitted: <strong>{co2}</strong>"
4
7
  co2description: >-
5
8
  CO₂ intensity is calculated by multiplying the distance of each leg of a
@@ -27,4 +30,7 @@ otpUi:
27
30
  transitFare: Transit Fare
28
31
  transitFareEntry: "{name}: <strong>{value}</strong>"
29
32
  transitFareTable: Transit fares for this itinerary
33
+ transitTime: >-
34
+ Transit Time: <strong>{minutes, plural, one {# minute} other {#
35
+ minutes}}</strong>
30
36
  tripIncludesFlex: This trip includes flexible routes. {extraMessage}
package/i18n/fr.yml CHANGED
@@ -1,5 +1,8 @@
1
1
  otpUi:
2
2
  TripDetails:
3
+ boarding: >-
4
+ Embarquement le <strong>{departureDate, date, long}</strong> à
5
+ <strong>{departureDate, time, short}</strong>
3
6
  co2: "CO₂ émis : <strong>{co2}</strong>"
4
7
  co2description: >-
5
8
  L'intensité carbone est calculée en multipliant la distance de chaque
@@ -25,4 +28,7 @@ otpUi:
25
28
  transitFare: Tarif en transports
26
29
  transitFareEntry: "{name} : <strong>{value}</strong>"
27
30
  transitFareTable: Transit fares for this itinerary
31
+ transitTime: >-
32
+ Temps à bord : <strong>{minutes, plural, one {# minute} other {#
33
+ minutes}}</strong>
28
34
  tripIncludesFlex: Ce trajet comprend un service à la demande (Flex). {extraMessage}
@@ -2,9 +2,10 @@ import { Itinerary } from "@opentripplanner/types";
2
2
  import React, { ReactElement } from "react";
3
3
  import { DepartureDetailsProps } from "../types";
4
4
  interface DepartureDateProps {
5
- itinerary: Itinerary;
5
+ startTime: Itinerary["startTime"];
6
6
  DepartureDetails?: React.ElementType<DepartureDetailsProps>;
7
+ isBoarding: boolean;
7
8
  }
8
- export default function DepartureDate({ itinerary, DepartureDetails }: DepartureDateProps): ReactElement;
9
+ export default function DepartureDate({ startTime, DepartureDetails, isBoarding }: DepartureDateProps): ReactElement;
9
10
  export {};
10
11
  //# sourceMappingURL=departure-date.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"departure-date.d.ts","sourceRoot":"","sources":["../../src/components/departure-date.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAK5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAajD,UAAU,kBAAkB;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;CAC7D;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,SAAS,EACT,gBAAgB,EACjB,EAAE,kBAAkB,GAAG,YAAY,CAyBnC"}
1
+ {"version":3,"file":"departure-date.d.ts","sourceRoot":"","sources":["../../src/components/departure-date.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAK5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAajD,UAAU,kBAAkB;IAC1B,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAClC,gBAAgB,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAC5D,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,SAAS,EACT,gBAAgB,EAChB,UAAU,EACX,EAAE,kBAAkB,GAAG,YAAY,CAkCnC"}
@@ -22,10 +22,15 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
22
22
  // - the yaml loader for jest returns messages with flattened ids.
23
23
  const defaultMessages = (0, _flat.default)(_enUS.default);
24
24
  function DepartureDate({
25
- itinerary,
26
- DepartureDetails
25
+ startTime,
26
+ DepartureDetails,
27
+ isBoarding
27
28
  }) {
28
- const departureDate = new Date(itinerary.startTime);
29
+ const departureDate = new Date(startTime);
30
+ const values = {
31
+ departureDate,
32
+ strong: _utils.boldText
33
+ };
29
34
  return /*#__PURE__*/_react.default.createElement(_tripDetail.default, {
30
35
  className: "departure-date"
31
36
  // Any custom description for the Departure message needs to be handled by the slot.
@@ -36,14 +41,19 @@ function DepartureDate({
36
41
  icon: /*#__PURE__*/_react.default.createElement(_CalendarAlt.CalendarAlt, {
37
42
  size: 17
38
43
  }),
39
- summary: /*#__PURE__*/_react.default.createElement(S.Timing, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
44
+ summary:
45
+ /*#__PURE__*/
46
+ // TODO: is there a way to do this without `isBoarding`?
47
+ _react.default.createElement(S.Timing, null, isBoarding ? /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
48
+ defaultMessage: defaultMessages["otpUi.TripDetails.boarding"],
49
+ description: "Text showing when to board the first transit leg.",
50
+ id: "otpUi.TripDetails.boarding",
51
+ values: values
52
+ }) : /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
40
53
  defaultMessage: defaultMessages["otpUi.TripDetails.departure"],
41
54
  description: "Text showing the departure date/time for a trip.",
42
55
  id: "otpUi.TripDetails.departure",
43
- values: {
44
- departureDate,
45
- strong: _utils.boldText
46
- }
56
+ values: values
47
57
  }))
48
58
  });
49
59
  }