@opentripplanner/trip-details 9.0.5-alpha.2 → 9.0.6

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.
@@ -1,158 +1,191 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- /* eslint-disable no-underscore-dangle */
7
- const react_1 = __importDefault(require("react"));
8
- const core_utils_1 = __importDefault(require("@opentripplanner/core-utils"));
9
- const react_intl_1 = require("react-intl");
10
- const styled_components_1 = __importDefault(require("styled-components"));
11
- const Transfer_1 = require("@styled-icons/boxicons-regular/Transfer");
12
- const utils_1 = require("../utils");
13
- const styled_1 = require("../styled");
14
- // TODO: inline this import? (@opentripplanner/core-utils/src/itinerary)
15
- const { getLegCost, getItineraryCost, descope, getLegRouteName } = core_utils_1.default.itinerary;
16
- const FailDash = (react_1.default.createElement(react_1.default.Fragment, null,
17
- "-",
18
- react_1.default.createElement(styled_1.InvisibleA11yLabel, null,
19
- react_1.default.createElement(react_intl_1.FormattedMessage, { id: "otpUi.TripDetails.legMissingFareInfo" }))));
20
- const TransferIcon = (0, styled_components_1.default)(Transfer_1.Transfer) `
21
- padding-right: 0.25ch;
22
- `;
23
- const StripedTable = styled_components_1.default.table `
24
- text-align: right;
25
2
 
26
- tr td,
27
- tr th {
28
- padding: 4px;
29
- }
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _coreUtils = _interopRequireDefault(require("@opentripplanner/core-utils"));
10
+ var _reactIntl = require("react-intl");
11
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
12
+ var _Transfer = require("@styled-icons/boxicons-regular/Transfer");
13
+ var _utils = require("../utils");
14
+ var _styled = require("../styled");
15
+ /* eslint-disable no-underscore-dangle */
30
16
 
31
- tr td:nth-of-type(2n + 1),
32
- tr th:nth-of-type(2n) {
33
- background: #cccccc55;
34
- border-color: #cccccc55;
35
- }
36
- `;
17
+ // TODO: inline this import? (@opentripplanner/core-utils/src/itinerary)
18
+ const {
19
+ getLegCost,
20
+ getItineraryCost,
21
+ descope,
22
+ getLegRouteName
23
+ } = _coreUtils.default.itinerary;
24
+ const FailDash = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "-", /*#__PURE__*/_react.default.createElement(_styled.InvisibleA11yLabel, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
25
+ id: "otpUi.TripDetails.legMissingFareInfo"
26
+ })));
27
+ const TransferIcon = (0, _styledComponents.default)(_Transfer.Transfer).withConfig({
28
+ displayName: "fares-v2-table__TransferIcon",
29
+ componentId: "sc-h3t2h2-0"
30
+ })(["padding-right:0.25ch;"]);
31
+ const StripedTable = _styledComponents.default.table.withConfig({
32
+ displayName: "fares-v2-table__StripedTable",
33
+ componentId: "sc-h3t2h2-1"
34
+ })(["text-align:right;tr td,tr th{padding:4px;}tr td:nth-of-type(2n + 1),tr th:nth-of-type(2n){background:#cccccc55;border-color:#cccccc55;}"]);
37
35
  // Removes duplicates
38
36
  const categoryReducer = (acc, cur) => {
39
- if (!acc.some(m => descope(m === null || m === void 0 ? void 0 : m.id) === descope(cur === null || cur === void 0 ? void 0 : cur.id))) {
40
- acc.push(cur);
41
- }
42
- return acc;
37
+ if (!acc.some(m => descope(m === null || m === void 0 ? void 0 : m.id) === descope(cur === null || cur === void 0 ? void 0 : cur.id))) {
38
+ acc.push(cur);
39
+ }
40
+ return acc;
43
41
  };
42
+
44
43
  // Put the preferred medium first, and then all the others alphabetical
