@opentripplanner/trip-details 9.1.1 → 9.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/components/fares-v2-table.js +3 -3
- package/esm/components/fares-v2-table.js.map +1 -1
- package/i18n/es.yml +2 -3
- package/i18n/ko.yml +1 -1
- package/i18n/ru.yml +5 -4
- package/i18n/tl.yml +2 -3
- package/i18n/vi.yml +3 -5
- package/i18n/zh_Hans.yml +2 -3
- package/i18n/zh_Hant.yml +2 -3
- package/lib/components/fares-v2-table.d.ts.map +1 -1
- package/lib/components/fares-v2-table.js +3 -3
- package/lib/components/fares-v2-table.js.map +1 -1
- package/package.json +3 -3
- package/src/__snapshots__/TripDetails.story.tsx.snap +50 -40
- package/src/components/fares-v2-table.tsx +4 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -184,15 +184,15 @@ var FaresV2Table = function FaresV2Table(_ref) {
|
|
|
184
184
|
// Generate final column
|
|
185
185
|
if (index === transitLegs.length - 1 && transitLegs.length > 1) {
|
|
186
186
|
var _medium$id2, _rider$id2;
|
|
187
|
-
var fare = getItineraryCost(legs, descope((_medium$id2 = medium === null || medium === void 0 ? void 0 : medium.id) !== null && _medium$id2 !== void 0 ? _medium$id2 : null), descope((_rider$id2 = rider === null || rider === void 0 ? void 0 : rider.id) !== null && _rider$id2 !== void 0 ? _rider$id2 : null));
|
|
187
|
+
var fare = getItineraryCost(legs, descope((_medium$id2 = medium === null || medium === void 0 ? void 0 : medium.id) !== null && _medium$id2 !== void 0 ? _medium$id2 : null), descope((_rider$id2 = rider === null || rider === void 0 ? void 0 : rider.id) !== null && _rider$id2 !== void 0 ? _rider$id2 : null), true);
|
|
188
188
|
rows[nextRowIndex].push(/*#__PURE__*/React.createElement("td", {
|
|
189
189
|
style: {
|
|
190
190
|
textAlign: fare !== null && fare !== void 0 && fare.amount ? "right" : "center"
|
|
191
191
|
},
|
|
192
|
-
title:
|
|
192
|
+
title: (fare === null || fare === void 0 ? void 0 : fare.amount) === undefined && intl.formatMessage({
|
|
193
193
|
id: "otpUi.TripDetails.missingFareTotal"
|
|
194
194
|
})
|
|
195
|
-
}, /*#__PURE__*/React.createElement("em", null, fare
|
|
195
|
+
}, /*#__PURE__*/React.createElement("em", null, (fare === null || fare === void 0 ? void 0 : fare.amount) !== undefined ? renderFare(fare === null || fare === void 0 ? void 0 : fare.currency.code, fare === null || fare === void 0 ? void 0 : fare.amount) : FailDash)));
|
|
196
196
|
}
|
|
197
197
|
});
|
|
198
198
|
});
|
|
@@ -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","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)}\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 );\n rows[nextRowIndex].push(\n <td\n style={{ textAlign: fare?.amount ? \"right\" : \"center\" }}\n title={\n !fare?.amount &&\n intl.formatMessage({\n id: \"otpUi.TripDetails.missingFareTotal\"\n })\n }\n >\n <em>\n {fare?.amount\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;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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,EACtBqD,IAAI,CAACrB,GAAG,CAAC,UAACmE,CAAC,EAAErC,KAAK;IAAA,oBACjBhF,KAAA,CAAAgB,aAAA;MAAIwD,GAAG,EAAEQ;IAAM,GAAEqC,CAAM,CAAC;EAAA,CACzB,CACW,CAAC;AAEnB,CAAC;AAED,eAAehF,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","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)}\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,SAA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A,IAAI,CAAEjB,MAAM,CAAC,GAC7CpF,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,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":[]}
|
package/i18n/es.yml
CHANGED
|
@@ -21,9 +21,8 @@ otpUi:
|
|
|
21
21
|
{# minuto} other {# minutos}}</strong> en bicicleta.
|
|
22
22
|
title: Detalles del viaje
|
|
23
23
|
tncFare: "{companies} Tarifa: <strong>{minTNCFare} - {maxTNCFare}</strong>"
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
total: Total
|
|
25
|
+
transferDiscountExplanation: Se aplica un descuento de transferencia de {transferAmount}
|
|
26
26
|
transitFare: Tarifa de tránsito
|
|
27
27
|
transitFareEntry: "{name} : <strong>{value}</strong>"
|
|
28
28
|
tripIncludesFlex: Este viaje incluye rutas flexibles. {extraMessage}
|
|
29
|
-
total: Total
|
package/i18n/ko.yml
CHANGED
|
@@ -19,8 +19,8 @@ otpUi:
|
|
|
19
19
|
<strong>{bikeMinutes} 분</strong> 소요됩니다.
|
|
20
20
|
title: 트립 상세정보
|
|
21
21
|
tncFare: "{companies} 운임: <strong>{minTNCFare} - {maxTNCFare}</strong>"
|
|
22
|
+
total: 총
|
|
22
23
|
transferDiscountExplanation: 환승 할인 {transferAmount} 적용
|
|
23
24
|
transitFare: 대중 교통 운임
|
|
24
25
|
transitFareEntry: "{name} : <strong>{value}</strong>"
|
|
25
26
|
tripIncludesFlex: 이 트립에는 가변 경로가 포함되어 있습니다. {extraMessage}
|
|
26
|
-
total: 총
|
package/i18n/ru.yml
CHANGED
|
@@ -21,10 +21,11 @@ otpUi:
|
|
|
21
21
|
минуту} other {# минуты}}</strong> на ходьбу и<strong>{bikeMinutes,
|
|
22
22
|
plural, one {# минуту} other {# минуты}}</strong> на езду на велосипеде.
|
|
23
23
|
title: Подробные сведения о поездке
|
|
24
|
-
tncFare:
|
|
25
|
-
|
|
26
|
-
{
|
|
24
|
+
tncFare: >-
|
|
25
|
+
Стоимость проезда в компаниях {companies}: <strong>{minTNCFare} —
|
|
26
|
+
{maxTNCFare}</strong>
|
|
27
|
+
total: Всего
|
|
28
|
+
transferDiscountExplanation: Применяется скидка на пересадку в размере {transferAmount}
|
|
27
29
|
transitFare: Стоимость проезда в общественном транспорте
|
|
28
30
|
transitFareEntry: "{name}: <strong>{value}</strong>"
|
|
29
31
|
tripIncludesFlex: Эта поездка включает гибкие маршруты. {extraMessage}
|
|
30
|
-
total: Всего
|
package/i18n/tl.yml
CHANGED
|
@@ -22,9 +22,8 @@ otpUi:
|
|
|
22
22
|
minuto</strong> sa pagbibisikleta.
|
|
23
23
|
title: Mga Detalye ng Biyahe
|
|
24
24
|
tncFare: "{companies} Pamasahe: <strong>{minTNCFare} - {maxTNCFare}</strong>"
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
total: Kabuuan
|
|
26
|
+
transferDiscountExplanation: Inilapat ang diskwento sa paglipat na {transferAmount}
|
|
27
27
|
transitFare: Pamasahe sa Pampublikong Transportasyon
|
|
28
28
|
transitFareEntry: "{name}: <strong>{value}</strong>"
|
|
29
29
|
tripIncludesFlex: May mga flexible na ruta ang biyaheng ito. {extraMessage}
|
|
30
|
-
total: Kabuuan
|
package/i18n/vi.yml
CHANGED
|
@@ -21,10 +21,8 @@ otpUi:
|
|
|
21
21
|
đạp.
|
|
22
22
|
title: Chi tiết chuyến đi
|
|
23
23
|
tncFare: "{companies} Giá vé: <strong>{minTNCFare} - {maxTNCFare}</strong>"
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
total: Tổng
|
|
25
|
+
transferDiscountExplanation: Giảm giá chuyển khoản {transferAmount} được áp dụng
|
|
26
26
|
transitFare: Giá vé xe công cộng
|
|
27
27
|
transitFareEntry: "{name}: <strong>{value}</strong>"
|
|
28
|
-
tripIncludesFlex: Chuyến đi này bao gồm các tuyến đường linh hoạt.
|
|
29
|
-
{extraMessage}
|
|
30
|
-
total: Tổng
|
|
28
|
+
tripIncludesFlex: Chuyến đi này bao gồm các tuyến đường linh hoạt. {extraMessage}
|
package/i18n/zh_Hans.yml
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
otpUi:
|
|
2
2
|
TripDetails:
|
|
3
3
|
co2: "排放的二氧化碳: <strong>{co2}</strong>"
|
|
4
|
-
co2description: CO₂ 强度的计算方法是将行程的每条腿的距离乘以每种模式的 CO₂ 强度。
|
|
5
|
-
每种模式的二氧化碳强度来自<link>此电子表格</link>。
|
|
4
|
+
co2description: CO₂ 强度的计算方法是将行程的每条腿的距离乘以每种模式的 CO₂ 强度。 每种模式的二氧化碳强度来自<link>此电子表格</link>。
|
|
6
5
|
departure: >-
|
|
7
6
|
<strong>{departureDate, date, long}</strong> <strong>{departureDate, time,
|
|
8
7
|
short}</strong> 出发
|
|
@@ -18,8 +17,8 @@ otpUi:
|
|
|
18
17
|
分钟</strong>。
|
|
19
18
|
title: 行程详情
|
|
20
19
|
tncFare: "{companies} 票价: <strong>{minTNCFare} - {maxTNCFare}</strong>"
|
|
20
|
+
total: 总计
|
|
21
21
|
transferDiscountExplanation: 应用了 {transferAmount} 的转让折扣
|
|
22
22
|
transitFare: 公共交通费
|
|
23
23
|
transitFareEntry: "{name}: <strong>{value}</strong>"
|
|
24
24
|
tripIncludesFlex: 这个行程包括灵活的路线. {extraMessage}
|
|
25
|
-
total: 总计
|
package/i18n/zh_Hant.yml
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
otpUi:
|
|
2
2
|
TripDetails:
|
|
3
3
|
co2: 排放的二氧化碳:<strong>{co2}</strong>
|
|
4
|
-
co2description:
|
|
5
|
-
二氧化碳密度是以一個行程每條腿的距離乘以各個模式的二氧化碳密度來計算。各個模式的二氧化碳密度是從<link>此試算表</link>中取得。
|
|
4
|
+
co2description: 二氧化碳密度是以一個行程每條腿的距離乘以各個模式的二氧化碳密度來計算。各個模式的二氧化碳密度是從<link>此試算表</link>中取得。
|
|
6
5
|
departure: >-
|
|
7
6
|
<strong>{departureDate, date, long}</strong>的<strong>{departureDate, time,
|
|
8
7
|
short}</strong>出發
|
|
@@ -14,8 +13,8 @@ otpUi:
|
|
|
14
13
|
<strong>{bikeMinutes} 分鐘</strong> 的自行車騎乘時間。
|
|
15
14
|
title: 行程詳細資訊
|
|
16
15
|
tncFare: "{companies} 票價:<strong>{minTNCFare} - {maxTNCFare}</strong>"
|
|
16
|
+
total: 總計
|
|
17
17
|
transferDiscountExplanation: 已套用{transferAmount}的轉乘折扣
|
|
18
18
|
transitFare: 公共交通票價
|
|
19
19
|
transitFareEntry: "{name}:<strong>{value}</strong>"
|
|
20
20
|
tripIncludesFlex: 此行程包括彈性的路線。{extraMessage}
|
|
21
|
-
total: 總計
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fares-v2-table.d.ts","sourceRoot":"","sources":["../../src/components/fares-v2-table.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAyE7C,QAAA,MAAM,YAAY,GAAI,qDAInB;IACD,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,KAAG,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"fares-v2-table.d.ts","sourceRoot":"","sources":["../../src/components/fares-v2-table.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAyE7C,QAAA,MAAM,YAAY,GAAI,qDAInB;IACD,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,KAAG,GAAG,CAAC,OAqMP,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -180,15 +180,15 @@ const FaresV2Table = ({
|
|
|
180
180
|
// Generate final column
|
|
181
181
|
if (index === transitLegs.length - 1 && transitLegs.length > 1) {
|
|
182
182
|
var _medium$id2, _rider$id2;
|
|
183
|
-
const fare = getItineraryCost(legs, descope((_medium$id2 = medium === null || medium === void 0 ? void 0 : medium.id) !== null && _medium$id2 !== void 0 ? _medium$id2 : null), descope((_rider$id2 = rider === null || rider === void 0 ? void 0 : rider.id) !== null && _rider$id2 !== void 0 ? _rider$id2 : null));
|
|
183
|
+
const fare = getItineraryCost(legs, descope((_medium$id2 = medium === null || medium === void 0 ? void 0 : medium.id) !== null && _medium$id2 !== void 0 ? _medium$id2 : null), descope((_rider$id2 = rider === null || rider === void 0 ? void 0 : rider.id) !== null && _rider$id2 !== void 0 ? _rider$id2 : null), true);
|
|
184
184
|
rows[nextRowIndex].push(/*#__PURE__*/_react.default.createElement("td", {
|
|
185
185
|
style: {
|
|
186
186
|
textAlign: fare !== null && fare !== void 0 && fare.amount ? "right" : "center"
|
|
187
187
|
},
|
|
188
|
-
title:
|
|
188
|
+
title: (fare === null || fare === void 0 ? void 0 : fare.amount) === undefined && intl.formatMessage({
|
|
189
189
|
id: "otpUi.TripDetails.missingFareTotal"
|
|
190
190
|
})
|
|
191
|
-
}, /*#__PURE__*/_react.default.createElement("em", null, fare
|
|
191
|
+
}, /*#__PURE__*/_react.default.createElement("em", null, (fare === null || fare === void 0 ? void 0 : fare.amount) !== undefined ? (0, _utils.renderFare)(fare === null || fare === void 0 ? void 0 : fare.currency.code, fare === null || fare === void 0 ? void 0 : fare.amount) : FailDash)));
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
194
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fares-v2-table.js","names":["_react","_interopRequireDefault","require","_coreUtils","_reactIntl","_styledComponents","_Transfer","_utils","_styled","getLegCost","getItineraryCost","descope","getLegRouteName","coreUtils","itinerary","FailDash","default","createElement","Fragment","InvisibleA11yLabel","FormattedMessage","id","TransferIcon","styled","Transfer","withConfig","displayName","componentId","StripedTable","table","categoryReducer","acc","cur","some","m","push","categorySorter","favoriteId","a","b","aId","bId","FaresV2Table","legs","favoriteMediumId","favoriteRiderCategoryId","intl","useIntl","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","tripId","forEach","index","currentRowIndex","_medium$id","_rider$id","_dependentAlternateFa","_legPrice$currency","_legPrice$currency2","alternateFareProducts","isDependent","appliedFareProduct","productUseId","Array","from","legPrice","add","dependentAlternateFareProducts","originalAmount","price","amount","newCell","defaultMessage","title","Number","isNaN","formatMessage","description","transferAmount","formatNumber","currency","code","currencyDisplay","size","renderFare","nextRowIndex","_medium$id2","_rider$id2","fare","InvisibleA11yCaption","r","_default","exports"],"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)}\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 );\n rows[nextRowIndex].push(\n <td\n style={{ textAlign: fare?.amount ? \"right\" : \"center\" }}\n title={\n !fare?.amount &&\n intl.formatMessage({\n id: \"otpUi.TripDetails.missingFareTotal\"\n })\n }\n >\n <em>\n {fare?.amount\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"],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C,OAAA,CAAA3G,OAAA,GAEa0B,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"fares-v2-table.js","names":["_react","_interopRequireDefault","require","_coreUtils","_reactIntl","_styledComponents","_Transfer","_utils","_styled","getLegCost","getItineraryCost","descope","getLegRouteName","coreUtils","itinerary","FailDash","default","createElement","Fragment","InvisibleA11yLabel","FormattedMessage","id","TransferIcon","styled","Transfer","withConfig","displayName","componentId","StripedTable","table","categoryReducer","acc","cur","some","m","push","categorySorter","favoriteId","a","b","aId","bId","FaresV2Table","legs","favoriteMediumId","favoriteRiderCategoryId","intl","useIntl","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","tripId","forEach","index","currentRowIndex","_medium$id","_rider$id","_dependentAlternateFa","_legPrice$currency","_legPrice$currency2","alternateFareProducts","isDependent","appliedFareProduct","productUseId","Array","from","legPrice","add","dependentAlternateFareProducts","originalAmount","price","amount","newCell","defaultMessage","title","Number","isNaN","formatMessage","description","transferAmount","formatNumber","currency","code","currencyDisplay","size","renderFare","nextRowIndex","_medium$id2","_rider$id2","fare","undefined","InvisibleA11yCaption","r","_default","exports"],"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)}\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":";;;;;;;AACA,IAAAA,MAAA,GAAA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AAC,QAAA,GAAAC,OAAA,CAAA5G,OAAA,GAEa0B,YAAY","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentripplanner/trip-details",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.3",
|
|
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",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"@styled-icons/fa-solid": "^10.34.0",
|
|
16
16
|
"flat": "^5.0.2",
|
|
17
17
|
"react-animate-height": "^3.0.4",
|
|
18
|
-
"@opentripplanner/core-utils": "
|
|
18
|
+
"@opentripplanner/core-utils": "^16.0.3"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@opentripplanner/types": "8.
|
|
21
|
+
"@opentripplanner/types": "^8.4.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": "^18.2.0",
|
|
@@ -1440,14 +1440,9 @@ exports[`TripDetails FaresV2TableStory smoke-test 1`] = `
|
|
|
1440
1440
|
<td style="text-align: right;">
|
|
1441
1441
|
$0.00
|
|
1442
1442
|
</td>
|
|
1443
|
-
<td
|
|
1444
|
-
style="text-align: center;"
|
|
1445
|
-
>
|
|
1443
|
+
<td style="text-align: center;">
|
|
1446
1444
|
<em>
|
|
1447
|
-
|
|
1448
|
-
<span class="styled__InvisibleA11yLabel-sc-6q2ok2-0 elLeWK">
|
|
1449
|
-
No fare information for this leg
|
|
1450
|
-
</span>
|
|
1445
|
+
$0.00
|
|
1451
1446
|
</em>
|
|
1452
1447
|
</td>
|
|
1453
1448
|
</tr>
|
|
@@ -1472,9 +1467,14 @@ exports[`TripDetails FaresV2TableStory smoke-test 1`] = `
|
|
|
1472
1467
|
<td style="text-align: right;">
|
|
1473
1468
|
$0.00
|
|
1474
1469
|
</td>
|
|
1475
|
-
<td
|
|
1470
|
+
<td title="No fare total available"
|
|
1471
|
+
style="text-align: center;"
|
|
1472
|
+
>
|
|
1476
1473
|
<em>
|
|
1477
|
-
|
|
1474
|
+
-
|
|
1475
|
+
<span class="styled__InvisibleA11yLabel-sc-6q2ok2-0 elLeWK">
|
|
1476
|
+
No fare information for this leg
|
|
1477
|
+
</span>
|
|
1478
1478
|
</em>
|
|
1479
1479
|
</td>
|
|
1480
1480
|
</tr>
|
|
@@ -1499,9 +1499,14 @@ exports[`TripDetails FaresV2TableStory smoke-test 1`] = `
|
|
|
1499
1499
|
<td style="text-align: right;">
|
|
1500
1500
|
$0.00
|
|
1501
1501
|
</td>
|
|
1502
|
-
<td
|
|
1502
|
+
<td title="No fare total available"
|
|
1503
|
+
style="text-align: center;"
|
|
1504
|
+
>
|
|
1503
1505
|
<em>
|
|
1504
|
-
|
|
1506
|
+
-
|
|
1507
|
+
<span class="styled__InvisibleA11yLabel-sc-6q2ok2-0 elLeWK">
|
|
1508
|
+
No fare information for this leg
|
|
1509
|
+
</span>
|
|
1505
1510
|
</em>
|
|
1506
1511
|
</td>
|
|
1507
1512
|
</tr>
|
|
@@ -1526,9 +1531,14 @@ exports[`TripDetails FaresV2TableStory smoke-test 1`] = `
|
|
|
1526
1531
|
<td style="text-align: right;">
|
|
1527
1532
|
$0.00
|
|
1528
1533
|
</td>
|
|
1529
|
-
<td
|
|
1534
|
+
<td title="No fare total available"
|
|
1535
|
+
style="text-align: center;"
|
|
1536
|
+
>
|
|
1530
1537
|
<em>
|
|
1531
|
-
|
|
1538
|
+
-
|
|
1539
|
+
<span class="styled__InvisibleA11yLabel-sc-6q2ok2-0 elLeWK">
|
|
1540
|
+
No fare information for this leg
|
|
1541
|
+
</span>
|
|
1532
1542
|
</em>
|
|
1533
1543
|
</td>
|
|
1534
1544
|
</tr>
|
|
@@ -1585,14 +1595,9 @@ exports[`TripDetails FaresV2TableStory smoke-test 1`] = `
|
|
|
1585
1595
|
<td style="text-align: right;">
|
|
1586
1596
|
$0.00
|
|
1587
1597
|
</td>
|
|
1588
|
-
<td
|
|
1589
|
-
style="text-align: center;"
|
|
1590
|
-
>
|
|
1598
|
+
<td style="text-align: center;">
|
|
1591
1599
|
<em>
|
|
1592
|
-
|
|
1593
|
-
<span class="styled__InvisibleA11yLabel-sc-6q2ok2-0 elLeWK">
|
|
1594
|
-
No fare information for this leg
|
|
1595
|
-
</span>
|
|
1600
|
+
$0.00
|
|
1596
1601
|
</em>
|
|
1597
1602
|
</td>
|
|
1598
1603
|
</tr>
|
|
@@ -1754,9 +1759,14 @@ exports[`TripDetails LegFareProductsItinerary smoke-test 1`] = `
|
|
|
1754
1759
|
<td style="text-align: right;">
|
|
1755
1760
|
$0.00
|
|
1756
1761
|
</td>
|
|
1757
|
-
<td
|
|
1762
|
+
<td title="No fare total available"
|
|
1763
|
+
style="text-align: center;"
|
|
1764
|
+
>
|
|
1758
1765
|
<em>
|
|
1759
|
-
|
|
1766
|
+
-
|
|
1767
|
+
<span class="styled__InvisibleA11yLabel-sc-6q2ok2-0 elLeWK">
|
|
1768
|
+
No fare information for this leg
|
|
1769
|
+
</span>
|
|
1760
1770
|
</em>
|
|
1761
1771
|
</td>
|
|
1762
1772
|
</tr>
|
|
@@ -1781,9 +1791,14 @@ exports[`TripDetails LegFareProductsItinerary smoke-test 1`] = `
|
|
|
1781
1791
|
<td style="text-align: right;">
|
|
1782
1792
|
$0.00
|
|
1783
1793
|
</td>
|
|
1784
|
-
<td
|
|
1794
|
+
<td title="No fare total available"
|
|
1795
|
+
style="text-align: center;"
|
|
1796
|
+
>
|
|
1785
1797
|
<em>
|
|
1786
|
-
|
|
1798
|
+
-
|
|
1799
|
+
<span class="styled__InvisibleA11yLabel-sc-6q2ok2-0 elLeWK">
|
|
1800
|
+
No fare information for this leg
|
|
1801
|
+
</span>
|
|
1787
1802
|
</em>
|
|
1788
1803
|
</td>
|
|
1789
1804
|
</tr>
|
|
@@ -1808,9 +1823,14 @@ exports[`TripDetails LegFareProductsItinerary smoke-test 1`] = `
|
|
|
1808
1823
|
<td style="text-align: right;">
|
|
1809
1824
|
$0.00
|
|
1810
1825
|
</td>
|
|
1811
|
-
<td
|
|
1826
|
+
<td title="No fare total available"
|
|
1827
|
+
style="text-align: center;"
|
|
1828
|
+
>
|
|
1812
1829
|
<em>
|
|
1813
|
-
|
|
1830
|
+
-
|
|
1831
|
+
<span class="styled__InvisibleA11yLabel-sc-6q2ok2-0 elLeWK">
|
|
1832
|
+
No fare information for this leg
|
|
1833
|
+
</span>
|
|
1814
1834
|
</em>
|
|
1815
1835
|
</td>
|
|
1816
1836
|
</tr>
|
|
@@ -1912,14 +1932,9 @@ exports[`TripDetails LegFareProductsItinerary smoke-test 1`] = `
|
|
|
1912
1932
|
<td style="text-align: right;">
|
|
1913
1933
|
$0.00
|
|
1914
1934
|
</td>
|
|
1915
|
-
<td
|
|
1916
|
-
style="text-align: center;"
|
|
1917
|
-
>
|
|
1935
|
+
<td style="text-align: center;">
|
|
1918
1936
|
<em>
|
|
1919
|
-
|
|
1920
|
-
<span class="styled__InvisibleA11yLabel-sc-6q2ok2-0 elLeWK">
|
|
1921
|
-
No fare information for this leg
|
|
1922
|
-
</span>
|
|
1937
|
+
$0.00
|
|
1923
1938
|
</em>
|
|
1924
1939
|
</td>
|
|
1925
1940
|
</tr>
|
|
@@ -1944,14 +1959,9 @@ exports[`TripDetails LegFareProductsItinerary smoke-test 1`] = `
|
|
|
1944
1959
|
<td style="text-align: right;">
|
|
1945
1960
|
$0.00
|
|
1946
1961
|
</td>
|
|
1947
|
-
<td
|
|
1948
|
-
style="text-align: center;"
|
|
1949
|
-
>
|
|
1962
|
+
<td style="text-align: center;">
|
|
1950
1963
|
<em>
|
|
1951
|
-
|
|
1952
|
-
<span class="styled__InvisibleA11yLabel-sc-6q2ok2-0 elLeWK">
|
|
1953
|
-
No fare information for this leg
|
|
1954
|
-
</span>
|
|
1964
|
+
$0.00
|
|
1955
1965
|
</em>
|
|
1956
1966
|
</td>
|
|
1957
1967
|
</tr>
|
|
@@ -244,20 +244,21 @@ const FaresV2Table = ({
|
|
|
244
244
|
const fare = getItineraryCost(
|
|
245
245
|
legs,
|
|
246
246
|
descope(medium?.id ?? null),
|
|
247
|
-
descope(rider?.id ?? null)
|
|
247
|
+
descope(rider?.id ?? null),
|
|
248
|
+
true
|
|
248
249
|
);
|
|
249
250
|
rows[nextRowIndex].push(
|
|
250
251
|
<td
|
|
251
252
|
style={{ textAlign: fare?.amount ? "right" : "center" }}
|
|
252
253
|
title={
|
|
253
|
-
|
|
254
|
+
fare?.amount === undefined &&
|
|
254
255
|
intl.formatMessage({
|
|
255
256
|
id: "otpUi.TripDetails.missingFareTotal"
|
|
256
257
|
})
|
|
257
258
|
}
|
|
258
259
|
>
|
|
259
260
|
<em>
|
|
260
|
-
{fare?.amount
|
|
261
|
+
{fare?.amount !== undefined
|
|
261
262
|
? renderFare(fare?.currency.code, fare?.amount)
|
|
262
263
|
: FailDash}
|
|
263
264
|
</em>
|