45
- const categorySorter = (favoriteId) => (a, b) => {
46
- const aId = descope(a === null || a === void 0 ? void 0 : a.id);
47
- const bId = descope(b === null || b === void 0 ? void 0 : b.id);
48
- if (favoriteId && aId === favoriteId) {
49
- return -1;
50
- }
51
- if (favoriteId && bId === favoriteId) {
52
- return 1;
53
- }
54
- return aId > bId ? 1 : -1;
44
+ const categorySorter = favoriteId => (a, b) => {
45
+ const aId = descope(a === null || a === void 0 ? void 0 : a.id);
46
+ const bId = descope(b === null || b === void 0 ? void 0 : b.id);
47
+ if (favoriteId && aId === favoriteId) {
48
+ return -1;
49
+ }
50
+ if (favoriteId && bId === favoriteId) {
51
+ return 1;
52
+ }
53
+ return aId > bId ? 1 : -1;
55
54
  };
55
+
56
56
  // TODO: This component currently can only show one type of fare per medium
57
- const FaresV2Table = ({ legs, favoriteMediumId, favoriteRiderCategoryId }) => {
58
- const intl = (0, react_intl_1.useIntl)();
59
- const transitLegs = legs.filter(leg => leg.transitLeg);
60
- // Get all fare products across all legs
61
- const fareProducts = transitLegs.flatMap(leg => leg.fareProducts);
62
- // Reduce these into mediums and riders
63
- const mediums = fareProducts
64
- .map(fp => { var _a; return (_a = fp.product) === null || _a === void 0 ? void 0 : _a.medium; })
65
- .filter(m => m !== null)
66
- .reduce(categoryReducer, [])
67
- .sort(categorySorter(favoriteMediumId));
68
- const riders = fareProducts
69
- .map(fp => { var _a; return (_a = fp.product) === null || _a === void 0 ? void 0 : _a.riderCategory; })
70
- .filter(r => r !== null)
71
- .reduce(categoryReducer, [])
72
- .sort(categorySorter(favoriteRiderCategoryId));
73
- // Ensure we have at least one rider/medium
74
- if (riders.length === 0) {
75
- riders.push({ name: "Fare", id: null });
76
- }
77
- if (mediums.length === 0) {
78
- mediums.push({ name: "Regular", id: null });
79
- }
80
- // Keep track of seen fare ids to indicate transfers
81
- const productUseIds = new Set();
82
- const rows = [
83
- [
84
- react_1.default.createElement("th", { key: "faretitle", style: { textAlign: "left" }, scope: "col" },
85
- react_1.default.createElement(styled_1.InvisibleA11yLabel, null,
86
- react_1.default.createElement(react_intl_1.FormattedMessage, { id: "otpUi.TripDetails.fareCategory" }))),
87
- ...transitLegs.map(leg => (react_1.default.createElement("th", { key: leg.tripId, scope: "col" }, getLegRouteName(leg)))),
88
- transitLegs.length > 1 ? (react_1.default.createElement("th", { key: "total", style: { textAlign: "right" }, scope: "col" },
89
- react_1.default.createElement("em", null,
90
- react_1.default.createElement(react_intl_1.FormattedMessage, { id: "otpUi.TripDetails.total" })))) : (react_1.default.createElement(react_1.default.Fragment, null))
91
- ]
92
- ];
93
- // non-transit legs don't have fares
94
- transitLegs.forEach((leg, index) => {
95
- mediums.forEach((medium, mediumIndex) => {
96
- riders.forEach((rider, riderIndex) => {
97
- var _a, _b, _c;
98
- if (!medium || !rider)
99
- return;
100
- const { alternateFareProducts, isDependent, appliedFareProduct, productUseId } = getLegCost(leg, descope(medium.id) || null, descope(rider.id) || null, Array.from(productUseIds));
101
- const legPrice = appliedFareProduct === null || appliedFareProduct === void 0 ? void 0 : appliedFareProduct.legPrice;
102
- productUseIds.add(productUseId);
103
- // Only consider alternateFareProducts if current product is dependent
104
- const dependentAlternateFareProducts = isDependent && alternateFareProducts;
105
- // Calculate pre-tranfer amount either via alternate fare or fare-id matching (price.originalAmount)
106
- const originalAmount = ((_a = dependentAlternateFareProducts === null || dependentAlternateFareProducts === void 0 ? void 0 : dependentAlternateFareProducts[0]) === null || _a === void 0 ? void 0 : _a.price.amount) -
107
- (legPrice === null || legPrice === void 0 ? void 0 : legPrice.amount) ||
108
- (appliedFareProduct === null || appliedFareProduct === void 0 ? void 0 : appliedFareProduct.price.amount) - (legPrice === null || legPrice === void 0 ? void 0 : legPrice.amount);
109
- const newCell = (react_1.default.createElement(react_1.default.Fragment, null,
110
- index === 0 && (react_1.default.createElement("th", { style: { textAlign: "left" }, scope: "row" },
111
- react_1.default.createElement(react_intl_1.FormattedMessage, { id: `config.fares.media.${descope(medium.id)}`, defaultMessage: medium.name }),
112
- " ",
113
- react_1.default.createElement(react_intl_1.FormattedMessage, { id: `config.fares.riderCategory.${descope(rider.id)}`, defaultMessage: rider.name }))),
114
- react_1.default.createElement("td", { style: { textAlign: legPrice ? "right" : "center" }, title: !Number.isNaN(originalAmount) &&
115
- originalAmount > 0 &&
116
- index > 0 &&
117
- intl.formatMessage({
118
- description: "Text explaining the transfer discount applied to this fare.",
119
- id: "otpUi.TripDetails.transferDiscountExplanation"
120
- }, {
121
- transferAmount: intl.formatNumber(originalAmount, {
122
- currency: (_b = legPrice === null || legPrice === void 0 ? void 0 : legPrice.currency) === null || _b === void 0 ? void 0 : _b.code,
123
- currencyDisplay: "narrowSymbol",
124
- style: "currency"
125
- })
126
- }) },
127
- !Number.isNaN(originalAmount) &&
128
- originalAmount > 0 &&
129
- index > 0 && react_1.default.createElement(TransferIcon, { size: 16 }),
130
- legPrice
131
- ? (0, utils_1.renderFare)((_c = legPrice === null || legPrice === void 0 ? void 0 : legPrice.currency) === null || _c === void 0 ? void 0 : _c.code, legPrice === null || legPrice === void 0 ? void 0 : legPrice.amount)
132
- : FailDash)));
133
- const currentRowIndex = 1 + riderIndex + riders.length * mediumIndex;
134
- if (!rows[currentRowIndex]) {
135
- rows[currentRowIndex] = [];
136
- }
137
- rows[currentRowIndex].push(newCell);
138
- // Generate final column
139
- if (index === transitLegs.length - 1 && transitLegs.length > 1) {
140
- const fare = getItineraryCost(legs, descope(medium.id) || null, descope(rider.id) || null);
141
- rows[currentRowIndex].push(react_1.default.createElement("td", { style: { textAlign: (fare === null || fare === void 0 ? void 0 : fare.amount) ? "right" : "center" }, title: !(fare === null || fare === void 0 ? void 0 : fare.amount) &&
142
- intl.formatMessage({
143
- id: "otpUi.TripDetails.missingFareTotal"
144
- }) },
145
- react_1.default.createElement("em", null, (fare === null || fare === void 0 ? void 0 : fare.amount)
146
- ? (0, utils_1.renderFare)(fare === null || fare === void 0 ? void 0 : fare.currency.code, fare === null || fare === void 0 ? void 0 : fare.amount)
147
- : FailDash)));
148
- }
149
- });
150
- });
57
+ const FaresV2Table = ({
58
+ legs,
59
+ favoriteMediumId,
60
+ favoriteRiderCategoryId
61
+ }) => {
62
+ const intl = (0, _reactIntl.useIntl)();
63
+ const transitLegs = legs.filter(leg => leg.transitLeg);
64
+
65
+ // Get all fare products across all legs
66
+ const fareProducts = transitLegs.flatMap(leg => leg.fareProducts);
67
+
68
+ // Reduce these into mediums and riders
69
+ const mediums = fareProducts.map(fp => {
70
+ var _fp$product;
71
+ return (_fp$product = fp.product) === null || _fp$product === void 0 ? void 0 : _fp$product.medium;
72
+ }).filter(m => m !== null).reduce(categoryReducer, []).sort(categorySorter(favoriteMediumId));
73
+ const riders = fareProducts.map(fp => {
74
+ var _fp$product2;
75
+ return (_fp$product2 = fp.product) === null || _fp$product2 === void 0 ? void 0 : _fp$product2.riderCategory;
76
+ }).filter(r => r !== null).reduce(categoryReducer, []).sort(categorySorter(favoriteRiderCategoryId));
77
+
78
+ // Ensure we have at least one rider/medium
79
+ if (riders.length === 0) {
80
+ riders.push({
81
+ name: "Fare",
82
+ id: null
83
+ });
84
+ }
85
+ if (mediums.length === 0) {
86
+ mediums.push({
87
+ name: "Regular",
88
+ id: null
89
+ });
90
+ }
91
+
92
+ // Keep track of seen fare ids to indicate transfers
93
+ const productUseIds = new Set();
94
+ const rows = [[/*#__PURE__*/_react.default.createElement("th", {
95
+ key: "faretitle",
96
+ style: {
97
+ textAlign: "left"
98
+ },
99
+ scope: "col"
100
+ }, /*#__PURE__*/_react.default.createElement(_styled.InvisibleA11yLabel, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
101
+ id: "otpUi.TripDetails.fareCategory"
102
+ }))), ...transitLegs.map(leg => /*#__PURE__*/_react.default.createElement("th", {
103
+ key: leg.tripId,
104
+ scope: "col"
105
+ }, getLegRouteName(leg))), transitLegs.length > 1 ? /*#__PURE__*/_react.default.createElement("th", {
106
+ key: "total",
107
+ style: {
108
+ textAlign: "right"
109
+ },
110
+ scope: "col"
111
+ }, /*#__PURE__*/_react.default.createElement("em", null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
112
+ id: "otpUi.TripDetails.total"
113
+ }))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null)]];
114
+
115
+ // non-transit legs don't have fares
116
+ transitLegs.forEach((leg, index) => {
117
+ mediums.forEach((medium, mediumIndex) => {
118
+ riders.forEach((rider, riderIndex) => {
119
+ var _dependentAlternateFa, _legPrice$currency, _legPrice$currency2;
120
+ if (!medium || !rider) return;
121
+ const {
122
+ alternateFareProducts,
123
+ isDependent,
124
+ appliedFareProduct,
125
+ productUseId
126
+ } = getLegCost(leg, descope(medium.id) || null, descope(rider.id) || null, Array.from(productUseIds));
127
+ const legPrice = appliedFareProduct === null || appliedFareProduct === void 0 ? void 0 : appliedFareProduct.legPrice;
128
+ productUseIds.add(productUseId);
129
+
130
+ // Only consider alternateFareProducts if current product is dependent
131
+ const dependentAlternateFareProducts = isDependent && alternateFareProducts;
132
+
133
+ // Calculate pre-tranfer amount either via alternate fare or fare-id matching (price.originalAmount)
134
+ const originalAmount = (dependentAlternateFareProducts === null || dependentAlternateFareProducts === void 0 || (_dependentAlternateFa = dependentAlternateFareProducts[0]) === null || _dependentAlternateFa === void 0 ? void 0 : _dependentAlternateFa.price.amount) - (legPrice === null || legPrice === void 0 ? void 0 : legPrice.amount) || (appliedFareProduct === null || appliedFareProduct === void 0 ? void 0 : appliedFareProduct.price.amount) - (legPrice === null || legPrice === void 0 ? void 0 : legPrice.amount);
135
+ const newCell = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, index === 0 && /*#__PURE__*/_react.default.createElement("th", {
136
+ style: {
137
+ textAlign: "left"
138
+ },
139
+ scope: "row"
140
+ }, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
141
+ id: `config.fares.media.${descope(medium.id)}`,
142
+ defaultMessage: medium.name
143
+ }), " ", /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
144
+ id: `config.fares.riderCategory.${descope(rider.id)}`,
145
+ defaultMessage: rider.name
146
+ })), /*#__PURE__*/_react.default.createElement("td", {
147
+ style: {
148
+ textAlign: legPrice ? "right" : "center"
149
+ },
150
+ title: !Number.isNaN(originalAmount) && originalAmount > 0 && index > 0 && intl.formatMessage({
151
+ description: "Text explaining the transfer discount applied to this fare.",
152
+ id: "otpUi.TripDetails.transferDiscountExplanation"
153
+ }, {
154
+ transferAmount: intl.formatNumber(originalAmount, {
155
+ currency: legPrice === null || legPrice === void 0 || (_legPrice$currency = legPrice.currency) === null || _legPrice$currency === void 0 ? void 0 : _legPrice$currency.code,
156
+ currencyDisplay: "narrowSymbol",
157
+ style: "currency"
158
+ })
159
+ })
160
+ }, !Number.isNaN(originalAmount) && originalAmount > 0 && index > 0 && /*#__PURE__*/_react.default.createElement(TransferIcon, {
161
+ size: 16
162
+ }), legPrice ? (0, _utils.renderFare)(legPrice === null || legPrice === void 0 || (_legPrice$currency2 = legPrice.currency) === null || _legPrice$currency2 === void 0 ? void 0 : _legPrice$currency2.code, legPrice === null || legPrice === void 0 ? void 0 : legPrice.amount) : FailDash));
163
+ const currentRowIndex = 1 + riderIndex + riders.length * mediumIndex;
164
+ if (!rows[currentRowIndex]) {
165
+ rows[currentRowIndex] = [];
166
+ }
167
+ rows[currentRowIndex].push(newCell);
168
+
169
+ // Generate final column
170
+ if (index === transitLegs.length - 1 && transitLegs.length > 1) {
171
+ const fare = getItineraryCost(legs, descope(medium.id) || null, descope(rider.id) || null);
172
+ rows[currentRowIndex].push(/*#__PURE__*/_react.default.createElement("td", {
173
+ style: {
174
+ textAlign: fare !== null && fare !== void 0 && fare.amount ? "right" : "center"
175
+ },
176
+ title: !(fare !== null && fare !== void 0 && fare.amount) && intl.formatMessage({
177
+ id: "otpUi.TripDetails.missingFareTotal"
178
+ })
179
+ }, /*#__PURE__*/_react.default.createElement("em", null, fare !== null && fare !== void 0 && fare.amount ? (0, _utils.renderFare)(fare === null || fare === void 0 ? void 0 : fare.currency.code, fare === null || fare === void 0 ? void 0 : fare.amount) : FailDash)));
180
+ }
181
+ });
151
182
  });
152
- return (react_1.default.createElement(StripedTable, null,
153
- react_1.default.createElement(styled_1.InvisibleA11yCaption, null,
154
- react_1.default.createElement(react_intl_1.FormattedMessage, { id: "otpUi.TripDetails.transitFareTable" })),
155
- rows.map((r, index) => (react_1.default.createElement("tr", { key: index }, r)))));
183
+ });
184
+ return /*#__PURE__*/_react.default.createElement(StripedTable, null, /*#__PURE__*/_react.default.createElement(_styled.InvisibleA11yCaption, null, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, {
185
+ id: "otpUi.TripDetails.transitFareTable"
186
+ })), rows.map((r, index) => /*#__PURE__*/_react.default.createElement("tr", {
187
+ key: index
188
+ }, r)));
156
189
  };
157
- exports.default = FaresV2Table;
190
+ var _default = exports.default = FaresV2Table;
158
191
  //# sourceMappingURL=fares-v2-table.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fares-v2-table.js","sourceRoot":"","sources":["../../src/components/fares-v2-table.tsx"],"names":[],"mappings":";;;;;AAAA,yCAAyC;AACzC,kDAA0B;AAE1B,6EAAoD;AACpD,2CAAuD;AACvD,0EAAuC;AACvC,sEAAmE;AAEnE,oCAAsC;AACtC,sCAAqE;AAErE,wEAAwE;AACxE,MAAM,EACJ,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,eAAe,EAChB,GAAG,oBAAS,CAAC,SAAS,CAAC;AAExB,MAAM,QAAQ,GAAG,CACf;;IAEE,8BAAC,2BAAkB;QACjB,8BAAC,6BAAgB,IAAC,EAAE,EAAC,sCAAsC,GAAG,CAC3C,CACpB,CACJ,CAAC;AAEF,MAAM,YAAY,GAAG,IAAA,2BAAM,EAAC,mBAAQ,CAAC,CAAA;;CAEpC,CAAC;AAEF,MAAM,YAAY,GAAG,2BAAM,CAAC,KAAK,CAAA;;;;;;;;;;;;;CAahC,CAAC;AAIF,qBAAqB;AACrB,MAAM,eAAe,GAAG,CAAC,GAAiB,EAAE,GAAe,EAAE,EAAE;IAC7D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,aAAD,CAAC,uBAAD,CAAC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I,CAAE,MAAM;4BACX,CAAC,CAAC,IAAA,kBAAU,EAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC;4BAC/C,CAAC,CAAC,QAAQ,CACT,CACF,CACN,CAAC;iBACH;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,8BAAC,YAAY;QACX,8BAAC,6BAAoB;YACnB,8BAAC,6BAAgB,IAAC,EAAE,EAAC,oCAAoC,GAAG,CACvC;QACtB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CACtB,sCAAI,GAAG,EAAE,KAAK,IAAG,CAAC,CAAM,CACzB,CAAC,CACW,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
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","r","length","name","productUseIds","Set","rows","key","style","textAlign","scope","tripId","forEach","index","mediumIndex","rider","riderIndex","_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","currentRowIndex","fare","InvisibleA11yCaption","_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\n// TODO: inline this import? (@opentripplanner/core-utils/src/itinerary)\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 .filter(m => m !== null)\n .reduce(categoryReducer, [])\n .sort(categorySorter(favoriteMediumId));\n const riders = fareProducts\n .map(fp => fp.product?.riderCategory)\n .filter(r => r !== null)\n .reduce(categoryReducer, [])\n .sort(categorySorter(favoriteRiderCategoryId));\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 mediums.forEach((medium, mediumIndex) => {\n riders.forEach((rider, riderIndex) => {\n if (!medium || !rider) return;\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 -\n 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 <FormattedMessage\n id={`config.fares.media.${descope(medium.id)}`}\n defaultMessage={medium.name}\n />{\" \"}\n <FormattedMessage\n id={`config.fares.riderCategory.${descope(rider.id)}`}\n defaultMessage={rider.name}\n />\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 currentRowIndex = 1 + riderIndex + riders.length * mediumIndex;\n if (!rows[currentRowIndex]) {\n rows[currentRowIndex] = [];\n }\n rows[currentRowIndex].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[currentRowIndex].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\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,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AATA;;AAWA;AACA,MAAM;EACJO,UAAU;EACVC,gBAAgB;EAChBC,OAAO;EACPC;AACF,CAAC,GAAGC,kBAAS,CAACC,SAAS;AAEvB,MAAMC,QAAQ,gBACZf,MAAA,CAAAgB,OAAA,CAAAC,aAAA,CAAAjB,MAAA,CAAAgB,OAAA,CAAAE,QAAA,QAAE,GAEA,eAAAlB,MAAA,CAAAgB,OAAA,CAAAC,aAAA,CAACT,OAAA,CAAAW,kBAAkB,qBACjBnB,MAAA,CAAAgB,OAAA,CAAAC,aAAA,CAACb,UAAA,CAAAgB,gBAAgB;EAACC,EAAE,EAAC;AAAsC,CAAE,CAC3C,CACpB,CACH;AAED,MAAMC,YAAY,GAAG,IAAAC,yBAAM,EAACC,kBAAQ,CAAC,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,6BAEpC;AAED,MAAMC,YAAY,GAAGL,yBAAM,CAACM,KAAK,CAAAJ,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+IAahC;AAID;AACA,MAAMG,eAAe,GAAGA,CAACC,GAAiB,EAAEC,GAAe,KAAK;EAC9D,IAAI,CAACD,GAAG,CAACE,IAAI,CAACC,CAA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