@opentripplanner/core-utils 4.11.0 → 4.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/deprecated.js CHANGED
@@ -1,7 +1,15 @@
1
- import moment from "moment"; // Need to avoid cyclic dependency resolution
1
+ import moment from "moment";
2
+ /**
3
+ * To disable cyclic dependency resolution we need to require() within methods
4
+ * This is a good reason to disable this eslint-rule
5
+ */
2
6
 
3
7
  /* eslint-disable global-require */
4
8
 
9
+ /**
10
+ * Generates a warning to tell developer that they are using deprecated methods!
11
+ */
12
+
5
13
  export function logDeprecationWarning(method, alternative) {
6
14
  console.warn("".concat(method || "This method", " is deprecated and will be removed in a future otp-ui release. All language functionality should be handled using react-intl.\n ").concat(alternative ? "\n\n Use ".concat(alternative, " instead, which provides a new interface that doesn't return English strings.") : ""));
7
15
  } // itinerary.js
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/deprecated.js"],"names":["moment","logDeprecationWarning","method","alternative","console","warn","getStepDirection","step","relativeDirection","absoluteDirection","toLowerCase","getStepInstructions","conjunction","streetName","getStepStreetName","getLegModeLabel","leg","mode","hailedCar","routeLongName","indexOf","require","toSentenceCase","getModeForPlace","place","vertexType","getPlaceName","companies","address","split","networks","company","getCompanyForNetwork","label","name","getTransitFare","fareComponent","digits","transitFare","symbol","currencyCode","currency","defaultFractionDigits","cents","centsToString","dollars","toFixed","dollarsToString","calculateFares","itinerary","multiple","minTNCFare","maxTNCFare","tncCurrencyCode","legs","forEach","tncData","maxCost","minCost","transitFares","fare","Object","keys","fareKey","regular","transitCurrencyCode","latlngToString","latlng","lat","lng","lon","coordsToString","coords","length","map","c","join","getDetailText","location","detailText","type","id","timestamp","fromNow","summarizeQuery","query","locations","findLocationType","ls","types","match","find","l","matchLatLon","from","to","hasTransit"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,QAAnB,C,CAEA;;AACA;;AACA,OAAO,SAASC,qBAAT,CAA+BC,MAA/B,EAA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AiBwE,WAAjB,CAA6BD,CAA7B,EAAgCd,QAAhC,CAAJ;AAAA,KAAT,CAAd;AACA,WAAOY,KAAK,IAAID,KAAK,CAACrE,OAAN,CAAcsE,KAAK,CAACV,IAApB,MAA8B,CAAC,CAAxC,GAA4CU,KAAK,CAACV,IAAlD,GAAyD,IAAhE;AACD;;AAED,MAAMc,IAAI,GACRP,gBAAgB,CAACF,KAAK,CAACS,IAAP,EAAaR,SAAb,CAAhB,IAA2CD,KAAK,CAACS,IAAN,CAAW5D,IAAX,CAAgBL,KAAhB,CAAsB,GAAtB,EAA2B,CAA3B,CAD7C;AAEA,MAAMkE,EAAE,GACNR,gBAAgB,CAACF,KAAK,CAACU,EAAP,EAAWT,SAAX,CAAhB,IAAyCD,KAAK,CAACU,EAAN,CAAS7D,IAAT,CAAcL,KAAd,CAAoB,GAApB,EAAyB,CAAzB,CAD3C;AAEA,MAAMZ,IAAI,GAAGI,OAAO,CAAC,aAAD,CAAP,CAAuB2E,UAAvB,CAAkCX,KAAK,CAACpE,IAAxC,IACT,SADS,GAETI,OAAO,CAAC,aAAD,CAAP,CAAuBC,cAAvB,CAAsC+D,KAAK,CAACpE,IAA5C,CAFJ;AAGA,mBAAUA,IAAV,mBAAuB6E,IAAvB,iBAAkCC,EAAlC;AACD","sourcesContent":["import moment from \"moment\";\n\n// Need to avoid cyclic dependency resolution\n/* eslint-disable global-require */\nexport function logDeprecationWarning(method, alternative) {\n console.warn(\n `${method ||\n \"This method\"} is deprecated and will be removed in a future otp-ui release. All language functionality should be handled using react-intl.\n ${\n alternative\n ? `\n\n Use ${alternative} instead, which provides a new interface that doesn't return English strings.`\n : \"\"\n }`\n );\n}\n\n// itinerary.js\n\nexport function getStepDirection(step) {\n logDeprecationWarning(\"getStepDirection\");\n\n switch (step.relativeDirection) {\n case \"DEPART\":\n return `Head ${step.absoluteDirection.toLowerCase()}`;\n case \"LEFT\":\n return \"Left\";\n case \"HARD_LEFT\":\n return \"Hard left\";\n case \"SLIGHTLY_LEFT\":\n return \"Slight left\";\n case \"CONTINUE\":\n return \"Continue\";\n case \"SLIGHTLY_RIGHT\":\n return \"Slight right\";\n case \"RIGHT\":\n return \"Right\";\n case \"HARD_RIGHT\":\n return \"Hard right\";\n case \"CIRCLE_CLOCKWISE\":\n return \"Follow circle clockwise\";\n case \"CIRCLE_COUNTERCLOCKWISE\":\n return \"Follow circle counterclockwise\";\n case \"ELEVATOR\":\n return \"Take elevator\";\n case \"UTURN_LEFT\":\n return \"Left U-turn\";\n case \"UTURN_RIGHT\":\n return \"Right U-turn\";\n default:\n return step.relativeDirection;\n }\n}\n\nexport function getStepInstructions(step) {\n logDeprecationWarning(\"getStepInstructions\");\n\n const conjunction = step.relativeDirection === \"ELEVATOR\" ? \"to\" : \"on\";\n return `${getStepDirection(step)} ${conjunction} ${step.streetName}`;\n}\n\nexport function getStepStreetName(step) {\n logDeprecationWarning(\"getStepStreetName\");\n\n if (step.streetName === \"road\") return \"Unnamed Road\";\n if (step.streetName === \"path\") return \"Unnamed Path\";\n return step.streetName;\n}\n\nexport function getLegModeLabel(leg) {\n logDeprecationWarning(\"getLegModeLabel\");\n\n switch (leg.mode) {\n case \"BICYCLE_RENT\":\n return \"Biketown\";\n case \"CAR\":\n return leg.hailedCar ? \"Ride\" : \"Drive\";\n case \"GONDOLA\":\n return \"Aerial Tram\";\n case \"TRAM\":\n if (leg.routeLongName.toLowerCase().indexOf(\"streetcar\") !== -1)\n return \"Streetcar\";\n return \"Light Rail\";\n case \"MICROMOBILITY\":\n return \"Ride\";\n default:\n return require(\"./itinerary\").toSentenceCase(leg.mode);\n }\n}\n\n/**\n * Returns mode name by checking the vertex type (VertexType class in OTP) for\n * the provided place. NOTE: this is currently only intended for vehicles at\n * the moment (not transit or walking).\n *\n * @param {string} place place from itinerary leg\n */\nexport function getModeForPlace(place) {\n logDeprecationWarning(\"getModeForPlace\");\n\n switch (place.vertexType) {\n case \"CARSHARE\":\n return \"car\";\n case \"VEHICLERENTAL\":\n return \"E-scooter\";\n // TODO: Should the type change depending on bike vertex type?\n case \"BIKESHARE\":\n case \"BIKEPARK\":\n return \"bike\";\n // If company offers more than one mode, default to `vehicle` string.\n default:\n return \"vehicle\";\n }\n}\n\nexport function getPlaceName(place, companies) {\n logDeprecationWarning(\"getPlaceName\");\n\n // If address is provided (i.e. for carshare station, use it)\n if (place.address) return place.address.split(\",\")[0];\n if (place.networks && place.vertexType === \"VEHICLERENTAL\") {\n // For vehicle rental pick up, do not use the place name. Rather, use\n // company name + vehicle type (e.g., SPIN E-scooter). Place name is often just\n // a UUID that has no relevance to the actual vehicle. For bikeshare, however,\n // there are often hubs or bikes that have relevant names to the user.\n const company = require(\"./itinerary\").getCompanyForNetwork(\n place.networks[0],\n companies\n );\n if (company) {\n return `${company.label} ${getModeForPlace(place)}`;\n }\n }\n // Default to place name\n return place.name;\n}\n\n/**\n * For a given fare component (either total fare or component parts), returns\n * an object with string formatters and the fare value (in cents).\n */\nexport function getTransitFare(fareComponent) {\n logDeprecationWarning(\"getTransitFare\", \"the fare object and getTncFare\");\n\n // Default values (if fare component is not valid).\n let digits = 2;\n let transitFare = 0;\n let symbol = \"$\";\n let currencyCode = \"USD\";\n if (fareComponent) {\n // Assign values without declaration. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#assignment_without_declaration\n ({\n currencyCode,\n defaultFractionDigits: digits,\n symbol\n } = fareComponent.currency);\n transitFare = fareComponent.cents;\n }\n // For cents to string conversion, use digits from fare component.\n const centsToString = cents => {\n const dollars = (cents / 10 ** digits).toFixed(digits);\n return `${symbol}${dollars}`;\n };\n // For dollars to string conversion, assume we're rounding to two digits.\n const dollarsToString = dollars => `${symbol}${dollars.toFixed(2)}`;\n return {\n centsToString,\n currencyCode,\n dollarsToString,\n transitFare\n };\n}\n\n/**\n * For an itinerary, calculates the transit/TNC fares and returns an object with\n * these values, currency info, as well as string formatters.\n * It is assumed that the same currency is used for transit and TNC legs.\n *\n * multiple being set to true will change the output behavior:\n * - dollarsToString and centsToString will be returned as part of each fare\n * - currencyCode will be returned separately for each fare\n * - tnc currency code will be returned separately\n * - each fare type will be returned separately within a new transitFares property\n *\n * FIXME: a new approach to fare calculation must be found:\n * the current approach is not sustainable, as centsToString and DollarsToString\n * must be replaced by i18n anyway.\n *\n * However, the current behavior should ideally be kept to avoid a breaking change.\n * The \"multiple\" mode is helpful, but only prevents tnc fare calculation from being duplicated.\n * This method could be split out into a new one, along with tnc fare calculation.\n * If this is done, the individual fare calculation should also be modified to support\n * a default fare not being called \"regular\". However, this again would be a breaking change.\n * This breaking change is avoided by adding the \"multiple\" parameter.\n *\n * When centsToString and dollarsToString are removed, this method should be split into\n * individual fare calculation on a variable fare key, fare calculation of an entire leg,\n * which will get fares for every fare key in the leg, and a method to calculate the fare of\n * a tnc ride within the leg. This will make typescripting easier, as the types will be cleaner.\n */\nexport function calculateFares(itinerary, multiple = false) {\n logDeprecationWarning(\"calculateFares\", \"the fare object and getTncFare\");\n\n // Process any TNC fares\n let minTNCFare = 0;\n let maxTNCFare = 0;\n let tncCurrencyCode;\n itinerary.legs.forEach(leg => {\n if (leg.mode === \"CAR\" && leg.hailedCar && leg.tncData) {\n const { currency, maxCost, minCost } = leg.tncData;\n // TODO: Support non-USD\n minTNCFare += minCost;\n maxTNCFare += maxCost;\n tncCurrencyCode = currency;\n }\n });\n\n if (multiple) {\n // Return object of fares\n const transitFares = {};\n if (itinerary && itinerary.fare && itinerary.fare.fare) {\n Object.keys(itinerary.fare.fare).forEach(fareKey => {\n const fareComponent = itinerary.fare.fare[fareKey];\n transitFares[fareKey] = getTransitFare(fareComponent);\n });\n }\n\n return {\n maxTNCFare,\n minTNCFare,\n tncCurrencyCode,\n transitFares\n };\n }\n\n // Extract fare total from itinerary fares.\n const fareComponent =\n itinerary.fare && itinerary.fare.fare && itinerary.fare.fare.regular;\n // Get string formatters and itinerary fare.\n const {\n centsToString,\n currencyCode: transitCurrencyCode,\n dollarsToString,\n transitFare\n } = getTransitFare(fareComponent);\n\n return {\n centsToString,\n currencyCode: transitCurrencyCode || tncCurrencyCode,\n dollarsToString,\n maxTNCFare,\n minTNCFare,\n transitFare\n };\n}\n\n// map.js\n\nexport function latlngToString(latlng) {\n logDeprecationWarning(\"latlngToString\", \"the latlng object\");\n\n return (\n latlng &&\n `${latlng.lat.toFixed(5)}, ${(latlng.lng || latlng.lon).toFixed(5)}`\n );\n}\n\nexport function coordsToString(coords) {\n logDeprecationWarning(\"coordsToString\", \"the coords object\");\n\n return coords.length && coords.map(c => (+c).toFixed(5)).join(\", \");\n}\n\nexport function getDetailText(location) {\n let detailText;\n if (location.type === \"home\" || location.type === \"work\") {\n detailText = location.name;\n }\n if (location.type === \"stop\") {\n detailText = location.id;\n } else if (location.type === \"recent\" && location.timestamp) {\n detailText = moment(location.timestamp).fromNow();\n }\n return detailText;\n}\n\n// query.js\n\nexport function summarizeQuery(query, locations = []) {\n logDeprecationWarning(\"summarizeQuery\");\n\n function findLocationType(\n location,\n ls = [],\n types = [\"home\", \"work\", \"suggested\"]\n ) {\n const match = ls.find(l => require(\"./map\").matchLatLon(l, location));\n return match && types.indexOf(match.type) !== -1 ? match.type : null;\n }\n\n const from =\n findLocationType(query.from, locations) || query.from.name.split(\",\")[0];\n const to =\n findLocationType(query.to, locations) || query.to.name.split(\",\")[0];\n const mode = require(\"./itinerary\").hasTransit(query.mode)\n ? \"Transit\"\n : require(\"./itinerary\").toSentenceCase(query.mode);\n return `${mode} from ${from} to ${to}`;\n}\n"],"file":"deprecated.js"}
1
+ {"version":3,"sources":["../src/deprecated.js"],"names":["moment","logDeprecationWarning","method","alternative","console","warn","getStepDirection","step","relativeDirection","absoluteDirection","toLowerCase","getStepInstructions","conjunction","streetName","getStepStreetName","getLegModeLabel","leg","mode","hailedCar","routeLongName","indexOf","require","toSentenceCase","getModeForPlace","place","vertexType","getPlaceName","companies","address","split","networks","company","getCompanyForNetwork","label","name","getTransitFare","fareComponent","digits","transitFare","symbol","currencyCode","currency","defaultFractionDigits","cents","centsToString","dollars","toFixed","dollarsToString","calculateFares","itinerary","multiple","minTNCFare","maxTNCFare","tncCurrencyCode","legs","forEach","tncData","maxCost","minCost","transitFares","fare","Object","keys","fareKey","regular","transitCurrencyCode","latlngToString","latlng","lat","lng","lon","coordsToString","coords","length","map","c","join","getDetailText","location","detailText","type","id","timestamp","fromNow","summarizeQuery","query","locations","findLocationType","ls","types","match","find","l","matchLatLon","from","to","hasTransit"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,QAAnB;AAEA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;;AACA,OAAO,SAASC,qBAAT,CAA+BC,MAA/B,EAAuCC,WAAvC,EAAoD;AACzDC,EAAAA,OAAO,CAACC,IAAR,WACKH,MAAM,IACP,aAFJ,oJAIQC,WAAW,6BAGPA,WAHO,qFAIP,EARZ;AAWD,C,CAED;;AAEA,OAAO,SAASG,gBAAT,CAA0BC,IAA1B,EAAgC;AACrCN,EAAAA,qBAAqB,CAAC,kBAAD,CAArB;;AAEA,UAAQM,IAAI,CAACC,iBAAb;AACE,SAAK,QAAL;AACE,4BAAeD,IAAI,CAACE,iBAAL,CAAuBC,WAAvB,EAAf;;AACF,SAAK,MAAL;AACE,aAAO,MAAP;;AACF,SAAK,WAAL;AACE,aAAO,WAAP;;AACF,SAAK,eAAL;AACE,aAAO,aAAP;;AACF,SAAK,UAAL;AACE,aAAO,UAAP;;AACF,SAAK,gBAAL;AACE,aAAO,cAAP;;AACF,SAAK,OAAL;AACE,aAAO,OAAP;;AACF,SAAK,YAAL;AACE,aAAO,YAAP;;AACF,SAAK,kBAAL;AACE,aAAO,yBAAP;;AACF,SAAK,yBAAL;AACE,aAAO,gCAAP;;AACF,SAAK,UAAL;AACE,aAAO,eAAP;;AACF,SAAK,YAAL;AACE,aAAO,aAAP;;AACF,SAAK,aAAL;AACE,aAAO,cAAP;;AACF;AACE,aAAOH,IAAI,CAACC,iBAAZ;AA5BJ;AA8BD;AAED,OAAO,SAASG,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n/**\n * To disable cyclic dependency resolution we need to require() within methods\n * This is a good reason to disable this eslint-rule\n */\n/* eslint-disable global-require */\n\n/**\n * Generates a warning to tell developer that they are using deprecated methods!\n */\nexport function logDeprecationWarning(method, alternative) {\n console.warn(\n `${method ||\n \"This method\"} is deprecated and will be removed in a future otp-ui release. All language functionality should be handled using react-intl.\n ${\n alternative\n ? `\n\n Use ${alternative} instead, which provides a new interface that doesn't return English strings.`\n : \"\"\n }`\n );\n}\n\n// itinerary.js\n\nexport function getStepDirection(step) {\n logDeprecationWarning(\"getStepDirection\");\n\n switch (step.relativeDirection) {\n case \"DEPART\":\n return `Head ${step.absoluteDirection.toLowerCase()}`;\n case \"LEFT\":\n return \"Left\";\n case \"HARD_LEFT\":\n return \"Hard left\";\n case \"SLIGHTLY_LEFT\":\n return \"Slight left\";\n case \"CONTINUE\":\n return \"Continue\";\n case \"SLIGHTLY_RIGHT\":\n return \"Slight right\";\n case \"RIGHT\":\n return \"Right\";\n case \"HARD_RIGHT\":\n return \"Hard right\";\n case \"CIRCLE_CLOCKWISE\":\n return \"Follow circle clockwise\";\n case \"CIRCLE_COUNTERCLOCKWISE\":\n return \"Follow circle counterclockwise\";\n case \"ELEVATOR\":\n return \"Take elevator\";\n case \"UTURN_LEFT\":\n return \"Left U-turn\";\n case \"UTURN_RIGHT\":\n return \"Right U-turn\";\n default:\n return step.relativeDirection;\n }\n}\n\nexport function getStepInstructions(step) {\n logDeprecationWarning(\"getStepInstructions\");\n\n const conjunction = step.relativeDirection === \"ELEVATOR\" ? \"to\" : \"on\";\n return `${getStepDirection(step)} ${conjunction} ${step.streetName}`;\n}\n\nexport function getStepStreetName(step) {\n logDeprecationWarning(\"getStepStreetName\");\n\n if (step.streetName === \"road\") return \"Unnamed Road\";\n if (step.streetName === \"path\") return \"Unnamed Path\";\n return step.streetName;\n}\n\nexport function getLegModeLabel(leg) {\n logDeprecationWarning(\"getLegModeLabel\");\n\n switch (leg.mode) {\n case \"BICYCLE_RENT\":\n return \"Biketown\";\n case \"CAR\":\n return leg.hailedCar ? \"Ride\" : \"Drive\";\n case \"GONDOLA\":\n return \"Aerial Tram\";\n case \"TRAM\":\n if (leg.routeLongName.toLowerCase().indexOf(\"streetcar\") !== -1)\n return \"Streetcar\";\n return \"Light Rail\";\n case \"MICROMOBILITY\":\n return \"Ride\";\n default:\n return require(\"./itinerary\").toSentenceCase(leg.mode);\n }\n}\n\n/**\n * Returns mode name by checking the vertex type (VertexType class in OTP) for\n * the provided place. NOTE: this is currently only intended for vehicles at\n * the moment (not transit or walking).\n *\n * @param {string} place place from itinerary leg\n */\nexport function getModeForPlace(place) {\n logDeprecationWarning(\"getModeForPlace\");\n\n switch (place.vertexType) {\n case \"CARSHARE\":\n return \"car\";\n case \"VEHICLERENTAL\":\n return \"E-scooter\";\n // TODO: Should the type change depending on bike vertex type?\n case \"BIKESHARE\":\n case \"BIKEPARK\":\n return \"bike\";\n // If company offers more than one mode, default to `vehicle` string.\n default:\n return \"vehicle\";\n }\n}\n\nexport function getPlaceName(place, companies) {\n logDeprecationWarning(\"getPlaceName\");\n\n // If address is provided (i.e. for carshare station, use it)\n if (place.address) return place.address.split(\",\")[0];\n if (place.networks && place.vertexType === \"VEHICLERENTAL\") {\n // For vehicle rental pick up, do not use the place name. Rather, use\n // company name + vehicle type (e.g., SPIN E-scooter). Place name is often just\n // a UUID that has no relevance to the actual vehicle. For bikeshare, however,\n // there are often hubs or bikes that have relevant names to the user.\n const company = require(\"./itinerary\").getCompanyForNetwork(\n place.networks[0],\n companies\n );\n if (company) {\n return `${company.label} ${getModeForPlace(place)}`;\n }\n }\n // Default to place name\n return place.name;\n}\n\n/**\n * For a given fare component (either total fare or component parts), returns\n * an object with string formatters and the fare value (in cents).\n */\nexport function getTransitFare(fareComponent) {\n logDeprecationWarning(\"getTransitFare\", \"the fare object and getTncFare\");\n\n // Default values (if fare component is not valid).\n let digits = 2;\n let transitFare = 0;\n let symbol = \"$\";\n let currencyCode = \"USD\";\n if (fareComponent) {\n // Assign values without declaration. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#assignment_without_declaration\n ({\n currencyCode,\n defaultFractionDigits: digits,\n symbol\n } = fareComponent.currency);\n transitFare = fareComponent.cents;\n }\n // For cents to string conversion, use digits from fare component.\n const centsToString = cents => {\n const dollars = (cents / 10 ** digits).toFixed(digits);\n return `${symbol}${dollars}`;\n };\n // For dollars to string conversion, assume we're rounding to two digits.\n const dollarsToString = dollars => `${symbol}${dollars.toFixed(2)}`;\n return {\n centsToString,\n currencyCode,\n dollarsToString,\n transitFare\n };\n}\n\n/**\n * For an itinerary, calculates the transit/TNC fares and returns an object with\n * these values, currency info, as well as string formatters.\n * It is assumed that the same currency is used for transit and TNC legs.\n *\n * multiple being set to true will change the output behavior:\n * - dollarsToString and centsToString will be returned as part of each fare\n * - currencyCode will be returned separately for each fare\n * - tnc currency code will be returned separately\n * - each fare type will be returned separately within a new transitFares property\n *\n * FIXME: a new approach to fare calculation must be found:\n * the current approach is not sustainable, as centsToString and DollarsToString\n * must be replaced by i18n anyway.\n *\n * However, the current behavior should ideally be kept to avoid a breaking change.\n * The \"multiple\" mode is helpful, but only prevents tnc fare calculation from being duplicated.\n * This method could be split out into a new one, along with tnc fare calculation.\n * If this is done, the individual fare calculation should also be modified to support\n * a default fare not being called \"regular\". However, this again would be a breaking change.\n * This breaking change is avoided by adding the \"multiple\" parameter.\n *\n * When centsToString and dollarsToString are removed, this method should be split into\n * individual fare calculation on a variable fare key, fare calculation of an entire leg,\n * which will get fares for every fare key in the leg, and a method to calculate the fare of\n * a tnc ride within the leg. This will make typescripting easier, as the types will be cleaner.\n */\nexport function calculateFares(itinerary, multiple = false) {\n logDeprecationWarning(\"calculateFares\", \"the fare object and getTncFare\");\n\n // Process any TNC fares\n let minTNCFare = 0;\n let maxTNCFare = 0;\n let tncCurrencyCode;\n itinerary.legs.forEach(leg => {\n if (leg.mode === \"CAR\" && leg.hailedCar && leg.tncData) {\n const { currency, maxCost, minCost } = leg.tncData;\n // TODO: Support non-USD\n minTNCFare += minCost;\n maxTNCFare += maxCost;\n tncCurrencyCode = currency;\n }\n });\n\n if (multiple) {\n // Return object of fares\n const transitFares = {};\n if (itinerary && itinerary.fare && itinerary.fare.fare) {\n Object.keys(itinerary.fare.fare).forEach(fareKey => {\n const fareComponent = itinerary.fare.fare[fareKey];\n transitFares[fareKey] = getTransitFare(fareComponent);\n });\n }\n\n return {\n maxTNCFare,\n minTNCFare,\n tncCurrencyCode,\n transitFares\n };\n }\n\n // Extract fare total from itinerary fares.\n const fareComponent =\n itinerary.fare && itinerary.fare.fare && itinerary.fare.fare.regular;\n // Get string formatters and itinerary fare.\n const {\n centsToString,\n currencyCode: transitCurrencyCode,\n dollarsToString,\n transitFare\n } = getTransitFare(fareComponent);\n\n return {\n centsToString,\n currencyCode: transitCurrencyCode || tncCurrencyCode,\n dollarsToString,\n maxTNCFare,\n minTNCFare,\n transitFare\n };\n}\n\n// map.js\n\nexport function latlngToString(latlng) {\n logDeprecationWarning(\"latlngToString\", \"the latlng object\");\n\n return (\n latlng &&\n `${latlng.lat.toFixed(5)}, ${(latlng.lng || latlng.lon).toFixed(5)}`\n );\n}\n\nexport function coordsToString(coords) {\n logDeprecationWarning(\"coordsToString\", \"the coords object\");\n\n return coords.length && coords.map(c => (+c).toFixed(5)).join(\", \");\n}\n\nexport function getDetailText(location) {\n let detailText;\n if (location.type === \"home\" || location.type === \"work\") {\n detailText = location.name;\n }\n if (location.type === \"stop\") {\n detailText = location.id;\n } else if (location.type === \"recent\" && location.timestamp) {\n detailText = moment(location.timestamp).fromNow();\n }\n return detailText;\n}\n\n// query.js\n\nexport function summarizeQuery(query, locations = []) {\n logDeprecationWarning(\"summarizeQuery\");\n\n function findLocationType(\n location,\n ls = [],\n types = [\"home\", \"work\", \"suggested\"]\n ) {\n const match = ls.find(l => require(\"./map\").matchLatLon(l, location));\n return match && types.indexOf(match.type) !== -1 ? match.type : null;\n }\n\n const from =\n findLocationType(query.from, locations) || query.from.name.split(\",\")[0];\n const to =\n findLocationType(query.to, locations) || query.to.name.split(\",\")[0];\n const mode = require(\"./itinerary\").hasTransit(query.mode)\n ? \"Transit\"\n : require(\"./itinerary\").toSentenceCase(query.mode);\n return `${mode} from ${from} to ${to}`;\n}\n"],"file":"deprecated.js"}
package/esm/profile.js CHANGED
@@ -29,7 +29,7 @@ export function filterProfileOptions(response) {
29
29
  }
30
30
 
31
31
  function locationString(str) {
32
- return str ? str.split(",")[0] : null;
32
+ return str === null || str === void 0 ? void 0 : str.split(",")[0];
33
33
  }
34
34
 
35
35
  function accessToLeg(access, origin, destination) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/profile.js"],"names":["filterProfileOptions","response","optStrs","filteredIndices","filteredProfile","otp","profile","filter","option","i","optStr","access","map","a","mode","join","transit","routes","route","id","indexOf","push","filteredJourneys","journeys","journey","locationString","str","split","accessToLeg","origin","destination","duration","time","transitLeg","from","name","to","optionToItinerary","query","itin","legs","walkTime","waitingTime","length","status","walkOnEdges","bikeEdges","walkOffEdges","onStationName","walkOnTime","offStationName","walkOffTime","streetEdges","forEach","edge","bikeRentalOffStation","distance","bikeRentalOnStation","fromName","toName","rideStats","avg","averageWait","waitStats","egress","profileOptionsToItineraries","options"],"mappings":"AAAA,OAAO,SAASA,oBAAT,CAA8BC,QAA9B,EAAwC;AAC7C;AACA,MAAMC,OAAO,GAAG,EAAhB;AACA,MAAMC,eAAe,GAAG,EAAxB;AAEA,MAAMC,eAAe,GAAGH,QAAQ,CAACI,GAAT,CAAaC,OAAb,CAAqBC,MAArB,CAA4B,UAACC,MAAD,EAASC,CAAT,EAAe;AACjE,QAAIC,MAAM,GAAGF,MAAM,CAACG,MAAP,CAAcC,GAAd,CAAkB,UAAAC,CAAC;AAAA,aAAIA,CAAC,CAACC,IAAN;AAAA,KAAnB,EAA+BC,IAA/B,CAAoC,GAApC,CAAb;;AACA,QAAIP,MAAM,CAACQ,OAAX,EAAoB;AAClBN,MAAA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AR,CAAkBC,GAVf;AAWbC,QAAAA,WAAW,EAAE9C,OAAO,CAAC+C,SAAR,CAAkBF;AAXlB,OAAf;AAaAtB,MAAAA,IAAI,CAACG,WAAL,IAAoB1B,OAAO,CAAC+C,SAAR,CAAkBF,GAAtC;AACD,KAfD;AAgBD,GAlHuC,CAoHxC;;;AACA,MAAIrD,MAAM,CAACwD,MAAP,IAAiBxD,MAAM,CAACwD,MAAP,CAAcrB,MAAd,GAAuB,CAA5C,EAA+C;AAC7C;AACA,QAAMd,MAAM,GAAGrB,MAAM,CAACQ,OAAP,GACXR,MAAM,CAACQ,OAAP,CAAeR,MAAM,CAACQ,OAAP,CAAe2B,MAAf,GAAwB,CAAvC,EAA0CgB,MAD/B,GAEX,IAFJ;AAIApB,IAAAA,IAAI,CAACC,IAAL,CAAUnB,IAAV,CACEO,WAAW,CAACpB,MAAM,CAACwD,MAAP,CAAc,CAAd,CAAD,EAAmBnC,MAAnB,EAA2BS,KAAK,IAAIA,KAAK,CAACF,EAAN,CAASD,IAA7C,CADb;AAGA,QAAI3B,MAAM,CAACwD,MAAP,CAAc,CAAd,EAAiBlD,IAAjB,KAA0B,MAA9B,EACEyB,IAAI,CAACE,QAAL,IAAiBjC,MAAM,CAACwD,MAAP,CAAc,CAAd,EAAiBhC,IAAlC;AACH;;AAED,SAAOO,IAAP;AACD;AAED;;;AAEA,OAAO,SAAS0B,2BAAT,CAAqCC,OAArC,EAA8C5B,KAA9C,EAAqD;AAC1D,SAAO4B,OAAO,CAACtD,GAAR,CAAY,UAAAJ,MAAM;AAAA,WAAI6B,iBAAiB,CAAC7B,MAAD,EAAS8B,KAAT,CAArB;AAAA,GAAlB,CAAP;AACD","sourcesContent":["export function filterProfileOptions(response) {\n // Filter out similar options. TODO: handle on server?\n const optStrs = [];\n const filteredIndices = [];\n\n const filteredProfile = response.otp.profile.filter((option, i) => {\n let optStr = option.access.map(a => a.mode).join(\"/\");\n if (option.transit) {\n optStr += ` to ${option.transit\n .map(transit => {\n return transit.routes.map(route => route.id).join(\"/\");\n })\n .join(\",\")}`;\n }\n if (optStrs.indexOf(optStr) !== -1) return false;\n optStrs.push(optStr);\n filteredIndices.push(i);\n return true;\n });\n\n const filteredJourneys = response.otp.journeys.filter(\n (journey, i) => filteredIndices.indexOf(i) !== -1\n );\n\n response.otp.profile = filteredProfile;\n response.otp.journeys = filteredJourneys;\n return response;\n}\n\nfunction locationString(str) {\n return str ? str.split(\",\")[0] : null;\n}\n\nfunction accessToLeg(access, origin, destination) {\n return {\n mode: access.mode,\n duration: access.time,\n transitLeg: false,\n from: {\n name: locationString(origin)\n },\n to: {\n name: locationString(destination)\n }\n };\n}\n\n// helper functions for profileOptionsToItineraries:\n\nfunction optionToItinerary(option, query) {\n const itin = {\n duration: option.time,\n legs: [],\n walkTime: 0,\n waitingTime: 0\n };\n\n // access leg\n if (option.access && option.access.length > 0) {\n if (option.access[0].mode === \"BICYCLE_RENT\") {\n let status = \"WALK_ON\";\n const walkOnEdges = [];\n const bikeEdges = [];\n const walkOffEdges = [];\n let onStationName;\n let walkOnTime = 0;\n let offStationName;\n let walkOffTime = 0;\n option.access[0].streetEdges.forEach(edge => {\n // check if we're returning the bike\n if (edge.bikeRentalOffStation) {\n status = \"WALK_OFF\";\n offStationName = edge.bikeRentalOffStation.name;\n }\n\n if (status === \"WALK_ON\") {\n walkOnEdges.push(edge);\n walkOnTime += edge.distance;\n } else if (status === \"BIKE\") {\n bikeEdges.push(edge);\n } else if (status === \"WALK_OFF\") {\n walkOffEdges.push(edge);\n walkOffTime += edge.distance;\n }\n\n // check if we're picking up the bike\n if (edge.bikeRentalOnStation) {\n status = \"BIKE\";\n onStationName = edge.bikeRentalOnStation.name;\n }\n });\n\n itin.walkTime += walkOnTime + walkOffTime;\n\n // create the 'on' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOnTime,\n transitLeg: false,\n from: {\n name: locationString(query && query.from.name)\n },\n to: {\n name: onStationName\n }\n });\n\n // create the bike leg\n itin.legs.push({\n mode: \"BICYCLE_RENT\",\n duration: option.time - walkOnTime - walkOffTime,\n transitLeg: false,\n from: {\n name: onStationName\n },\n to: {\n name: offStationName\n }\n });\n\n // create the 'off' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOffTime,\n transitLeg: false,\n from: {\n name: offStationName\n },\n to: {\n name: locationString(query && query.to.name)\n }\n });\n } else {\n itin.legs.push(\n accessToLeg(\n option.access[0],\n query && query.from.name,\n option.transit ? null : query && query.to.name\n )\n );\n if (option.access[0].mode === \"WALK\")\n itin.walkTime += option.access[0].time;\n }\n }\n\n // transit legs\n if (option.transit) {\n option.transit.forEach(transit => {\n itin.legs.push({\n transitLeg: true,\n mode: transit.mode,\n from: {\n name: transit.fromName\n },\n to: {\n name: transit.toName\n },\n routes: transit.routes,\n duration: transit.rideStats.avg,\n averageWait: transit.waitStats.avg\n });\n itin.waitingTime += transit.waitStats.avg;\n });\n }\n\n // egress leg\n if (option.egress && option.egress.length > 0) {\n // find the origin name, for transit trips\n const origin = option.transit\n ? option.transit[option.transit.length - 1].toName\n : null;\n\n itin.legs.push(\n accessToLeg(option.egress[0], origin, query && query.to.name)\n );\n if (option.egress[0].mode === \"WALK\")\n itin.walkTime += option.egress[0].time;\n }\n\n return itin;\n}\n\n/** profileOptionsToItineraries * */\n\nexport function profileOptionsToItineraries(options, query) {\n return options.map(option => optionToItinerary(option, query));\n}\n"],"file":"profile.js"}
1
+ {"version":3,"sources":["../src/profile.js"],"names":["filterProfileOptions","response","optStrs","filteredIndices","filteredProfile","otp","profile","filter","option","i","optStr","access","map","a","mode","join","transit","routes","route","id","indexOf","push","filteredJourneys","journeys","journey","locationString","str","split","accessToLeg","origin","destination","duration","time","transitLeg","from","name","to","optionToItinerary","query","itin","legs","walkTime","waitingTime","length","status","walkOnEdges","bikeEdges","walkOffEdges","onStationName","walkOnTime","offStationName","walkOffTime","streetEdges","forEach","edge","bikeRentalOffStation","distance","bikeRentalOnStation","fromName","toName","rideStats","avg","averageWait","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MAAM,CAACwD,MAAP,CAAc,CAAd,EAAiBhC,IAAlC;AACH;;AAED,SAAOO,IAAP;AACD;AAED;;;AAEA,OAAO,SAAS0B,2BAAT,CAAqCC,OAArC,EAA8C5B,KAA9C,EAAqD;AAC1D,SAAO4B,OAAO,CAACtD,GAAR,CAAY,UAAAJ,MAAM;AAAA,WAAI6B,iBAAiB,CAAC7B,MAAD,EAAS8B,KAAT,CAArB;AAAA,GAAlB,CAAP;AACD","sourcesContent":["export function filterProfileOptions(response) {\n // Filter out similar options. TODO: handle on server?\n const optStrs = [];\n const filteredIndices = [];\n\n const filteredProfile = response.otp.profile.filter((option, i) => {\n let optStr = option.access.map(a => a.mode).join(\"/\");\n if (option.transit) {\n optStr += ` to ${option.transit\n .map(transit => {\n return transit.routes.map(route => route.id).join(\"/\");\n })\n .join(\",\")}`;\n }\n if (optStrs.indexOf(optStr) !== -1) return false;\n optStrs.push(optStr);\n filteredIndices.push(i);\n return true;\n });\n\n const filteredJourneys = response.otp.journeys.filter(\n (journey, i) => filteredIndices.indexOf(i) !== -1\n );\n\n response.otp.profile = filteredProfile;\n response.otp.journeys = filteredJourneys;\n return response;\n}\n\nfunction locationString(str) {\n return str?.split(\",\")[0];\n}\n\nfunction accessToLeg(access, origin, destination) {\n return {\n mode: access.mode,\n duration: access.time,\n transitLeg: false,\n from: {\n name: locationString(origin)\n },\n to: {\n name: locationString(destination)\n }\n };\n}\n\n// helper functions for profileOptionsToItineraries:\n\nfunction optionToItinerary(option, query) {\n const itin = {\n duration: option.time,\n legs: [],\n walkTime: 0,\n waitingTime: 0\n };\n\n // access leg\n if (option.access && option.access.length > 0) {\n if (option.access[0].mode === \"BICYCLE_RENT\") {\n let status = \"WALK_ON\";\n const walkOnEdges = [];\n const bikeEdges = [];\n const walkOffEdges = [];\n let onStationName;\n let walkOnTime = 0;\n let offStationName;\n let walkOffTime = 0;\n option.access[0].streetEdges.forEach(edge => {\n // check if we're returning the bike\n if (edge.bikeRentalOffStation) {\n status = \"WALK_OFF\";\n offStationName = edge.bikeRentalOffStation.name;\n }\n\n if (status === \"WALK_ON\") {\n walkOnEdges.push(edge);\n walkOnTime += edge.distance;\n } else if (status === \"BIKE\") {\n bikeEdges.push(edge);\n } else if (status === \"WALK_OFF\") {\n walkOffEdges.push(edge);\n walkOffTime += edge.distance;\n }\n\n // check if we're picking up the bike\n if (edge.bikeRentalOnStation) {\n status = \"BIKE\";\n onStationName = edge.bikeRentalOnStation.name;\n }\n });\n\n itin.walkTime += walkOnTime + walkOffTime;\n\n // create the 'on' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOnTime,\n transitLeg: false,\n from: {\n name: locationString(query && query.from.name)\n },\n to: {\n name: onStationName\n }\n });\n\n // create the bike leg\n itin.legs.push({\n mode: \"BICYCLE_RENT\",\n duration: option.time - walkOnTime - walkOffTime,\n transitLeg: false,\n from: {\n name: onStationName\n },\n to: {\n name: offStationName\n }\n });\n\n // create the 'off' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOffTime,\n transitLeg: false,\n from: {\n name: offStationName\n },\n to: {\n name: locationString(query && query.to.name)\n }\n });\n } else {\n itin.legs.push(\n accessToLeg(\n option.access[0],\n query && query.from.name,\n option.transit ? null : query && query.to.name\n )\n );\n if (option.access[0].mode === \"WALK\")\n itin.walkTime += option.access[0].time;\n }\n }\n\n // transit legs\n if (option.transit) {\n option.transit.forEach(transit => {\n itin.legs.push({\n transitLeg: true,\n mode: transit.mode,\n from: {\n name: transit.fromName\n },\n to: {\n name: transit.toName\n },\n routes: transit.routes,\n duration: transit.rideStats.avg,\n averageWait: transit.waitStats.avg\n });\n itin.waitingTime += transit.waitStats.avg;\n });\n }\n\n // egress leg\n if (option.egress && option.egress.length > 0) {\n // find the origin name, for transit trips\n const origin = option.transit\n ? option.transit[option.transit.length - 1].toName\n : null;\n\n itin.legs.push(\n accessToLeg(option.egress[0], origin, query && query.to.name)\n );\n if (option.egress[0].mode === \"WALK\")\n itin.walkTime += option.egress[0].time;\n }\n\n return itin;\n}\n\n/** profileOptionsToItineraries * */\n\nexport function profileOptionsToItineraries(options, query) {\n return options.map(option => optionToItinerary(option, query));\n}\n"],"file":"profile.js"}
@@ -262,7 +262,7 @@ var queryParams = [{
262
262
  /* optimize -- how to optimize a trip (non-bike, non-micromobility trips) */
263
263
  name: "optimize",
264
264
  applicable: function applicable(query) {
265
- return hasTransit(query.mode) && !hasBike(query.mode);
265
+ return !query.otp2 && hasTransit(query.mode) && !hasBike(query.mode);
266
266
  },
267
267
  routingTypes: ["ITINERARY"],
268
268
  "default": "QUICK",
@@ -279,7 +279,7 @@ var queryParams = [{
279
279
  /* optimizeBike -- how to optimize an bike-based trip */
280
280
  name: "optimizeBike",
281
281
  applicable: function applicable(query) {
282
- return hasBike(query.mode);
282
+ return !query.otp2 && hasBike(query.mode);
283
283
  },
284
284
  routingTypes: ["ITINERARY"],
285
285
  "default": "SAFE",
@@ -371,6 +371,8 @@ var queryParams = [{
371
371
  high: 20,
372
372
  step: 0.5,
373
373
  label: "walk reluctance",
374
+ labelLow: "More Walking",
375
+ labelHigh: "More Transit",
374
376
  applicable: function applicable(query) {
375
377
  return (
376
378
  /* Since this query variable isn't in this list, it's not included in the generated query
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/query-params.js"],"names":["cloneDeep","React","Wheelchair","isTransit","isAccessMode","isCar","hasTransit","hasBike","hasMicromobility","getItem","getCurrentDate","getCurrentTime","formatPlace","location","alternateName","name","lat","lon","storedSettings","queryParams","routingTypes","itineraryRewrite","value","fromPlace","profileRewrite","from","toPlace","to","arriveBy","accessModes","directModes","transitModes","length","split","forEach","m","push","applicable","query","otp2","mode","indexOf","selector","label","options","text","maxWalkDistance","maxBikeDistance","opts","splice","optimize","low","high","step","maxEScooterDistance","watts","maximumMicromobilitySpeed","weight","TYPICAL_RIDER_WEIGHT","icon","config","modes","configModes","concat","some","configMode","find","showWheelchairSetting","company","companies","includes","places","Array","isArray","intermediatePlaces","map","place","undefined","param","userDefaultOverride","getCustomQueryParams","customizations","clonedParams","Object","keys","k","paramIndex","findIndex"],"mappings":";;;;;;AAAA;AACA;AAEA;AACA,OAAOA,SAAP,MAAsB,kBAAtB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,QAA2B,qCAA3B;AAEA,SACEC,SADF,EAEEC,YAFF,EAGEC,KAHF,EAIEC,UAJF,EAKEC,OALF,EAMEC,gBANF,QAOO,aAPP;AAQA,SAASC,OAAT,QAAwB,WAAxB;AACA,SAASC,cAAT,EAAyBC,cAAzB,QAA+C,QAA/C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AACA,OAAO,SAASC,WAAT,CAAqBC,QAArB,EAA+BC,aAA/B,EAA8C;AACnD,MAAI,CAACD,QAAL,EAAe,OAAO,IAAP;AACf,MAAME,IAAI,GACRF,QAAQ,CAACE,IAAT,cACGD,aAAa,aAAMA,aAAN,SAAyB,EADzC,cAC+CD,QAAQ,CAACG,GADxD,cAEEH,QAAQ,CAACI,GAFX,MADF,CAFmD,CAOnD;;AACA,mBAAUF,IAAV,eAAmBF,QAAQ,CAACG,GAA5B,cAAmCH,QAAQ,CAACI,GAA5C;AACD,C,CAED;;AACA,IAAMC,cAAc,GAAGT,OAAO,CAAC,cAAD,EAAiB,EAAjB,CAA9B;AAEA,IAAMU,WAAW,GAAG,CAClB;AACE;AACAJ,EAAAA,IAAI,EAAE,MAFR;AAGEK,EAAAA,YAAY,EAAE,CAAC,WAAD,EAAc,SAAd,CAHhB;AAIE,aAAS,IAJX;AAKEC,EAAAA,gBAAgB,EAAE,0BAAAC,KAAK;AAAA,WAAK;AAAEC,MAAAA,SAAS,EAAEX,WAAW,CAACU,KAAD;AAAxB,KAAL;AAAA,GALzB;A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AAAA,KAAK,CAACC,mBAAN,GAA4B,IAA5B;AACD;AACF,CALD;AAOA,eAAe5D,WAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS6D,oBAAT,CAA8BC,cAA9B,EAA8C;AACnD,MAAI,CAACA,cAAL,EAAqB,OAAO9D,WAAP;AAErB,MAAM+D,YAAY,GAAGlF,SAAS,CAACmB,WAAD,CAA9B;AACAgE,EAAAA,MAAM,CAACC,IAAP,CAAYH,cAAZ,EAA4B/C,OAA5B,CAAoC,UAAAmD,CAAC,EAAI;AACvC;AACA,QAAMC,UAAU,GAAGJ,YAAY,CAACK,SAAb,CAAuB,UAAAT,KAAK;AAAA,aAAIA,KAAK,CAAC/D,IAAN,KAAesE,CAAnB;AAAA,KAA5B,CAAnB;;AACA,QAAIC,UAAU,KAAK,CAAC,CAApB,EAAuB;AACrBJ,MAAAA,YAAY,CAACI,UAAD,CAAZ,mCACKJ,YAAY,CAACI,UAAD,CADjB,GAEKL,cAAc,CAACI,CAAD,CAFnB;AAID;AACF,GATD;AAUA,SAAOH,YAAP;AACD","sourcesContent":["// TODO: Remove this entire file, as it is deprecated in favor of i18n-queryParams within\n// the SettingsSelector package\n\n// This is only used within stories\nimport cloneDeep from \"lodash.clonedeep\";\nimport React from \"react\";\nimport { Wheelchair } from \"@styled-icons/foundation/Wheelchair\";\n\nimport {\n isTransit,\n isAccessMode,\n isCar,\n hasTransit,\n hasBike,\n hasMicromobility\n} from \"./itinerary\";\nimport { getItem } from \"./storage\";\nimport { getCurrentDate, getCurrentTime } from \"./time\";\n\n/**\n * name: the default name of the parameter used for internal reference and API calls\n *\n * routingTypes: array of routing type(s) (ITINERARY, PROFILE, or both) this param applies to\n *\n * applicable: an optional function (accepting the current full query as a\n * parameter) indicating whether this query parameter is applicable to the query.\n * (Applicability is assumed if this function is not provided.)\n *\n * default: the default value for this parameter. The default can be also be a\n * function that gets executed when accessing the default value.\n *\n * itineraryRewrite: an optional function for translating the key and/or value\n * for ITINERARY mode only (e.g. 'to' is rewritten as 'toPlace'). Accepts the\n * initial internal value as a function parameter.\n *\n * profileRewrite: an optional function for translating the value for PROFILE mode\n *\n * label: a text label for for onscreen display. May either be a text string or a\n * function (accepting the current full query as a parameter) returning a string\n *\n * selector: the default type of UI selector to use in the form. Can be one of:\n * - DROPDOWN: a standard drop-down menu selector\n *\n * options: an array of text/value pairs used with a dropdown selector\n *\n * TODO: validation system for rewrite functions and/or better user documentation\n * TODO: alphabetize below list\n */\n\n// FIXME: Use for parsing URL values?\n// const stringToLocation = string => {\n// const split = string.split(',')\n// return split.length === 2\n// ? {lat: split[0], lon: split[1]}\n// : {lat: null, lon: null}\n// }\n\n/**\n * Format location object as string for use in fromPlace or toPlace query param.\n */\nexport function formatPlace(location, alternateName) {\n if (!location) return null;\n const name =\n location.name ||\n `${alternateName ? `${alternateName} ` : \"\"}(${location.lat},${\n location.lon\n })`;\n // This string is not language-specific\n return `${name}::${location.lat},${location.lon}`;\n}\n\n// Load stored default query settings from local storage\nconst storedSettings = getItem(\"defaultQuery\", {});\n\nconst queryParams = [\n {\n /* from - the trip origin. stored internally as a location (lat/lon/name) object */\n name: \"from\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: null,\n itineraryRewrite: value => ({ fromPlace: formatPlace(value) }),\n profileRewrite: value => ({ from: { lat: value.lat, lon: value.lon } })\n // FIXME: Use for parsing URL values?\n // fromURL: stringToLocation\n },\n\n {\n /* to - the trip destination. stored internally as a location (lat/lon/name) object */\n name: \"to\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: null,\n itineraryRewrite: value => ({ toPlace: formatPlace(value) }),\n profileRewrite: value => ({ to: { lat: value.lat, lon: value.lon } })\n // FIXME: Use for parsing URL values?\n // fromURL: stringToLocation\n },\n\n {\n /* date - the date of travel, in MM-DD-YYYY format */\n name: \"date\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: getCurrentDate\n },\n\n {\n /* time - the arrival/departure time for an itinerary trip, in HH:mm format */\n name: \"time\",\n routingTypes: [\"ITINERARY\"],\n default: getCurrentTime\n },\n\n {\n /* departArrive - whether this is a depart-at, arrive-by, or leave-now trip */\n name: \"departArrive\",\n routingTypes: [\"ITINERARY\"],\n default: \"NOW\",\n itineraryRewrite: value => ({ arriveBy: value === \"ARRIVE\" })\n },\n\n {\n /* startTime - the start time for a profile trip, in HH:mm format */\n name: \"startTime\",\n routingTypes: [\"PROFILE\"],\n default: \"07:00\"\n },\n\n {\n /* endTime - the end time for a profile trip, in HH:mm format */\n name: \"endTime\",\n routingTypes: [\"PROFILE\"],\n default: \"09:00\"\n },\n\n {\n /* mode - the allowed modes for a trip, as a comma-separated list */\n name: \"mode\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: \"WALK,TRANSIT\", // TODO: make this dependent on routingType?\n profileRewrite: value => {\n const accessModes = [];\n const directModes = [];\n const transitModes = [];\n\n if (value && value.length > 0) {\n value.split(\",\").forEach(m => {\n if (isTransit(m)) transitModes.push(m);\n if (isAccessMode(m)) {\n accessModes.push(m);\n // TODO: make configurable whether direct-driving is considered\n if (!isCar(m)) directModes.push(m);\n }\n });\n }\n\n return { accessModes, directModes, transitModes };\n }\n },\n\n {\n /* showIntermediateStops - whether response should include intermediate stops for transit legs */\n name: \"showIntermediateStops\",\n routingTypes: [\"ITINERARY\"],\n default: true\n },\n\n {\n /* maxWalkDistance - the maximum distance in meters the user will walk to transit. */\n name: \"maxWalkDistance\",\n routingTypes: [\"ITINERARY\"],\n applicable: query =>\n /* Since this query variable isn't in this list, it's not included in the generated query\n * It does however allow us to determine if we should show the OTP1 max walk distance\n * dropdown or the OTP2 walk reluctance slider\n */\n !query.otp2 &&\n query.mode &&\n hasTransit(query.mode) &&\n query.mode.indexOf(\"WALK\") !== -1,\n default: 1207, // 3/4 mi.\n selector: \"DROPDOWN\",\n label: \"Maximum Walk\",\n options: [\n {\n text: \"1/10 mile\",\n value: 160.9\n },\n {\n text: \"1/4 mile\",\n value: 402.3\n },\n {\n text: \"1/2 mile\",\n value: 804.7\n },\n {\n text: \"3/4 mile\",\n value: 1207\n },\n {\n text: \"1 mile\",\n value: 1609\n },\n {\n text: \"2 miles\",\n value: 3219\n },\n {\n text: \"5 miles\",\n value: 8047\n }\n ]\n },\n\n {\n /* maxBikeDistance - the maximum distance in meters the user will bike. Not\n * actually an OTP parameter (maxWalkDistance doubles for biking) but we\n * store it separately internally in order to allow different default values,\n * options, etc. Translated to 'maxWalkDistance' via the rewrite function.\n */\n name: \"maxBikeDistance\",\n routingTypes: [\"ITINERARY\"],\n applicable: query =>\n query.mode &&\n hasTransit(query.mode) &&\n query.mode.indexOf(\"BICYCLE\") !== -1,\n default: 4828, // 3 mi.\n selector: \"DROPDOWN\",\n label: \"Maximum Bike\",\n options: [\n {\n text: \"1/4 mile\",\n value: 402.3\n },\n {\n text: \"1/2 mile\",\n value: 804.7\n },\n {\n text: \"3/4 mile\",\n value: 1207\n },\n {\n text: \"1 mile\",\n value: 1609\n },\n {\n text: \"2 miles\",\n value: 3219\n },\n {\n text: \"3 miles\",\n value: 4828\n },\n {\n text: \"5 miles\",\n value: 8047\n },\n {\n text: \"10 miles\",\n value: 16093\n },\n {\n text: \"20 miles\",\n value: 32187\n },\n {\n text: \"30 miles\",\n value: 48280\n }\n ],\n itineraryRewrite: value => ({\n maxWalkDistance: value,\n // ensures that the value is repopulated when loaded from URL params\n maxBikeDistance: value\n })\n },\n\n {\n /* optimize -- how to optimize a trip (non-bike, non-micromobility trips) */\n name: \"optimize\",\n applicable: query => hasTransit(query.mode) && !hasBike(query.mode),\n routingTypes: [\"ITINERARY\"],\n default: \"QUICK\",\n selector: \"DROPDOWN\",\n label: \"Optimize for\",\n options: [\n {\n text: \"Speed\",\n value: \"QUICK\"\n },\n {\n text: \"Fewest Transfers\",\n value: \"TRANSFERS\"\n }\n ]\n },\n\n {\n /* optimizeBike -- how to optimize an bike-based trip */\n name: \"optimizeBike\",\n applicable: query => hasBike(query.mode),\n routingTypes: [\"ITINERARY\"],\n default: \"SAFE\",\n selector: \"DROPDOWN\",\n label: \"Optimize for\",\n options: query => {\n const opts = [\n {\n text: \"Speed\",\n value: \"QUICK\"\n },\n {\n text: \"Bike-Friendly Trip\",\n value: \"SAFE\"\n },\n {\n text: \"Flat Trip\",\n value: \"FLAT\"\n }\n ];\n\n // Include transit-specific option, if applicable\n if (hasTransit(query.mode)) {\n opts.splice(1, 0, {\n text: \"Fewest Transfers\",\n value: \"TRANSFERS\"\n });\n }\n\n return opts;\n },\n itineraryRewrite: value => ({ optimize: value })\n },\n\n {\n /* maxWalkTime -- the maximum time the user will spend walking in minutes */\n name: \"maxWalkTime\",\n routingTypes: [\"PROFILE\"],\n default: 15,\n selector: \"DROPDOWN\",\n label: \"Max Walk Time\",\n applicable: query =>\n query.mode && hasTransit(query.mode) && query.mode.indexOf(\"WALK\") !== -1,\n options: [\n {\n text: \"5 minutes\",\n value: 5\n },\n {\n text: \"10 minutes\",\n value: 10\n },\n {\n text: \"15 minutes\",\n value: 15\n },\n {\n text: \"20 minutes\",\n value: 20\n },\n {\n text: \"30 minutes\",\n value: 30\n },\n {\n text: \"45 minutes\",\n value: 45\n },\n {\n text: \"1 hour\",\n value: 60\n }\n ]\n },\n\n {\n /* walkSpeed -- the user's walking speed in m/s */\n name: \"walkSpeed\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: 1.34,\n selector: \"DROPDOWN\",\n label: \"Walk Speed\",\n applicable: query => query.mode && query.mode.indexOf(\"WALK\") !== -1,\n options: [\n {\n text: \"2 MPH\",\n value: 0.89\n },\n {\n text: \"3 MPH\",\n value: 1.34\n },\n {\n text: \"4 MPH\",\n value: 1.79\n }\n ]\n },\n\n {\n name: \"walkReluctance\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n selector: \"SLIDER\",\n low: 0.5,\n high: 20,\n step: 0.5,\n label: \"walk reluctance\",\n applicable: query =>\n /* Since this query variable isn't in this list, it's not included in the generated query\n * It does however allow us to determine if we should show the OTP1 max walk distance\n * dropdown or the OTP2 walk reluctance slider\n */\n !!query.otp2 && query.mode && query.mode.indexOf(\"WALK\") !== -1\n },\n {\n /* maxBikeTime -- the maximum time the user will spend biking in minutes */\n name: \"maxBikeTime\",\n routingTypes: [\"PROFILE\"],\n default: 20,\n selector: \"DROPDOWN\",\n label: \"Max Bike Time\",\n applicable: query =>\n query.mode &&\n hasTransit(query.mode) &&\n query.mode.indexOf(\"BICYCLE\") !== -1,\n options: [\n {\n text: \"5 minutes\",\n value: 5\n },\n {\n text: \"10 minutes\",\n value: 10\n },\n {\n text: \"15 minutes\",\n value: 15\n },\n {\n text: \"20 minutes\",\n value: 20\n },\n {\n text: \"30 minutes\",\n value: 30\n },\n {\n text: \"45 minutes\",\n value: 45\n },\n {\n text: \"1 hour\",\n value: 60\n }\n ]\n },\n\n {\n /* bikeSpeed -- the user's bikeSpeed speed in m/s */\n name: \"bikeSpeed\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: 3.58,\n selector: \"DROPDOWN\",\n label: \"Bicycle Speed\",\n applicable: query => query.mode && query.mode.indexOf(\"BICYCLE\") !== -1,\n options: [\n {\n text: \"6 MPH\",\n value: 2.68\n },\n {\n text: \"8 MPH\",\n value: 3.58\n },\n {\n text: \"10 MPH\",\n value: 4.47\n },\n {\n text: \"12 MPH\",\n value: 5.36\n }\n ]\n },\n\n {\n /* maxEScooterDistance - the maximum distance in meters the user will ride\n * an E-scooter. Not actually an OTP parameter (maxWalkDistance doubles for\n * any non-transit mode except for car) but we store it separately\n * internally in order to allow different default values, options, etc.\n * Translated to 'maxWalkDistance' via the rewrite function.\n */\n name: \"maxEScooterDistance\",\n routingTypes: [\"ITINERARY\"],\n applicable: query =>\n query.mode && hasTransit(query.mode) && hasMicromobility(query.mode),\n default: 4828, // 3 mi.\n selector: \"DROPDOWN\",\n label: \"Maximum E-scooter Distance\",\n options: [\n {\n text: \"1/4 mile\",\n value: 402.3\n },\n {\n text: \"1/2 mile\",\n value: 804.7\n },\n {\n text: \"3/4 mile\",\n value: 1207\n },\n {\n text: \"1 mile\",\n value: 1609\n },\n {\n text: \"2 miles\",\n value: 3219\n },\n {\n text: \"3 miles\",\n value: 4828\n },\n {\n text: \"5 miles\",\n value: 8047\n },\n {\n text: \"10 miles\",\n value: 16093\n },\n {\n text: \"20 miles\",\n value: 32187\n },\n {\n text: \"30 miles\",\n value: 48280\n }\n ],\n itineraryRewrite: value => ({\n maxWalkDistance: value,\n // ensures that the value is repopulated when loaded from URL params\n maxEScooterDistance: value\n })\n },\n\n {\n /* bikeSpeed -- the user's bikeSpeed speed in m/s */\n name: \"watts\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: 250,\n selector: \"DROPDOWN\",\n label: \"E-scooter Power\",\n // this configuration should only be allowed for personal E-scooters as these\n // settings will be defined by the vehicle type of an E-scooter being rented\n applicable: query =>\n query.mode &&\n query.mode.indexOf(\"MICROMOBILITY\") !== -1 &&\n query.mode.indexOf(\"MICROMOBILITY_RENT\") === -1,\n options: [\n {\n text: \"Kid's hoverboard (6mph)\",\n value: 125\n },\n {\n text: \"Entry-level scooter (11mph)\",\n value: 250\n },\n {\n text: \"Robust E-scooter (18mph)\",\n value: 500\n },\n {\n text: \"Powerful E-scooter (24mph)\",\n value: 1500\n }\n ],\n // rewrite a few other values to add some baseline assumptions about the\n // vehicle\n itineraryRewrite: value => {\n const watts = value;\n // the maximum cruising and downhill speed. Units in m/s\n let maximumMicromobilitySpeed;\n let weight;\n // see https://en.wikipedia.org/wiki/Human_body_weight#Average_weight_around_the_world\n // estimate is for an average North American human with clothes and stuff\n // units are in kg\n const TYPICAL_RIDER_WEIGHT = 90;\n switch (watts) {\n case 125:\n // exemplar: Swagtron Turbo 5 hoverboard (https://swagtron.com/product/recertified-swagtron-turbo-five-hoverboard-classic/)\n maximumMicromobilitySpeed = 2.8; // ~= 6mph\n weight = TYPICAL_RIDER_WEIGHT + 9;\n break;\n case 250:\n // exemplar: Xiaomi M365 (https://www.gearbest.com/skateboard/pp_596618.html)\n maximumMicromobilitySpeed = 5; // ~= 11.5mph\n weight = TYPICAL_RIDER_WEIGHT + 12.5;\n break;\n case 500:\n // exemplar: Razor EcoSmart Metro (https://www.amazon.com/Razor-EcoSmart-Metro-Electric-Scooter/dp/B002ZDAEIS?SubscriptionId=AKIAJMXJ2YFJTEDLQMUQ&tag=digitren08-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B002ZDAEIS&ascsubtag=15599460143449ocb)\n maximumMicromobilitySpeed = 8; // ~= 18mph\n weight = TYPICAL_RIDER_WEIGHT + 30;\n break;\n case 1000:\n // exemplar: Boosted Rev (https://boostedboards.com/vehicles/scooters/boosted-rev)\n maximumMicromobilitySpeed = 11; // ~= 24mph\n weight = TYPICAL_RIDER_WEIGHT + 21;\n break;\n default:\n break;\n }\n return { maximumMicromobilitySpeed, watts, weight };\n }\n },\n\n {\n /* ignoreRealtimeUpdates -- if true, do not use realtime updates in routing */\n name: \"ignoreRealtimeUpdates\",\n routingTypes: [\"ITINERARY\"],\n default: false\n },\n\n {\n /* companies -- tnc companies to query */\n name: \"companies\",\n routingTypes: [\"ITINERARY\"]\n },\n\n {\n /* wheelchair -- whether the user requires a wheelchair-accessible trip */\n name: \"wheelchair\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: false,\n selector: \"CHECKBOX\",\n label: \"Prefer Wheelchair Accessible Routes\",\n icon: <Wheelchair />,\n applicable: (query, config) => {\n if (!query.mode || !config.modes) return false;\n const configModes = (config.modes.accessModes || []).concat(\n config.modes.transitModes || []\n );\n return query.mode.split(\",\").some(mode => {\n const configMode = configModes.find(m => m.mode === mode);\n if (!configMode || !configMode.showWheelchairSetting) return false;\n if (\n configMode.company &&\n (!query.companies ||\n !query.companies.split(\",\").includes(configMode.company))\n )\n return false;\n return true;\n });\n }\n },\n\n {\n name: \"bannedRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"numItineraries\",\n routingTypes: [\"ITINERARY\"],\n default: 3\n },\n {\n name: \"intermediatePlaces\",\n default: [],\n routingTypes: [\"ITINERARY\"],\n itineraryRewrite: places =>\n Array.isArray(places) && places.length > 0\n ? {\n intermediatePlaces: places.map(place => formatPlace(place))\n }\n : undefined\n },\n {\n // Time penalty in seconds the requester is willing to accept in order to\n // complete journey on preferred route. I.e., number of seconds that we are\n // willing to wait for the preferred route.\n name: \"otherThanPreferredRoutesPenalty\",\n default: 15 * 60, // 15 minutes\n routingTypes: [\"ITINERARY\"]\n },\n // Below are less commonly used query params included so that in case they are\n // passed in a query parameter they do not get filtered out from the ultimate\n // API request.\n {\n name: \"preferredRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"maxPreTransitTime\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"waitReluctance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"driveDistanceReluctance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"driveTimeReluctance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"waitAtBeginningFactor\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bikeSwitchTime\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bikeSwitchCost\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"minTransferTime\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"preferredAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"unpreferredRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"unpreferredAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"walkBoardCost\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bikeBoardCost\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"whiteListedRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"whiteListedAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedTrips\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedStops\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedStopsHard\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"transferPenalty\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"nonpreferredTransferPenalty\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"maxTransfers\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"batch\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"startTransitStopId\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"startTransitTripId\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"clampInitialWait\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"reverseOptimizeOnTheFly\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"boardSlack\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"alightSlack\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"locale\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"disableRemainingWeightHeuristic\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexFlagStopBufferSize\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexUseReservationServices\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexUseEligibilityServices\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexIgnoreDrtAdvanceBookMin\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"maxHours\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"useRequestedDateTimeInMaxHours\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"disableAlertFiltering\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"geoidElevation\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"invalidDateStrategy\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"minTransitDistance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"searchTimeout\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"pathComparator\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"onlyTransitTrips\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"minimumMicromobilitySpeed\",\n routingTypes: [\"ITINERARY\"]\n }\n];\n// Iterate over stored settings and update query param defaults.\n// FIXME: this does not get updated if the user defaults are cleared\nqueryParams.forEach(param => {\n if (param.name in storedSettings) {\n param.default = storedSettings[param.name];\n param.userDefaultOverride = true;\n }\n});\n\nexport default queryParams;\n\n/**\n * You can customize the queryParams labels and options, and labels and values for each option.\n * @param customizations The optional customizations to apply: an object whose fields\n * correspond to the items in queryParams with the corresponding name,\n * the value for those fields being an object which fields (label, options...)\n * will override the originals.\n * Example:\n * {\n * // Matches the name param\n * maxWalkDistance: {\n * // Any fields that should be overridden go here\n * options: [\n * // ...new options\n * ],\n * default: 500,\n * label: \"max walk dist\"\n * }\n * }\n * @returns A copy of the default queryParams that has the given customizations applied.\n * If no customizations parameter is provided, returns the queryParams object itself.\n */\nexport function getCustomQueryParams(customizations) {\n if (!customizations) return queryParams;\n\n const clonedParams = cloneDeep(queryParams);\n Object.keys(customizations).forEach(k => {\n // Merge fields into the cloned object\n const paramIndex = clonedParams.findIndex(param => param.name === k);\n if (paramIndex !== -1) {\n clonedParams[paramIndex] = {\n ...clonedParams[paramIndex],\n ...customizations[k]\n };\n }\n });\n return clonedParams;\n}\n"],"file":"query-params.js"}
1
+ {"version":3,"sources":["../src/query-params.js"],"names":["cloneDeep","React","Wheelchair","isTransit","isAccessMode","isCar","hasTransit","hasBike","hasMicromobility","getItem","getCurrentDate","getCurrentTime","formatPlace","location","alternateName","name","lat","lon","storedSettings","queryParams","routingTypes","itineraryRewrite","value","fromPlace","profileRewrite","from","toPlace","to","arriveBy","accessModes","directModes","transitModes","length","split","forEach","m","push","applicable","query","otp2","mode","indexOf","selector","label","options","text","maxWalkDistance","maxBikeDistance","opts","splice","optimize","low","high","step","labelLow","labelHigh","maxEScooterDistance","watts","maximumMicromobilitySpeed","weight","TYPICAL_RIDER_WEIGHT","icon","config","modes","configModes","concat","some","configMode","find","showWheelchairSetting","company","companies","includes","places","Array","isArray","intermediatePlaces","map","place","undefined","param","userDefaultOverride","getCustomQueryParams","customizations","clonedParams","Object","keys","k","paramIndex","findIndex"],"mappings":";;;;;;AAAA;AACA;AAEA;AACA,OAAOA,SAAP,MAAsB,kBAAtB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,QAA2B,qCAA3B;AAEA,SACEC,SADF,EAEEC,YAFF,EAGEC,KAHF,EAIEC,UAJF,EAKEC,OALF,EAMEC,gBANF,QAOO,aAPP;AAQA,SAASC,OAAT,QAAwB,WAAxB;AACA,SAASC,cAAT,EAAyBC,cAAzB,QAA+C,QAA/C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AACA,OAAO,SAASC,WAAT,CAAqBC,QAArB,EAA+BC,aAA/B,EAA8C;AACnD,MAAI,CAACD,QAAL,EAAe,OAAO,IAAP;AACf,MAAME,IAAI,GACRF,QAAQ,CAACE,IAAT,cACGD,aAAa,aAAMA,aAAN,SAAyB,EADzC,cAC+CD,QAAQ,CAACG,GADxD,cAEEH,QAAQ,CAACI,GAFX,MADF,CAFmD,CAOnD;;AACA,mBAAUF,IAAV,eAAmBF,QAAQ,CAACG,GAA5B,cAAmCH,QAAQ,CAACI,GAA5C;AACD,C,CAED;;AACA,IAAMC,cAAc,GAAGT,OAAO,CAAC,cAAD,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EL,EAAAA,IAAI,EAAE,kBADR;AAEEK,EAAAA,YAAY,EAAE,CAAC,WAAD;AAFhB,CA1xBkB,EA8xBlB;AACEL,EAAAA,IAAI,EAAE,2BADR;AAEEK,EAAAA,YAAY,EAAE,CAAC,WAAD;AAFhB,CA9xBkB,CAApB,C,CAmyBA;AACA;;AACAD,WAAW,CAACe,OAAZ,CAAoB,UAAA8C,KAAK,EAAI;AAC3B,MAAIA,KAAK,CAACjE,IAAN,IAAcG,cAAlB,EAAkC;AAChC8D,IAAAA,KAAK,WAAL,GAAgB9D,cAAc,CAAC8D,KAAK,CAACjE,IAAP,CAA9B;AACAiE,IAAAA,KAAK,CAACC,mBAAN,GAA4B,IAA5B;AACD;AACF,CALD;AAOA,eAAe9D,WAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS+D,oBAAT,CAA8BC,cAA9B,EAA8C;AACnD,MAAI,CAACA,cAAL,EAAqB,OAAOhE,WAAP;AAErB,MAAMiE,YAAY,GAAGpF,SAAS,CAACmB,WAAD,CAA9B;AACAkE,EAAAA,MAAM,CAACC,IAAP,CAAYH,cAAZ,EAA4BjD,OAA5B,CAAoC,UAAAqD,CAAC,EAAI;AACvC;AACA,QAAMC,UAAU,GAAGJ,YAAY,CAACK,SAAb,CAAuB,UAAAT,KAAK;AAAA,aAAIA,KAAK,CAACjE,IAAN,KAAewE,CAAnB;AAAA,KAA5B,CAAnB;;AACA,QAAIC,UAAU,KAAK,CAAC,CAApB,EAAuB;AACrBJ,MAAAA,YAAY,CAACI,UAAD,CAAZ,mCACKJ,YAAY,CAACI,UAAD,CADjB,GAEKL,cAAc,CAACI,CAAD,CAFnB;AAID;AACF,GATD;AAUA,SAAOH,YAAP;AACD","sourcesContent":["// TODO: Remove this entire file, as it is deprecated in favor of i18n-queryParams within\n// the SettingsSelector package\n\n// This is only used within stories\nimport cloneDeep from \"lodash.clonedeep\";\nimport React from \"react\";\nimport { Wheelchair } from \"@styled-icons/foundation/Wheelchair\";\n\nimport {\n isTransit,\n isAccessMode,\n isCar,\n hasTransit,\n hasBike,\n hasMicromobility\n} from \"./itinerary\";\nimport { getItem } from \"./storage\";\nimport { getCurrentDate, getCurrentTime } from \"./time\";\n\n/**\n * name: the default name of the parameter used for internal reference and API calls\n *\n * routingTypes: array of routing type(s) (ITINERARY, PROFILE, or both) this param applies to\n *\n * applicable: an optional function (accepting the current full query as a\n * parameter) indicating whether this query parameter is applicable to the query.\n * (Applicability is assumed if this function is not provided.)\n *\n * default: the default value for this parameter. The default can be also be a\n * function that gets executed when accessing the default value.\n *\n * itineraryRewrite: an optional function for translating the key and/or value\n * for ITINERARY mode only (e.g. 'to' is rewritten as 'toPlace'). Accepts the\n * initial internal value as a function parameter.\n *\n * profileRewrite: an optional function for translating the value for PROFILE mode\n *\n * label: a text label for for onscreen display. May either be a text string or a\n * function (accepting the current full query as a parameter) returning a string\n *\n * selector: the default type of UI selector to use in the form. Can be one of:\n * - DROPDOWN: a standard drop-down menu selector\n *\n * options: an array of text/value pairs used with a dropdown selector\n *\n * TODO: validation system for rewrite functions and/or better user documentation\n * TODO: alphabetize below list\n */\n\n// FIXME: Use for parsing URL values?\n// const stringToLocation = string => {\n// const split = string.split(',')\n// return split.length === 2\n// ? {lat: split[0], lon: split[1]}\n// : {lat: null, lon: null}\n// }\n\n/**\n * Format location object as string for use in fromPlace or toPlace query param.\n */\nexport function formatPlace(location, alternateName) {\n if (!location) return null;\n const name =\n location.name ||\n `${alternateName ? `${alternateName} ` : \"\"}(${location.lat},${\n location.lon\n })`;\n // This string is not language-specific\n return `${name}::${location.lat},${location.lon}`;\n}\n\n// Load stored default query settings from local storage\nconst storedSettings = getItem(\"defaultQuery\", {});\n\nconst queryParams = [\n {\n /* from - the trip origin. stored internally as a location (lat/lon/name) object */\n name: \"from\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: null,\n itineraryRewrite: value => ({ fromPlace: formatPlace(value) }),\n profileRewrite: value => ({ from: { lat: value.lat, lon: value.lon } })\n // FIXME: Use for parsing URL values?\n // fromURL: stringToLocation\n },\n\n {\n /* to - the trip destination. stored internally as a location (lat/lon/name) object */\n name: \"to\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: null,\n itineraryRewrite: value => ({ toPlace: formatPlace(value) }),\n profileRewrite: value => ({ to: { lat: value.lat, lon: value.lon } })\n // FIXME: Use for parsing URL values?\n // fromURL: stringToLocation\n },\n\n {\n /* date - the date of travel, in MM-DD-YYYY format */\n name: \"date\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: getCurrentDate\n },\n\n {\n /* time - the arrival/departure time for an itinerary trip, in HH:mm format */\n name: \"time\",\n routingTypes: [\"ITINERARY\"],\n default: getCurrentTime\n },\n\n {\n /* departArrive - whether this is a depart-at, arrive-by, or leave-now trip */\n name: \"departArrive\",\n routingTypes: [\"ITINERARY\"],\n default: \"NOW\",\n itineraryRewrite: value => ({ arriveBy: value === \"ARRIVE\" })\n },\n\n {\n /* startTime - the start time for a profile trip, in HH:mm format */\n name: \"startTime\",\n routingTypes: [\"PROFILE\"],\n default: \"07:00\"\n },\n\n {\n /* endTime - the end time for a profile trip, in HH:mm format */\n name: \"endTime\",\n routingTypes: [\"PROFILE\"],\n default: \"09:00\"\n },\n\n {\n /* mode - the allowed modes for a trip, as a comma-separated list */\n name: \"mode\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: \"WALK,TRANSIT\", // TODO: make this dependent on routingType?\n profileRewrite: value => {\n const accessModes = [];\n const directModes = [];\n const transitModes = [];\n\n if (value && value.length > 0) {\n value.split(\",\").forEach(m => {\n if (isTransit(m)) transitModes.push(m);\n if (isAccessMode(m)) {\n accessModes.push(m);\n // TODO: make configurable whether direct-driving is considered\n if (!isCar(m)) directModes.push(m);\n }\n });\n }\n\n return { accessModes, directModes, transitModes };\n }\n },\n\n {\n /* showIntermediateStops - whether response should include intermediate stops for transit legs */\n name: \"showIntermediateStops\",\n routingTypes: [\"ITINERARY\"],\n default: true\n },\n\n {\n /* maxWalkDistance - the maximum distance in meters the user will walk to transit. */\n name: \"maxWalkDistance\",\n routingTypes: [\"ITINERARY\"],\n applicable: query =>\n /* Since this query variable isn't in this list, it's not included in the generated query\n * It does however allow us to determine if we should show the OTP1 max walk distance\n * dropdown or the OTP2 walk reluctance slider\n */\n !query.otp2 &&\n query.mode &&\n hasTransit(query.mode) &&\n query.mode.indexOf(\"WALK\") !== -1,\n default: 1207, // 3/4 mi.\n selector: \"DROPDOWN\",\n label: \"Maximum Walk\",\n options: [\n {\n text: \"1/10 mile\",\n value: 160.9\n },\n {\n text: \"1/4 mile\",\n value: 402.3\n },\n {\n text: \"1/2 mile\",\n value: 804.7\n },\n {\n text: \"3/4 mile\",\n value: 1207\n },\n {\n text: \"1 mile\",\n value: 1609\n },\n {\n text: \"2 miles\",\n value: 3219\n },\n {\n text: \"5 miles\",\n value: 8047\n }\n ]\n },\n\n {\n /* maxBikeDistance - the maximum distance in meters the user will bike. Not\n * actually an OTP parameter (maxWalkDistance doubles for biking) but we\n * store it separately internally in order to allow different default values,\n * options, etc. Translated to 'maxWalkDistance' via the rewrite function.\n */\n name: \"maxBikeDistance\",\n routingTypes: [\"ITINERARY\"],\n applicable: query =>\n query.mode &&\n hasTransit(query.mode) &&\n query.mode.indexOf(\"BICYCLE\") !== -1,\n default: 4828, // 3 mi.\n selector: \"DROPDOWN\",\n label: \"Maximum Bike\",\n options: [\n {\n text: \"1/4 mile\",\n value: 402.3\n },\n {\n text: \"1/2 mile\",\n value: 804.7\n },\n {\n text: \"3/4 mile\",\n value: 1207\n },\n {\n text: \"1 mile\",\n value: 1609\n },\n {\n text: \"2 miles\",\n value: 3219\n },\n {\n text: \"3 miles\",\n value: 4828\n },\n {\n text: \"5 miles\",\n value: 8047\n },\n {\n text: \"10 miles\",\n value: 16093\n },\n {\n text: \"20 miles\",\n value: 32187\n },\n {\n text: \"30 miles\",\n value: 48280\n }\n ],\n itineraryRewrite: value => ({\n maxWalkDistance: value,\n // ensures that the value is repopulated when loaded from URL params\n maxBikeDistance: value\n })\n },\n\n {\n /* optimize -- how to optimize a trip (non-bike, non-micromobility trips) */\n name: \"optimize\",\n applicable: query =>\n !query.otp2 && hasTransit(query.mode) && !hasBike(query.mode),\n routingTypes: [\"ITINERARY\"],\n default: \"QUICK\",\n selector: \"DROPDOWN\",\n label: \"Optimize for\",\n options: [\n {\n text: \"Speed\",\n value: \"QUICK\"\n },\n {\n text: \"Fewest Transfers\",\n value: \"TRANSFERS\"\n }\n ]\n },\n\n {\n /* optimizeBike -- how to optimize an bike-based trip */\n name: \"optimizeBike\",\n applicable: query => !query.otp2 && hasBike(query.mode),\n routingTypes: [\"ITINERARY\"],\n default: \"SAFE\",\n selector: \"DROPDOWN\",\n label: \"Optimize for\",\n options: query => {\n const opts = [\n {\n text: \"Speed\",\n value: \"QUICK\"\n },\n {\n text: \"Bike-Friendly Trip\",\n value: \"SAFE\"\n },\n {\n text: \"Flat Trip\",\n value: \"FLAT\"\n }\n ];\n\n // Include transit-specific option, if applicable\n if (hasTransit(query.mode)) {\n opts.splice(1, 0, {\n text: \"Fewest Transfers\",\n value: \"TRANSFERS\"\n });\n }\n\n return opts;\n },\n itineraryRewrite: value => ({ optimize: value })\n },\n\n {\n /* maxWalkTime -- the maximum time the user will spend walking in minutes */\n name: \"maxWalkTime\",\n routingTypes: [\"PROFILE\"],\n default: 15,\n selector: \"DROPDOWN\",\n label: \"Max Walk Time\",\n applicable: query =>\n query.mode && hasTransit(query.mode) && query.mode.indexOf(\"WALK\") !== -1,\n options: [\n {\n text: \"5 minutes\",\n value: 5\n },\n {\n text: \"10 minutes\",\n value: 10\n },\n {\n text: \"15 minutes\",\n value: 15\n },\n {\n text: \"20 minutes\",\n value: 20\n },\n {\n text: \"30 minutes\",\n value: 30\n },\n {\n text: \"45 minutes\",\n value: 45\n },\n {\n text: \"1 hour\",\n value: 60\n }\n ]\n },\n\n {\n /* walkSpeed -- the user's walking speed in m/s */\n name: \"walkSpeed\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: 1.34,\n selector: \"DROPDOWN\",\n label: \"Walk Speed\",\n applicable: query => query.mode && query.mode.indexOf(\"WALK\") !== -1,\n options: [\n {\n text: \"2 MPH\",\n value: 0.89\n },\n {\n text: \"3 MPH\",\n value: 1.34\n },\n {\n text: \"4 MPH\",\n value: 1.79\n }\n ]\n },\n\n {\n name: \"walkReluctance\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n selector: \"SLIDER\",\n low: 0.5,\n high: 20,\n step: 0.5,\n label: \"walk reluctance\",\n labelLow: \"More Walking\",\n labelHigh: \"More Transit\",\n applicable: query =>\n /* Since this query variable isn't in this list, it's not included in the generated query\n * It does however allow us to determine if we should show the OTP1 max walk distance\n * dropdown or the OTP2 walk reluctance slider\n */\n !!query.otp2 && query.mode && query.mode.indexOf(\"WALK\") !== -1\n },\n {\n /* maxBikeTime -- the maximum time the user will spend biking in minutes */\n name: \"maxBikeTime\",\n routingTypes: [\"PROFILE\"],\n default: 20,\n selector: \"DROPDOWN\",\n label: \"Max Bike Time\",\n applicable: query =>\n query.mode &&\n hasTransit(query.mode) &&\n query.mode.indexOf(\"BICYCLE\") !== -1,\n options: [\n {\n text: \"5 minutes\",\n value: 5\n },\n {\n text: \"10 minutes\",\n value: 10\n },\n {\n text: \"15 minutes\",\n value: 15\n },\n {\n text: \"20 minutes\",\n value: 20\n },\n {\n text: \"30 minutes\",\n value: 30\n },\n {\n text: \"45 minutes\",\n value: 45\n },\n {\n text: \"1 hour\",\n value: 60\n }\n ]\n },\n\n {\n /* bikeSpeed -- the user's bikeSpeed speed in m/s */\n name: \"bikeSpeed\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: 3.58,\n selector: \"DROPDOWN\",\n label: \"Bicycle Speed\",\n applicable: query => query.mode && query.mode.indexOf(\"BICYCLE\") !== -1,\n options: [\n {\n text: \"6 MPH\",\n value: 2.68\n },\n {\n text: \"8 MPH\",\n value: 3.58\n },\n {\n text: \"10 MPH\",\n value: 4.47\n },\n {\n text: \"12 MPH\",\n value: 5.36\n }\n ]\n },\n\n {\n /* maxEScooterDistance - the maximum distance in meters the user will ride\n * an E-scooter. Not actually an OTP parameter (maxWalkDistance doubles for\n * any non-transit mode except for car) but we store it separately\n * internally in order to allow different default values, options, etc.\n * Translated to 'maxWalkDistance' via the rewrite function.\n */\n name: \"maxEScooterDistance\",\n routingTypes: [\"ITINERARY\"],\n applicable: query =>\n query.mode && hasTransit(query.mode) && hasMicromobility(query.mode),\n default: 4828, // 3 mi.\n selector: \"DROPDOWN\",\n label: \"Maximum E-scooter Distance\",\n options: [\n {\n text: \"1/4 mile\",\n value: 402.3\n },\n {\n text: \"1/2 mile\",\n value: 804.7\n },\n {\n text: \"3/4 mile\",\n value: 1207\n },\n {\n text: \"1 mile\",\n value: 1609\n },\n {\n text: \"2 miles\",\n value: 3219\n },\n {\n text: \"3 miles\",\n value: 4828\n },\n {\n text: \"5 miles\",\n value: 8047\n },\n {\n text: \"10 miles\",\n value: 16093\n },\n {\n text: \"20 miles\",\n value: 32187\n },\n {\n text: \"30 miles\",\n value: 48280\n }\n ],\n itineraryRewrite: value => ({\n maxWalkDistance: value,\n // ensures that the value is repopulated when loaded from URL params\n maxEScooterDistance: value\n })\n },\n\n {\n /* bikeSpeed -- the user's bikeSpeed speed in m/s */\n name: \"watts\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: 250,\n selector: \"DROPDOWN\",\n label: \"E-scooter Power\",\n // this configuration should only be allowed for personal E-scooters as these\n // settings will be defined by the vehicle type of an E-scooter being rented\n applicable: query =>\n query.mode &&\n query.mode.indexOf(\"MICROMOBILITY\") !== -1 &&\n query.mode.indexOf(\"MICROMOBILITY_RENT\") === -1,\n options: [\n {\n text: \"Kid's hoverboard (6mph)\",\n value: 125\n },\n {\n text: \"Entry-level scooter (11mph)\",\n value: 250\n },\n {\n text: \"Robust E-scooter (18mph)\",\n value: 500\n },\n {\n text: \"Powerful E-scooter (24mph)\",\n value: 1500\n }\n ],\n // rewrite a few other values to add some baseline assumptions about the\n // vehicle\n itineraryRewrite: value => {\n const watts = value;\n // the maximum cruising and downhill speed. Units in m/s\n let maximumMicromobilitySpeed;\n let weight;\n // see https://en.wikipedia.org/wiki/Human_body_weight#Average_weight_around_the_world\n // estimate is for an average North American human with clothes and stuff\n // units are in kg\n const TYPICAL_RIDER_WEIGHT = 90;\n switch (watts) {\n case 125:\n // exemplar: Swagtron Turbo 5 hoverboard (https://swagtron.com/product/recertified-swagtron-turbo-five-hoverboard-classic/)\n maximumMicromobilitySpeed = 2.8; // ~= 6mph\n weight = TYPICAL_RIDER_WEIGHT + 9;\n break;\n case 250:\n // exemplar: Xiaomi M365 (https://www.gearbest.com/skateboard/pp_596618.html)\n maximumMicromobilitySpeed = 5; // ~= 11.5mph\n weight = TYPICAL_RIDER_WEIGHT + 12.5;\n break;\n case 500:\n // exemplar: Razor EcoSmart Metro (https://www.amazon.com/Razor-EcoSmart-Metro-Electric-Scooter/dp/B002ZDAEIS?SubscriptionId=AKIAJMXJ2YFJTEDLQMUQ&tag=digitren08-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B002ZDAEIS&ascsubtag=15599460143449ocb)\n maximumMicromobilitySpeed = 8; // ~= 18mph\n weight = TYPICAL_RIDER_WEIGHT + 30;\n break;\n case 1000:\n // exemplar: Boosted Rev (https://boostedboards.com/vehicles/scooters/boosted-rev)\n maximumMicromobilitySpeed = 11; // ~= 24mph\n weight = TYPICAL_RIDER_WEIGHT + 21;\n break;\n default:\n break;\n }\n return { maximumMicromobilitySpeed, watts, weight };\n }\n },\n\n {\n /* ignoreRealtimeUpdates -- if true, do not use realtime updates in routing */\n name: \"ignoreRealtimeUpdates\",\n routingTypes: [\"ITINERARY\"],\n default: false\n },\n\n {\n /* companies -- tnc companies to query */\n name: \"companies\",\n routingTypes: [\"ITINERARY\"]\n },\n\n {\n /* wheelchair -- whether the user requires a wheelchair-accessible trip */\n name: \"wheelchair\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: false,\n selector: \"CHECKBOX\",\n label: \"Prefer Wheelchair Accessible Routes\",\n icon: <Wheelchair />,\n applicable: (query, config) => {\n if (!query.mode || !config.modes) return false;\n const configModes = (config.modes.accessModes || []).concat(\n config.modes.transitModes || []\n );\n return query.mode.split(\",\").some(mode => {\n const configMode = configModes.find(m => m.mode === mode);\n if (!configMode || !configMode.showWheelchairSetting) return false;\n if (\n configMode.company &&\n (!query.companies ||\n !query.companies.split(\",\").includes(configMode.company))\n )\n return false;\n return true;\n });\n }\n },\n\n {\n name: \"bannedRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"numItineraries\",\n routingTypes: [\"ITINERARY\"],\n default: 3\n },\n {\n name: \"intermediatePlaces\",\n default: [],\n routingTypes: [\"ITINERARY\"],\n itineraryRewrite: places =>\n Array.isArray(places) && places.length > 0\n ? {\n intermediatePlaces: places.map(place => formatPlace(place))\n }\n : undefined\n },\n {\n // Time penalty in seconds the requester is willing to accept in order to\n // complete journey on preferred route. I.e., number of seconds that we are\n // willing to wait for the preferred route.\n name: \"otherThanPreferredRoutesPenalty\",\n default: 15 * 60, // 15 minutes\n routingTypes: [\"ITINERARY\"]\n },\n // Below are less commonly used query params included so that in case they are\n // passed in a query parameter they do not get filtered out from the ultimate\n // API request.\n {\n name: \"preferredRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"maxPreTransitTime\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"waitReluctance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"driveDistanceReluctance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"driveTimeReluctance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"waitAtBeginningFactor\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bikeSwitchTime\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bikeSwitchCost\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"minTransferTime\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"preferredAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"unpreferredRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"unpreferredAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"walkBoardCost\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bikeBoardCost\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"whiteListedRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"whiteListedAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedTrips\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedStops\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedStopsHard\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"transferPenalty\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"nonpreferredTransferPenalty\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"maxTransfers\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"batch\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"startTransitStopId\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"startTransitTripId\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"clampInitialWait\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"reverseOptimizeOnTheFly\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"boardSlack\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"alightSlack\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"locale\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"disableRemainingWeightHeuristic\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexFlagStopBufferSize\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexUseReservationServices\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexUseEligibilityServices\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexIgnoreDrtAdvanceBookMin\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"maxHours\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"useRequestedDateTimeInMaxHours\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"disableAlertFiltering\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"geoidElevation\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"invalidDateStrategy\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"minTransitDistance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"searchTimeout\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"pathComparator\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"onlyTransitTrips\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"minimumMicromobilitySpeed\",\n routingTypes: [\"ITINERARY\"]\n }\n];\n// Iterate over stored settings and update query param defaults.\n// FIXME: this does not get updated if the user defaults are cleared\nqueryParams.forEach(param => {\n if (param.name in storedSettings) {\n param.default = storedSettings[param.name];\n param.userDefaultOverride = true;\n }\n});\n\nexport default queryParams;\n\n/**\n * You can customize the queryParams labels and options, and labels and values for each option.\n * @param customizations The optional customizations to apply: an object whose fields\n * correspond to the items in queryParams with the corresponding name,\n * the value for those fields being an object which fields (label, options...)\n * will override the originals.\n * Example:\n * {\n * // Matches the name param\n * maxWalkDistance: {\n * // Any fields that should be overridden go here\n * options: [\n * // ...new options\n * ],\n * default: 500,\n * label: \"max walk dist\"\n * }\n * }\n * @returns A copy of the default queryParams that has the given customizations applied.\n * If no customizations parameter is provided, returns the queryParams object itself.\n */\nexport function getCustomQueryParams(customizations) {\n if (!customizations) return queryParams;\n\n const clonedParams = cloneDeep(queryParams);\n Object.keys(customizations).forEach(k => {\n // Merge fields into the cloned object\n const paramIndex = clonedParams.findIndex(param => param.name === k);\n if (paramIndex !== -1) {\n clonedParams[paramIndex] = {\n ...clonedParams[paramIndex],\n ...customizations[k]\n };\n }\n });\n return clonedParams;\n}\n"],"file":"query-params.js"}
package/esm/time.js CHANGED
@@ -100,9 +100,9 @@ export function formatDuration(seconds) {
100
100
  }
101
101
  /**
102
102
  * Formats an elapsed time in seconds, minutes, hours duration for display in narrative
103
- * TODO: internationalization
104
103
  * @param {number} seconds duration in seconds
105
- * @returns {string} formatted text representation
104
+ * @param {object} region an object that allows internationalization of the time
105
+ * @returns {string} formatted text representation
106
106
  */
107
107
 
108
108
  export function formatDurationWithSeconds(seconds, region) {
package/esm/time.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/time.js"],"names":["startOfDay","add","format","formatDuration","dateFnsFormatDuration","utcToZonedTime","OTP_API_DATE_FORMAT","OTP_API_DATE_FORMAT_DATE_FNS","OTP_API_TIME_FORMAT","formatDurationLikeMoment","seconds","showSeconds","localize","enabled","code","hours","Math","floor","minutes","secondsLeftOver","specLookup","xHours","xMinutes","xSeconds","locale","formatDistance","spec","val","undefined","toHoursMinutesSeconds","getTimeFormat","config","dateTime","timeFormat","getDateFormat","dateFormat","getLongDateFormat","longDateFormat","formatDurationWithSeconds","region","offsetTime","ms","options","offset","formatTime","formatSecondsAfterMidnight","time","Date","getUserTimezone","fallbackTimezone","process","env","NODE_ENV","TZ","Intl","DateTimeFormat","resolvedOptions","timeZone","getCurrentTime","timezone","now","getCurrentDate"],"mappings":"AAAA,SACEA,UADF,EAEEC,GAFF,EAGEC,MAHF,EAIEC,cAAc,IAAIC,qBAJpB,QAKO,UALP;AAMA,SAASC,cAAT,QAA+B,aAA/B,C,CAEA;AACA;;AACA,OAAO,IAAMC,mBAAmB,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AI,UAAJ,sCAAMC,cAAN,GAAuBC,eAAvB,GAAyCC,QAAzC,KAAqDR,gBAA5D;AACD;AAED;AACA;AACA;AACA;;AACA,OAAO,SAASS,cAAT,GAAsD;AAAA,MAA9BC,QAA8B,uEAAnBX,eAAe,EAAI;AAC3D,SAAO9C,MAAM,CAACG,cAAc,CAAC0C,IAAI,CAACa,GAAL,EAAD,EAAaD,QAAb,CAAf,EAAuCnD,mBAAvC,CAAb;AACD;AAED;AACA;AACA;AACA;;AACA,OAAO,SAASqD,cAAT,GAAsD;AAAA,MAA9BF,QAA8B,uEAAnBX,eAAe,EAAI;AAC3D,SAAO9C,MAAM,CACXG,cAAc,CAAC0C,IAAI,CAACa,GAAL,EAAD,EAAaD,QAAb,CADH,EAEXpD,4BAFW,CAAb;AAID","sourcesContent":["import {\n startOfDay,\n add,\n format,\n formatDuration as dateFnsFormatDuration\n} from \"date-fns\";\nimport { utcToZonedTime } from \"date-fns-tz\";\n\n// special constants for making sure the following date format is always sent to\n// OTP regardless of whatever the user has configured as the display format\nexport const OTP_API_DATE_FORMAT = \"YYYY-MM-DD\";\n// Date-Fns uses a different string format than moment.js\n// see https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\nexport const OTP_API_DATE_FORMAT_DATE_FNS = \"yyyy-MM-dd\";\nexport const OTP_API_TIME_FORMAT = \"HH:mm\";\n\n/**\n * To ease the transition away from moment.js, this method uses date-fns to format durations\n * the way moment.js did.\n * @param {number} seconds The number of seconds to format\n * @param {boolean} showSeconds Whether to render seconds or not\n * @param {boolean} localize If true, will create output like moment.js using date-fns locale.\n * Otherwise, uses date-fns default\n * @returns Formatted duration\n */\nfunction formatDurationLikeMoment(\n seconds,\n showSeconds,\n localize = { enabled: true, code: \"en-US\" }\n) {\n // date-fns doesn't do this automatically\n if ((!showSeconds && seconds < 60) || seconds === 0) {\n return \"0 min\";\n }\n\n const hours = Math.floor(seconds / 3600);\n const minutes = Math.floor((seconds - hours * 3600) / 60);\n const secondsLeftOver = showSeconds\n ? seconds - hours * 3600 - minutes * 60\n : 0;\n const specLookup = {\n xHours: \"hr\",\n xMinutes: \"min\",\n xSeconds: \"sec\"\n };\n const locale = localize\n ? {\n // Maintain backwards compatibility when called with localize=true\n code: localize?.code || \"en-US\",\n formatDistance: (spec, val) => {\n return `${val} ${specLookup[spec]}`;\n }\n }\n : undefined;\n\n return dateFnsFormatDuration(\n {\n hours,\n minutes,\n seconds: secondsLeftOver\n },\n {\n format: [\"hours\", \"minutes\", \"seconds\"],\n locale\n }\n );\n}\n\n/**\n * Breaks up a duration in seconds into hours, minutes, and seconds.\n * @param {number} seconds The number of seconds to break up\n * @returns an object with fields with the corresponding, hours, minutes, seconds.\n */\nexport function toHoursMinutesSeconds(seconds) {\n const hours = Math.floor(seconds / 3600);\n const minutes = Math.floor((seconds - hours * 3600) / 60);\n return {\n hours,\n minutes,\n seconds: seconds - hours * 3600 - minutes * 60\n };\n}\n\n/**\n * @param {[type]} config the OTP config object found in store\n * @return {string} the config-defined time formatter or HH:mm (24-hr time)\n */\nexport function getTimeFormat(config) {\n return config?.dateTime?.timeFormat || OTP_API_TIME_FORMAT;\n}\n\nexport function getDateFormat(config) {\n return config?.dateTime?.dateFormat || OTP_API_DATE_FORMAT;\n}\n\nexport function getLongDateFormat(config) {\n return config?.dateTime?.longDateFormat || \"D MMMM YYYY\";\n}\n\n/**\n * Formats an elapsed time duration for display in narrative.\n * TODO: internationalization\n * @param {number} seconds duration in seconds\n * @returns {string} formatted text representation\n */\nexport function formatDuration(seconds) {\n return formatDurationLikeMoment(seconds, false);\n}\n\n/**\n * Formats an elapsed time in seconds, minutes, hours duration for display in narrative\n * TODO: internationalization\n * @param {number} seconds duration in seconds\n * @returns {string} formatted text representation\n */\nexport function formatDurationWithSeconds(seconds, region) {\n return formatDurationLikeMoment(seconds, { enabled: true, code: region });\n}\n\n/**\n * Offsets a time according to the provided time options\n * and returns the result.\n */\nexport function offsetTime(ms, options) {\n return ms + (options?.offset || 0);\n}\n\n/**\n * Formats a time value for display in narrative\n * TODO: internationalization/timezone\n * @param {number} ms epoch time value in milliseconds\n * @returns {string} formatted text representation\n */\nexport function formatTime(ms, options) {\n return format(\n offsetTime(ms, options),\n options?.format || OTP_API_TIME_FORMAT\n );\n}\n\n/**\n * Formats a seconds after midnight value for display in narrative\n * @param {number} seconds time since midnight in seconds\n * @param {string} timeFormat A valid date-fns time format\n * @return {string} formatted text representation\n */\nexport function formatSecondsAfterMidnight(seconds, timeFormat) {\n const time = add(startOfDay(new Date()), { seconds });\n return format(time, timeFormat);\n}\n\n/**\n * Uses Intl.DateTimeFormat() api to get the user's time zone. In a test\n * environment, pulls timezone information from an env variable. Default to\n * GMT+0 if the Intl API is unavailable.\n */\nexport function getUserTimezone(fallbackTimezone = \"Etc/Greenwich\") {\n if (process.env.NODE_ENV === \"test\") return process.env.TZ;\n return Intl?.DateTimeFormat().resolvedOptions().timeZone || fallbackTimezone;\n}\n\n/**\n * Formats current time for use in OTP query\n * The conversion to the user's timezone is needed for testing purposes.\n */\nexport function getCurrentTime(timezone = getUserTimezone()) {\n return format(utcToZonedTime(Date.now(), timezone), OTP_API_TIME_FORMAT);\n}\n\n/**\n * Formats current date for use in OTP query\n * The conversion to the user's timezone is needed for testing purposes.\n */\nexport function getCurrentDate(timezone = getUserTimezone()) {\n return format(\n utcToZonedTime(Date.now(), timezone),\n OTP_API_DATE_FORMAT_DATE_FNS\n );\n}\n"],"file":"time.js"}
1
+ {"version":3,"sources":["../src/time.js"],"names":["startOfDay","add","format","formatDuration","dateFnsFormatDuration","utcToZonedTime","OTP_API_DATE_FORMAT","OTP_API_DATE_FORMAT_DATE_FNS","OTP_API_TIME_FORMAT","formatDurationLikeMoment","seconds","showSeconds","localize","enabled","code","hours","Math","floor","minutes","secondsLeftOver","specLookup","xHours","xMinutes","xSeconds","locale","formatDistance","spec","val","undefined","toHoursMinutesSeconds","getTimeFormat","config","dateTime","timeFormat","getDateFormat","dateFormat","getLongDateFormat","longDateFormat","formatDurationWithSeconds","region","offsetTime","ms","options","offset","formatTime","formatSecondsAfterMidnight","time","Date","getUserTimezone","fallbackTimezone","process","env","NODE_ENV","TZ","Intl","DateTimeFormat","resolvedOptions","timeZone","getCurrentTime","timezone","now","getCurrentDate"],"mappings":"AAAA,SACEA,UADF,EAEEC,GAFF,EAGEC,MAHF,EAIEC,cAAc,IAAIC,qBAJpB,QAKO,UALP;AAMA,SAASC,cAAT,QAA+B,aAA/B,C,CAEA;AACA;;AACA,OAAO,IAAMC,mBAAmB,GAAG,YAA5B,C,CACP;AACA;;AACA,OAAO,IAAMC,4BAA4B,GAAG,YAArC;AACP,OAAO,IAAMC,mBAAmB,GAAG,OAA5B;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,wBAAT,CACEC,OADF,EAEEC,WAFF,EAIE;AAAA,MADAC,QACA,uEADW;AAAEC,IAAAA,OAAO,EAAE,IAAX;AAAiBC,IAAAA,IAAI,EAAE;AAAvB,GACX;;AACA;AACA,MAAK,CAACH,WAAD,IAAgBD,OAAO,GAAG,EAA3B,IAAkCA,OAAO,KAAK,CAAlD,EAAqD;AACnD,WAAO,OAAP;AACD;;AAED,MAAMK,KAAK,GAAGC,IAAI,CAACC,KAAL,CAAWP,OAAO,GAAG,IAArB,CAAd;AACA,MAAMQ,OAAO,GAAGF,IAAI,CAACC,KAAL,CAAW,CAACP,OAAO,GAAGK,KAAK,GAAG,IAAnB,IAA2B,EAAtC,CAAhB;AACA,MAAMI,eAAe,GAAGR,WAAW,GAC/BD,OAAO,GAAGK,KAAK,GAAG,IAAlB,GAAyBG,OAAO,GAAG,EADJ,GAE/B,CAFJ;AAGA,MAAME,UAAU,GAAG;AACjBC,IAAAA,MAAM,EAAE,IADS;AAEjBC,IAAAA,QAAQ,EAAE,KAFO;AAGjBC,IAAAA,QAAQ,EAAE;AAHO,GAAnB;AAKA,MAAMC,MAAM,GAAGZ,QAAQ,GACnB;AACE;AACAE,IAAAA,IAAI,EAAE,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A,OAAO,EAAPA;AAAF,GAAzB,CAAhB;AACA,SAAOR,MAAM,CAAC4C,IAAD,EAAOb,UAAP,CAAb;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASe,eAAT,GAA6D;AAAA;;AAAA,MAApCC,gBAAoC,uEAAjB,eAAiB;AAClE,MAAIC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,MAA7B,EAAqC,OAAOF,OAAO,CAACC,GAAR,CAAYE,EAAnB;AACrC,SAAO,UAAAC,IAAI,UAAJ,sCAAMC,cAAN,GAAuBC,eAAvB,GAAyCC,QAAzC,KAAqDR,gBAA5D;AACD;AAED;AACA;AACA;AACA;;AACA,OAAO,SAASS,cAAT,GAAsD;AAAA,MAA9BC,QAA8B,uEAAnBX,eAAe,EAAI;AAC3D,SAAO9C,MAAM,CAACG,cAAc,CAAC0C,IAAI,CAACa,GAAL,EAAD,EAAaD,QAAb,CAAf,EAAuCnD,mBAAvC,CAAb;AACD;AAED;AACA;AACA;AACA;;AACA,OAAO,SAASqD,cAAT,GAAsD;AAAA,MAA9BF,QAA8B,uEAAnBX,eAAe,EAAI;AAC3D,SAAO9C,MAAM,CACXG,cAAc,CAAC0C,IAAI,CAACa,GAAL,EAAD,EAAaD,QAAb,CADH,EAEXpD,4BAFW,CAAb;AAID","sourcesContent":["import {\n startOfDay,\n add,\n format,\n formatDuration as dateFnsFormatDuration\n} from \"date-fns\";\nimport { utcToZonedTime } from \"date-fns-tz\";\n\n// special constants for making sure the following date format is always sent to\n// OTP regardless of whatever the user has configured as the display format\nexport const OTP_API_DATE_FORMAT = \"YYYY-MM-DD\";\n// Date-Fns uses a different string format than moment.js\n// see https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\nexport const OTP_API_DATE_FORMAT_DATE_FNS = \"yyyy-MM-dd\";\nexport const OTP_API_TIME_FORMAT = \"HH:mm\";\n\n/**\n * To ease the transition away from moment.js, this method uses date-fns to format durations\n * the way moment.js did.\n * @param {number} seconds The number of seconds to format\n * @param {boolean} showSeconds Whether to render seconds or not\n * @param {boolean} localize If true, will create output like moment.js using date-fns locale.\n * Otherwise, uses date-fns default\n * @returns Formatted duration\n */\nfunction formatDurationLikeMoment(\n seconds,\n showSeconds,\n localize = { enabled: true, code: \"en-US\" }\n) {\n // date-fns doesn't do this automatically\n if ((!showSeconds && seconds < 60) || seconds === 0) {\n return \"0 min\";\n }\n\n const hours = Math.floor(seconds / 3600);\n const minutes = Math.floor((seconds - hours * 3600) / 60);\n const secondsLeftOver = showSeconds\n ? seconds - hours * 3600 - minutes * 60\n : 0;\n const specLookup = {\n xHours: \"hr\",\n xMinutes: \"min\",\n xSeconds: \"sec\"\n };\n const locale = localize\n ? {\n // Maintain backwards compatibility when called with localize=true\n code: localize?.code || \"en-US\",\n formatDistance: (spec, val) => {\n return `${val} ${specLookup[spec]}`;\n }\n }\n : undefined;\n\n return dateFnsFormatDuration(\n {\n hours,\n minutes,\n seconds: secondsLeftOver\n },\n {\n format: [\"hours\", \"minutes\", \"seconds\"],\n locale\n }\n );\n}\n\n/**\n * Breaks up a duration in seconds into hours, minutes, and seconds.\n * @param {number} seconds The number of seconds to break up\n * @returns an object with fields with the corresponding, hours, minutes, seconds.\n */\nexport function toHoursMinutesSeconds(seconds) {\n const hours = Math.floor(seconds / 3600);\n const minutes = Math.floor((seconds - hours * 3600) / 60);\n return {\n hours,\n minutes,\n seconds: seconds - hours * 3600 - minutes * 60\n };\n}\n\n/**\n * @param {[type]} config the OTP config object found in store\n * @return {string} the config-defined time formatter or HH:mm (24-hr time)\n */\nexport function getTimeFormat(config) {\n return config?.dateTime?.timeFormat || OTP_API_TIME_FORMAT;\n}\n\nexport function getDateFormat(config) {\n return config?.dateTime?.dateFormat || OTP_API_DATE_FORMAT;\n}\n\nexport function getLongDateFormat(config) {\n return config?.dateTime?.longDateFormat || \"D MMMM YYYY\";\n}\n\n/**\n * Formats an elapsed time duration for display in narrative.\n * TODO: internationalization\n * @param {number} seconds duration in seconds\n * @returns {string} formatted text representation\n */\nexport function formatDuration(seconds) {\n return formatDurationLikeMoment(seconds, false);\n}\n\n/**\n * Formats an elapsed time in seconds, minutes, hours duration for display in narrative\n * @param {number} seconds duration in seconds\n * @param {object} region an object that allows internationalization of the time\n * @returns {string} formatted text representation\n */\nexport function formatDurationWithSeconds(seconds, region) {\n return formatDurationLikeMoment(seconds, { enabled: true, code: region });\n}\n\n/**\n * Offsets a time according to the provided time options\n * and returns the result.\n */\nexport function offsetTime(ms, options) {\n return ms + (options?.offset || 0);\n}\n\n/**\n * Formats a time value for display in narrative\n * TODO: internationalization/timezone\n * @param {number} ms epoch time value in milliseconds\n * @returns {string} formatted text representation\n */\nexport function formatTime(ms, options) {\n return format(\n offsetTime(ms, options),\n options?.format || OTP_API_TIME_FORMAT\n );\n}\n\n/**\n * Formats a seconds after midnight value for display in narrative\n * @param {number} seconds time since midnight in seconds\n * @param {string} timeFormat A valid date-fns time format\n * @return {string} formatted text representation\n */\nexport function formatSecondsAfterMidnight(seconds, timeFormat) {\n const time = add(startOfDay(new Date()), { seconds });\n return format(time, timeFormat);\n}\n\n/**\n * Uses Intl.DateTimeFormat() api to get the user's time zone. In a test\n * environment, pulls timezone information from an env variable. Default to\n * GMT+0 if the Intl API is unavailable.\n */\nexport function getUserTimezone(fallbackTimezone = \"Etc/Greenwich\") {\n if (process.env.NODE_ENV === \"test\") return process.env.TZ;\n return Intl?.DateTimeFormat().resolvedOptions().timeZone || fallbackTimezone;\n}\n\n/**\n * Formats current time for use in OTP query\n * The conversion to the user's timezone is needed for testing purposes.\n */\nexport function getCurrentTime(timezone = getUserTimezone()) {\n return format(utcToZonedTime(Date.now(), timezone), OTP_API_TIME_FORMAT);\n}\n\n/**\n * Formats current date for use in OTP query\n * The conversion to the user's timezone is needed for testing purposes.\n */\nexport function getCurrentDate(timezone = getUserTimezone()) {\n return format(\n utcToZonedTime(Date.now(), timezone),\n OTP_API_DATE_FORMAT_DATE_FNS\n );\n}\n"],"file":"time.js"}
package/lib/deprecated.js CHANGED
@@ -21,9 +21,16 @@ exports.summarizeQuery = summarizeQuery;
21
21
 
22
22
  var _moment = _interopRequireDefault(require("moment"));
23
23
 
24
- // Need to avoid cyclic dependency resolution
24
+ /**
25
+ * To disable cyclic dependency resolution we need to require() within methods
26
+ * This is a good reason to disable this eslint-rule
27
+ */
25
28
 
26
29
  /* eslint-disable global-require */
30
+
31
+ /**
32
+ * Generates a warning to tell developer that they are using deprecated methods!
33
+ */
27
34
  function logDeprecationWarning(method, alternative) {
28
35
  console.warn(`${method || "This method"} is deprecated and will be removed in a future otp-ui release. All language functionality should be handled using react-intl.
29
36
  ${alternative ? `
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/deprecated.js"],"names":["logDeprecationWarning","method","alternative","console","warn","getStepDirection","step","relativeDirection","absoluteDirection","toLowerCase","getStepInstructions","conjunction","streetName","getStepStreetName","getLegModeLabel","leg","mode","hailedCar","routeLongName","indexOf","require","toSentenceCase","getModeForPlace","place","vertexType","getPlaceName","companies","address","split","networks","company","getCompanyForNetwork","label","name","getTransitFare","fareComponent","digits","transitFare","symbol","currencyCode","defaultFractionDigits","currency","cents","centsToString","dollars","toFixed","dollarsToString","calculateFares","itinerary","multiple","minTNCFare","maxTNCFare","tncCurrencyCode","legs","forEach","tncData","maxCost","minCost","transitFares","fare","Object","keys","fareKey","regular","transitCurrencyCode","latlngToString","latlng","lat","lng","lon","coordsToString","coords","length","map","c","join","getDetailText","location","detailText","type","id","timestamp","fromNow","summarizeQuery","query","locations","findLocationType","ls","types","match","find","l","matchLatLon","from","to","hasTransit"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;AACO,SAASA,qBAAT,CAA+BC,MAA/B,EAAuCC,WAAvC,EAAoD;AACzDC,EAAAA,OAAO,CAACC,IAAR,CACG,GAAEH,MAAM,IACP,aAAc;AACpB,UACUC,WAAW,GACN;AACf;AACA,cAAcA,WAAY,+EAHL,GAIP,EACL,EATP;AAWD,C,CAED;;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,IAAI,GAAGI,OAAO,CAAC,aAAD,CAAP,CAAuB2E,UAAvB,CAAkCX,KAAK,CAACpE,IAAxC,IACT,SADS,GAETI,OAAO,CAAC,aAAD,CAAP,CAAuBC,cAAvB,CAAsC+D,KAAK,CAACpE,IAA5C,CAFJ;AAGA,SAAQ,GAAEA,IAAK,SAAQ6E,IAAK,OAAMC,EAAG,EAArC;AACD","sourcesContent":["import moment from \"moment\";\n\n// Need to avoid cyclic dependency resolution\n/* eslint-disable global-require */\nexport function logDeprecationWarning(method, alternative) {\n console.warn(\n `${method ||\n \"This method\"} is deprecated and will be removed in a future otp-ui release. All language functionality should be handled using react-intl.\n ${\n alternative\n ? `\n\n Use ${alternative} instead, which provides a new interface that doesn't return English strings.`\n : \"\"\n }`\n );\n}\n\n// itinerary.js\n\nexport function getStepDirection(step) {\n logDeprecationWarning(\"getStepDirection\");\n\n switch (step.relativeDirection) {\n case \"DEPART\":\n return `Head ${step.absoluteDirection.toLowerCase()}`;\n case \"LEFT\":\n return \"Left\";\n case \"HARD_LEFT\":\n return \"Hard left\";\n case \"SLIGHTLY_LEFT\":\n return \"Slight left\";\n case \"CONTINUE\":\n return \"Continue\";\n case \"SLIGHTLY_RIGHT\":\n return \"Slight right\";\n case \"RIGHT\":\n return \"Right\";\n case \"HARD_RIGHT\":\n return \"Hard right\";\n case \"CIRCLE_CLOCKWISE\":\n return \"Follow circle clockwise\";\n case \"CIRCLE_COUNTERCLOCKWISE\":\n return \"Follow circle counterclockwise\";\n case \"ELEVATOR\":\n return \"Take elevator\";\n case \"UTURN_LEFT\":\n return \"Left U-turn\";\n case \"UTURN_RIGHT\":\n return \"Right U-turn\";\n default:\n return step.relativeDirection;\n }\n}\n\nexport function getStepInstructions(step) {\n logDeprecationWarning(\"getStepInstructions\");\n\n const conjunction = step.relativeDirection === \"ELEVATOR\" ? \"to\" : \"on\";\n return `${getStepDirection(step)} ${conjunction} ${step.streetName}`;\n}\n\nexport function getStepStreetName(step) {\n logDeprecationWarning(\"getStepStreetName\");\n\n if (step.streetName === \"road\") return \"Unnamed Road\";\n if (step.streetName === \"path\") return \"Unnamed Path\";\n return step.streetName;\n}\n\nexport function getLegModeLabel(leg) {\n logDeprecationWarning(\"getLegModeLabel\");\n\n switch (leg.mode) {\n case \"BICYCLE_RENT\":\n return \"Biketown\";\n case \"CAR\":\n return leg.hailedCar ? \"Ride\" : \"Drive\";\n case \"GONDOLA\":\n return \"Aerial Tram\";\n case \"TRAM\":\n if (leg.routeLongName.toLowerCase().indexOf(\"streetcar\") !== -1)\n return \"Streetcar\";\n return \"Light Rail\";\n case \"MICROMOBILITY\":\n return \"Ride\";\n default:\n return require(\"./itinerary\").toSentenceCase(leg.mode);\n }\n}\n\n/**\n * Returns mode name by checking the vertex type (VertexType class in OTP) for\n * the provided place. NOTE: this is currently only intended for vehicles at\n * the moment (not transit or walking).\n *\n * @param {string} place place from itinerary leg\n */\nexport function getModeForPlace(place) {\n logDeprecationWarning(\"getModeForPlace\");\n\n switch (place.vertexType) {\n case \"CARSHARE\":\n return \"car\";\n case \"VEHICLERENTAL\":\n return \"E-scooter\";\n // TODO: Should the type change depending on bike vertex type?\n case \"BIKESHARE\":\n case \"BIKEPARK\":\n return \"bike\";\n // If company offers more than one mode, default to `vehicle` string.\n default:\n return \"vehicle\";\n }\n}\n\nexport function getPlaceName(place, companies) {\n logDeprecationWarning(\"getPlaceName\");\n\n // If address is provided (i.e. for carshare station, use it)\n if (place.address) return place.address.split(\",\")[0];\n if (place.networks && place.vertexType === \"VEHICLERENTAL\") {\n // For vehicle rental pick up, do not use the place name. Rather, use\n // company name + vehicle type (e.g., SPIN E-scooter). Place name is often just\n // a UUID that has no relevance to the actual vehicle. For bikeshare, however,\n // there are often hubs or bikes that have relevant names to the user.\n const company = require(\"./itinerary\").getCompanyForNetwork(\n place.networks[0],\n companies\n );\n if (company) {\n return `${company.label} ${getModeForPlace(place)}`;\n }\n }\n // Default to place name\n return place.name;\n}\n\n/**\n * For a given fare component (either total fare or component parts), returns\n * an object with string formatters and the fare value (in cents).\n */\nexport function getTransitFare(fareComponent) {\n logDeprecationWarning(\"getTransitFare\", \"the fare object and getTncFare\");\n\n // Default values (if fare component is not valid).\n let digits = 2;\n let transitFare = 0;\n let symbol = \"$\";\n let currencyCode = \"USD\";\n if (fareComponent) {\n // Assign values without declaration. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#assignment_without_declaration\n ({\n currencyCode,\n defaultFractionDigits: digits,\n symbol\n } = fareComponent.currency);\n transitFare = fareComponent.cents;\n }\n // For cents to string conversion, use digits from fare component.\n const centsToString = cents => {\n const dollars = (cents / 10 ** digits).toFixed(digits);\n return `${symbol}${dollars}`;\n };\n // For dollars to string conversion, assume we're rounding to two digits.\n const dollarsToString = dollars => `${symbol}${dollars.toFixed(2)}`;\n return {\n centsToString,\n currencyCode,\n dollarsToString,\n transitFare\n };\n}\n\n/**\n * For an itinerary, calculates the transit/TNC fares and returns an object with\n * these values, currency info, as well as string formatters.\n * It is assumed that the same currency is used for transit and TNC legs.\n *\n * multiple being set to true will change the output behavior:\n * - dollarsToString and centsToString will be returned as part of each fare\n * - currencyCode will be returned separately for each fare\n * - tnc currency code will be returned separately\n * - each fare type will be returned separately within a new transitFares property\n *\n * FIXME: a new approach to fare calculation must be found:\n * the current approach is not sustainable, as centsToString and DollarsToString\n * must be replaced by i18n anyway.\n *\n * However, the current behavior should ideally be kept to avoid a breaking change.\n * The \"multiple\" mode is helpful, but only prevents tnc fare calculation from being duplicated.\n * This method could be split out into a new one, along with tnc fare calculation.\n * If this is done, the individual fare calculation should also be modified to support\n * a default fare not being called \"regular\". However, this again would be a breaking change.\n * This breaking change is avoided by adding the \"multiple\" parameter.\n *\n * When centsToString and dollarsToString are removed, this method should be split into\n * individual fare calculation on a variable fare key, fare calculation of an entire leg,\n * which will get fares for every fare key in the leg, and a method to calculate the fare of\n * a tnc ride within the leg. This will make typescripting easier, as the types will be cleaner.\n */\nexport function calculateFares(itinerary, multiple = false) {\n logDeprecationWarning(\"calculateFares\", \"the fare object and getTncFare\");\n\n // Process any TNC fares\n let minTNCFare = 0;\n let maxTNCFare = 0;\n let tncCurrencyCode;\n itinerary.legs.forEach(leg => {\n if (leg.mode === \"CAR\" && leg.hailedCar && leg.tncData) {\n const { currency, maxCost, minCost } = leg.tncData;\n // TODO: Support non-USD\n minTNCFare += minCost;\n maxTNCFare += maxCost;\n tncCurrencyCode = currency;\n }\n });\n\n if (multiple) {\n // Return object of fares\n const transitFares = {};\n if (itinerary && itinerary.fare && itinerary.fare.fare) {\n Object.keys(itinerary.fare.fare).forEach(fareKey => {\n const fareComponent = itinerary.fare.fare[fareKey];\n transitFares[fareKey] = getTransitFare(fareComponent);\n });\n }\n\n return {\n maxTNCFare,\n minTNCFare,\n tncCurrencyCode,\n transitFares\n };\n }\n\n // Extract fare total from itinerary fares.\n const fareComponent =\n itinerary.fare && itinerary.fare.fare && itinerary.fare.fare.regular;\n // Get string formatters and itinerary fare.\n const {\n centsToString,\n currencyCode: transitCurrencyCode,\n dollarsToString,\n transitFare\n } = getTransitFare(fareComponent);\n\n return {\n centsToString,\n currencyCode: transitCurrencyCode || tncCurrencyCode,\n dollarsToString,\n maxTNCFare,\n minTNCFare,\n transitFare\n };\n}\n\n// map.js\n\nexport function latlngToString(latlng) {\n logDeprecationWarning(\"latlngToString\", \"the latlng object\");\n\n return (\n latlng &&\n `${latlng.lat.toFixed(5)}, ${(latlng.lng || latlng.lon).toFixed(5)}`\n );\n}\n\nexport function coordsToString(coords) {\n logDeprecationWarning(\"coordsToString\", \"the coords object\");\n\n return coords.length && coords.map(c => (+c).toFixed(5)).join(\", \");\n}\n\nexport function getDetailText(location) {\n let detailText;\n if (location.type === \"home\" || location.type === \"work\") {\n detailText = location.name;\n }\n if (location.type === \"stop\") {\n detailText = location.id;\n } else if (location.type === \"recent\" && location.timestamp) {\n detailText = moment(location.timestamp).fromNow();\n }\n return detailText;\n}\n\n// query.js\n\nexport function summarizeQuery(query, locations = []) {\n logDeprecationWarning(\"summarizeQuery\");\n\n function findLocationType(\n location,\n ls = [],\n types = [\"home\", \"work\", \"suggested\"]\n ) {\n const match = ls.find(l => require(\"./map\").matchLatLon(l, location));\n return match && types.indexOf(match.type) !== -1 ? match.type : null;\n }\n\n const from =\n findLocationType(query.from, locations) || query.from.name.split(\",\")[0];\n const to =\n findLocationType(query.to, locations) || query.to.name.split(\",\")[0];\n const mode = require(\"./itinerary\").hasTransit(query.mode)\n ? \"Transit\"\n : require(\"./itinerary\").toSentenceCase(query.mode);\n return `${mode} from ${from} to ${to}`;\n}\n"],"file":"deprecated.js"}
1
+ {"version":3,"sources":["../src/deprecated.js"],"names":["logDeprecationWarning","method","alternative","console","warn","getStepDirection","step","relativeDirection","absoluteDirection","toLowerCase","getStepInstructions","conjunction","streetName","getStepStreetName","getLegModeLabel","leg","mode","hailedCar","routeLongName","indexOf","require","toSentenceCase","getModeForPlace","place","vertexType","getPlaceName","companies","address","split","networks","company","getCompanyForNetwork","label","name","getTransitFare","fareComponent","digits","transitFare","symbol","currencyCode","defaultFractionDigits","currency","cents","centsToString","dollars","toFixed","dollarsToString","calculateFares","itinerary","multiple","minTNCFare","maxTNCFare","tncCurrencyCode","legs","forEach","tncData","maxCost","minCost","transitFares","fare","Object","keys","fareKey","regular","transitCurrencyCode","latlngToString","latlng","lat","lng","lon","coordsToString","coords","length","map","c","join","getDetailText","location","detailText","type","id","timestamp","fromNow","summarizeQuery","query","locations","findLocationType","ls","types","match","find","l","matchLatLon","from","to","hasTransit"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;AACO,SAASA,qBAAT,CAA+BC,MAA/B,EAAuCC,WAAvC,EAAoD;AACzDC,EAAAA,OAAO,CAACC,IAAR,CACG,GAAEH,MAAM,IACP,aAAc;AACpB,UACUC,WAAW,GACN;AACf;AACA,cAAcA,WAAY,+EAHL,GAIP,EACL,EATP;AAWD,C,C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AMZ,IAAI,GAAGI,OAAO,CAAC,aAAD,CAAP,CAAuB2E,UAAvB,CAAkCX,KAAK,CAACpE,IAAxC,IACT,SADS,GAETI,OAAO,CAAC,aAAD,CAAP,CAAuBC,cAAvB,CAAsC+D,KAAK,CAACpE,IAA5C,CAFJ;AAGA,SAAQ,GAAEA,IAAK,SAAQ6E,IAAK,OAAMC,EAAG,EAArC;AACD","sourcesContent":["import moment from \"moment\";\n\n/**\n * To disable cyclic dependency resolution we need to require() within methods\n * This is a good reason to disable this eslint-rule\n */\n/* eslint-disable global-require */\n\n/**\n * Generates a warning to tell developer that they are using deprecated methods!\n */\nexport function logDeprecationWarning(method, alternative) {\n console.warn(\n `${method ||\n \"This method\"} is deprecated and will be removed in a future otp-ui release. All language functionality should be handled using react-intl.\n ${\n alternative\n ? `\n\n Use ${alternative} instead, which provides a new interface that doesn't return English strings.`\n : \"\"\n }`\n );\n}\n\n// itinerary.js\n\nexport function getStepDirection(step) {\n logDeprecationWarning(\"getStepDirection\");\n\n switch (step.relativeDirection) {\n case \"DEPART\":\n return `Head ${step.absoluteDirection.toLowerCase()}`;\n case \"LEFT\":\n return \"Left\";\n case \"HARD_LEFT\":\n return \"Hard left\";\n case \"SLIGHTLY_LEFT\":\n return \"Slight left\";\n case \"CONTINUE\":\n return \"Continue\";\n case \"SLIGHTLY_RIGHT\":\n return \"Slight right\";\n case \"RIGHT\":\n return \"Right\";\n case \"HARD_RIGHT\":\n return \"Hard right\";\n case \"CIRCLE_CLOCKWISE\":\n return \"Follow circle clockwise\";\n case \"CIRCLE_COUNTERCLOCKWISE\":\n return \"Follow circle counterclockwise\";\n case \"ELEVATOR\":\n return \"Take elevator\";\n case \"UTURN_LEFT\":\n return \"Left U-turn\";\n case \"UTURN_RIGHT\":\n return \"Right U-turn\";\n default:\n return step.relativeDirection;\n }\n}\n\nexport function getStepInstructions(step) {\n logDeprecationWarning(\"getStepInstructions\");\n\n const conjunction = step.relativeDirection === \"ELEVATOR\" ? \"to\" : \"on\";\n return `${getStepDirection(step)} ${conjunction} ${step.streetName}`;\n}\n\nexport function getStepStreetName(step) {\n logDeprecationWarning(\"getStepStreetName\");\n\n if (step.streetName === \"road\") return \"Unnamed Road\";\n if (step.streetName === \"path\") return \"Unnamed Path\";\n return step.streetName;\n}\n\nexport function getLegModeLabel(leg) {\n logDeprecationWarning(\"getLegModeLabel\");\n\n switch (leg.mode) {\n case \"BICYCLE_RENT\":\n return \"Biketown\";\n case \"CAR\":\n return leg.hailedCar ? \"Ride\" : \"Drive\";\n case \"GONDOLA\":\n return \"Aerial Tram\";\n case \"TRAM\":\n if (leg.routeLongName.toLowerCase().indexOf(\"streetcar\") !== -1)\n return \"Streetcar\";\n return \"Light Rail\";\n case \"MICROMOBILITY\":\n return \"Ride\";\n default:\n return require(\"./itinerary\").toSentenceCase(leg.mode);\n }\n}\n\n/**\n * Returns mode name by checking the vertex type (VertexType class in OTP) for\n * the provided place. NOTE: this is currently only intended for vehicles at\n * the moment (not transit or walking).\n *\n * @param {string} place place from itinerary leg\n */\nexport function getModeForPlace(place) {\n logDeprecationWarning(\"getModeForPlace\");\n\n switch (place.vertexType) {\n case \"CARSHARE\":\n return \"car\";\n case \"VEHICLERENTAL\":\n return \"E-scooter\";\n // TODO: Should the type change depending on bike vertex type?\n case \"BIKESHARE\":\n case \"BIKEPARK\":\n return \"bike\";\n // If company offers more than one mode, default to `vehicle` string.\n default:\n return \"vehicle\";\n }\n}\n\nexport function getPlaceName(place, companies) {\n logDeprecationWarning(\"getPlaceName\");\n\n // If address is provided (i.e. for carshare station, use it)\n if (place.address) return place.address.split(\",\")[0];\n if (place.networks && place.vertexType === \"VEHICLERENTAL\") {\n // For vehicle rental pick up, do not use the place name. Rather, use\n // company name + vehicle type (e.g., SPIN E-scooter). Place name is often just\n // a UUID that has no relevance to the actual vehicle. For bikeshare, however,\n // there are often hubs or bikes that have relevant names to the user.\n const company = require(\"./itinerary\").getCompanyForNetwork(\n place.networks[0],\n companies\n );\n if (company) {\n return `${company.label} ${getModeForPlace(place)}`;\n }\n }\n // Default to place name\n return place.name;\n}\n\n/**\n * For a given fare component (either total fare or component parts), returns\n * an object with string formatters and the fare value (in cents).\n */\nexport function getTransitFare(fareComponent) {\n logDeprecationWarning(\"getTransitFare\", \"the fare object and getTncFare\");\n\n // Default values (if fare component is not valid).\n let digits = 2;\n let transitFare = 0;\n let symbol = \"$\";\n let currencyCode = \"USD\";\n if (fareComponent) {\n // Assign values without declaration. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#assignment_without_declaration\n ({\n currencyCode,\n defaultFractionDigits: digits,\n symbol\n } = fareComponent.currency);\n transitFare = fareComponent.cents;\n }\n // For cents to string conversion, use digits from fare component.\n const centsToString = cents => {\n const dollars = (cents / 10 ** digits).toFixed(digits);\n return `${symbol}${dollars}`;\n };\n // For dollars to string conversion, assume we're rounding to two digits.\n const dollarsToString = dollars => `${symbol}${dollars.toFixed(2)}`;\n return {\n centsToString,\n currencyCode,\n dollarsToString,\n transitFare\n };\n}\n\n/**\n * For an itinerary, calculates the transit/TNC fares and returns an object with\n * these values, currency info, as well as string formatters.\n * It is assumed that the same currency is used for transit and TNC legs.\n *\n * multiple being set to true will change the output behavior:\n * - dollarsToString and centsToString will be returned as part of each fare\n * - currencyCode will be returned separately for each fare\n * - tnc currency code will be returned separately\n * - each fare type will be returned separately within a new transitFares property\n *\n * FIXME: a new approach to fare calculation must be found:\n * the current approach is not sustainable, as centsToString and DollarsToString\n * must be replaced by i18n anyway.\n *\n * However, the current behavior should ideally be kept to avoid a breaking change.\n * The \"multiple\" mode is helpful, but only prevents tnc fare calculation from being duplicated.\n * This method could be split out into a new one, along with tnc fare calculation.\n * If this is done, the individual fare calculation should also be modified to support\n * a default fare not being called \"regular\". However, this again would be a breaking change.\n * This breaking change is avoided by adding the \"multiple\" parameter.\n *\n * When centsToString and dollarsToString are removed, this method should be split into\n * individual fare calculation on a variable fare key, fare calculation of an entire leg,\n * which will get fares for every fare key in the leg, and a method to calculate the fare of\n * a tnc ride within the leg. This will make typescripting easier, as the types will be cleaner.\n */\nexport function calculateFares(itinerary, multiple = false) {\n logDeprecationWarning(\"calculateFares\", \"the fare object and getTncFare\");\n\n // Process any TNC fares\n let minTNCFare = 0;\n let maxTNCFare = 0;\n let tncCurrencyCode;\n itinerary.legs.forEach(leg => {\n if (leg.mode === \"CAR\" && leg.hailedCar && leg.tncData) {\n const { currency, maxCost, minCost } = leg.tncData;\n // TODO: Support non-USD\n minTNCFare += minCost;\n maxTNCFare += maxCost;\n tncCurrencyCode = currency;\n }\n });\n\n if (multiple) {\n // Return object of fares\n const transitFares = {};\n if (itinerary && itinerary.fare && itinerary.fare.fare) {\n Object.keys(itinerary.fare.fare).forEach(fareKey => {\n const fareComponent = itinerary.fare.fare[fareKey];\n transitFares[fareKey] = getTransitFare(fareComponent);\n });\n }\n\n return {\n maxTNCFare,\n minTNCFare,\n tncCurrencyCode,\n transitFares\n };\n }\n\n // Extract fare total from itinerary fares.\n const fareComponent =\n itinerary.fare && itinerary.fare.fare && itinerary.fare.fare.regular;\n // Get string formatters and itinerary fare.\n const {\n centsToString,\n currencyCode: transitCurrencyCode,\n dollarsToString,\n transitFare\n } = getTransitFare(fareComponent);\n\n return {\n centsToString,\n currencyCode: transitCurrencyCode || tncCurrencyCode,\n dollarsToString,\n maxTNCFare,\n minTNCFare,\n transitFare\n };\n}\n\n// map.js\n\nexport function latlngToString(latlng) {\n logDeprecationWarning(\"latlngToString\", \"the latlng object\");\n\n return (\n latlng &&\n `${latlng.lat.toFixed(5)}, ${(latlng.lng || latlng.lon).toFixed(5)}`\n );\n}\n\nexport function coordsToString(coords) {\n logDeprecationWarning(\"coordsToString\", \"the coords object\");\n\n return coords.length && coords.map(c => (+c).toFixed(5)).join(\", \");\n}\n\nexport function getDetailText(location) {\n let detailText;\n if (location.type === \"home\" || location.type === \"work\") {\n detailText = location.name;\n }\n if (location.type === \"stop\") {\n detailText = location.id;\n } else if (location.type === \"recent\" && location.timestamp) {\n detailText = moment(location.timestamp).fromNow();\n }\n return detailText;\n}\n\n// query.js\n\nexport function summarizeQuery(query, locations = []) {\n logDeprecationWarning(\"summarizeQuery\");\n\n function findLocationType(\n location,\n ls = [],\n types = [\"home\", \"work\", \"suggested\"]\n ) {\n const match = ls.find(l => require(\"./map\").matchLatLon(l, location));\n return match && types.indexOf(match.type) !== -1 ? match.type : null;\n }\n\n const from =\n findLocationType(query.from, locations) || query.from.name.split(\",\")[0];\n const to =\n findLocationType(query.to, locations) || query.to.name.split(\",\")[0];\n const mode = require(\"./itinerary\").hasTransit(query.mode)\n ? \"Transit\"\n : require(\"./itinerary\").toSentenceCase(query.mode);\n return `${mode} from ${from} to ${to}`;\n}\n"],"file":"deprecated.js"}
package/lib/profile.js CHANGED
@@ -31,7 +31,7 @@ function filterProfileOptions(response) {
31
31
  }
32
32
 
33
33
  function locationString(str) {
34
- return str ? str.split(",")[0] : null;
34
+ return str === null || str === void 0 ? void 0 : str.split(",")[0];
35
35
  }
36
36
 
37
37
  function accessToLeg(access, origin, destination) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/profile.js"],"names":["filterProfileOptions","response","optStrs","filteredIndices","filteredProfile","otp","profile","filter","option","i","optStr","access","map","a","mode","join","transit","routes","route","id","indexOf","push","filteredJourneys","journeys","journey","locationString","str","split","accessToLeg","origin","destination","duration","time","transitLeg","from","name","to","optionToItinerary","query","itin","legs","walkTime","waitingTime","length","status","walkOnEdges","bikeEdges","walkOffEdges","onStationName","walkOnTime","offStationName","walkOffTime","streetEdges","forEach","edge","bikeRentalOffStation","distance","bikeRentalOnStation","fromName","toName","rideStats","avg","averageWait","waitStats","egress","profileOptionsToItineraries","options"],"mappings":";;;;;;;;AAAO,SAASA,oBAAT,CAA8BC,QAA9B,EAAwC;AAC7C;AACA,QAAMC,OAAO,GAAG,EAAhB;AACA,QAAMC,eAAe,GAAG,EAAxB;AAEA,QAAMC,eAAe,GAAGH,QAAQ,CAACI,GAAT,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response) {\n // Filter out similar options. TODO: handle on server?\n const optStrs = [];\n const filteredIndices = [];\n\n const filteredProfile = response.otp.profile.filter((option, i) => {\n let optStr = option.access.map(a => a.mode).join(\"/\");\n if (option.transit) {\n optStr += ` to ${option.transit\n .map(transit => {\n return transit.routes.map(route => route.id).join(\"/\");\n })\n .join(\",\")}`;\n }\n if (optStrs.indexOf(optStr) !== -1) return false;\n optStrs.push(optStr);\n filteredIndices.push(i);\n return true;\n });\n\n const filteredJourneys = response.otp.journeys.filter(\n (journey, i) => filteredIndices.indexOf(i) !== -1\n );\n\n response.otp.profile = filteredProfile;\n response.otp.journeys = filteredJourneys;\n return response;\n}\n\nfunction locationString(str) {\n return str ? str.split(\",\")[0] : null;\n}\n\nfunction accessToLeg(access, origin, destination) {\n return {\n mode: access.mode,\n duration: access.time,\n transitLeg: false,\n from: {\n name: locationString(origin)\n },\n to: {\n name: locationString(destination)\n }\n };\n}\n\n// helper functions for profileOptionsToItineraries:\n\nfunction optionToItinerary(option, query) {\n const itin = {\n duration: option.time,\n legs: [],\n walkTime: 0,\n waitingTime: 0\n };\n\n // access leg\n if (option.access && option.access.length > 0) {\n if (option.access[0].mode === \"BICYCLE_RENT\") {\n let status = \"WALK_ON\";\n const walkOnEdges = [];\n const bikeEdges = [];\n const walkOffEdges = [];\n let onStationName;\n let walkOnTime = 0;\n let offStationName;\n let walkOffTime = 0;\n option.access[0].streetEdges.forEach(edge => {\n // check if we're returning the bike\n if (edge.bikeRentalOffStation) {\n status = \"WALK_OFF\";\n offStationName = edge.bikeRentalOffStation.name;\n }\n\n if (status === \"WALK_ON\") {\n walkOnEdges.push(edge);\n walkOnTime += edge.distance;\n } else if (status === \"BIKE\") {\n bikeEdges.push(edge);\n } else if (status === \"WALK_OFF\") {\n walkOffEdges.push(edge);\n walkOffTime += edge.distance;\n }\n\n // check if we're picking up the bike\n if (edge.bikeRentalOnStation) {\n status = \"BIKE\";\n onStationName = edge.bikeRentalOnStation.name;\n }\n });\n\n itin.walkTime += walkOnTime + walkOffTime;\n\n // create the 'on' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOnTime,\n transitLeg: false,\n from: {\n name: locationString(query && query.from.name)\n },\n to: {\n name: onStationName\n }\n });\n\n // create the bike leg\n itin.legs.push({\n mode: \"BICYCLE_RENT\",\n duration: option.time - walkOnTime - walkOffTime,\n transitLeg: false,\n from: {\n name: onStationName\n },\n to: {\n name: offStationName\n }\n });\n\n // create the 'off' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOffTime,\n transitLeg: false,\n from: {\n name: offStationName\n },\n to: {\n name: locationString(query && query.to.name)\n }\n });\n } else {\n itin.legs.push(\n accessToLeg(\n option.access[0],\n query && query.from.name,\n option.transit ? null : query && query.to.name\n )\n );\n if (option.access[0].mode === \"WALK\")\n itin.walkTime += option.access[0].time;\n }\n }\n\n // transit legs\n if (option.transit) {\n option.transit.forEach(transit => {\n itin.legs.push({\n transitLeg: true,\n mode: transit.mode,\n from: {\n name: transit.fromName\n },\n to: {\n name: transit.toName\n },\n routes: transit.routes,\n duration: transit.rideStats.avg,\n averageWait: transit.waitStats.avg\n });\n itin.waitingTime += transit.waitStats.avg;\n });\n }\n\n // egress leg\n if (option.egress && option.egress.length > 0) {\n // find the origin name, for transit trips\n const origin = option.transit\n ? option.transit[option.transit.length - 1].toName\n : null;\n\n itin.legs.push(\n accessToLeg(option.egress[0], origin, query && query.to.name)\n );\n if (option.egress[0].mode === \"WALK\")\n itin.walkTime += option.egress[0].time;\n }\n\n return itin;\n}\n\n/** profileOptionsToItineraries * */\n\nexport function profileOptionsToItineraries(options, query) {\n return options.map(option => optionToItinerary(option, query));\n}\n"],"file":"profile.js"}
1
+ {"version":3,"sources":["../src/profile.js"],"names":["filterProfileOptions","response","optStrs","filteredIndices","filteredProfile","otp","profile","filter","option","i","optStr","access","map","a","mode","join","transit","routes","route","id","indexOf","push","filteredJourneys","journeys","journey","locationString","str","split","accessToLeg","origin","destination","duration","time","transitLeg","from","name","to","optionToItinerary","query","itin","legs","walkTime","waitingTime","length","status","walkOnEdges","bikeEdges","walkOffEdges","onStationName","walkOnTime","offStationName","walkOffTime","streetEdges","forEach","edge","bikeRentalOffStation","distance","bikeRentalOnStation","fromName","toName","rideStats","avg","averageWait","waitStats","egress","profileOptionsToItineraries","options"],"mappings":";;;;;;;;AAAO,SAASA,oBAAT,CAA8BC,QAA9B,EAAwC;AAC7C;AACA,QAAMC,OAAO,GAAG,EAAhB;AACA,QAAMC,eAAe,GAAG,EAAxB;AAEA,QAAMC,eAAe,GAAGH,QAAQ,CAACI,GAAT,CAAaC,OAAb,CAAqBC,MAArB,CAA4B,CAACC,MAAD,EAASC,CAAT,KAAe;AACjE,QAAIC,MAAM,GAAGF,MAAM,CAACG,MAAP,CAAcC,GAAd,CAAkBC,CAAC,IAAIA,CAAC,CAACC,IAAzB,EAA+BC,IAA/B,CAAoC,GAApC,CAAb;;AACA,QAAIP,MAAM,CAACQ,OAAX,EAAoB;AAClBN,MAAAA,MAAM,IAAK,OAAMF,MAAM,CAACQ,OAAP,CACdJ,GADc,CACVI,OAAO,IAAI;AACd,eAAOA,OAAO,CAACC,MAAR,CAAeL,GAAf,CAAmBM,KAAK,IAAIA,KAAK,CAACC,EAAlC,EAAsCJ,IAAtC,CAA2C,GAA3C,CAAP;AACD,OAHc,EAIdA,IAJc,CAIT,GAJS,CAIJ,EAJb;AAKD;;AACD,QAAIb,OAAO,CAACkB,OAAR,CAAgBV,MAAhB,MAA4B,CAAC,CAAjC,EAAoC,OAAO,KAAP;AACpCR,IAAAA,OAAO,CAACmB,IAAR,CAAaX,MAAb;AACAP,IAAAA,eAAe,CAACkB,IAAhB,CAAqBZ,CAArB;AACA,WAAO,IAAP;AACD,GAbuB,CAAxB;AAeA,QAAMa,gBAAgB,GAAGrB,QAAQ,CAACI,GAAT,CAAakB,QAAb,CAAsBhB,MAAtB,CACvB,CAACiB,OAAD,EAAUf,CAAV,KAAgBN,eAAe,CAACiB,OAAhB,CAAwBX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wD,MAAP,CAAc,CAAd,EAAiBlD,IAAjB,KAA0B,MAA9B,EACEyB,IAAI,CAACE,QAAL,IAAiBjC,MAAM,CAACwD,MAAP,CAAc,CAAd,EAAiBhC,IAAlC;AACH;;AAED,SAAOO,IAAP;AACD;AAED;;;AAEO,SAAS0B,2BAAT,CAAqCC,OAArC,EAA8C5B,KAA9C,EAAqD;AAC1D,SAAO4B,OAAO,CAACtD,GAAR,CAAYJ,MAAM,IAAI6B,iBAAiB,CAAC7B,MAAD,EAAS8B,KAAT,CAAvC,CAAP;AACD","sourcesContent":["export function filterProfileOptions(response) {\n // Filter out similar options. TODO: handle on server?\n const optStrs = [];\n const filteredIndices = [];\n\n const filteredProfile = response.otp.profile.filter((option, i) => {\n let optStr = option.access.map(a => a.mode).join(\"/\");\n if (option.transit) {\n optStr += ` to ${option.transit\n .map(transit => {\n return transit.routes.map(route => route.id).join(\"/\");\n })\n .join(\",\")}`;\n }\n if (optStrs.indexOf(optStr) !== -1) return false;\n optStrs.push(optStr);\n filteredIndices.push(i);\n return true;\n });\n\n const filteredJourneys = response.otp.journeys.filter(\n (journey, i) => filteredIndices.indexOf(i) !== -1\n );\n\n response.otp.profile = filteredProfile;\n response.otp.journeys = filteredJourneys;\n return response;\n}\n\nfunction locationString(str) {\n return str?.split(\",\")[0];\n}\n\nfunction accessToLeg(access, origin, destination) {\n return {\n mode: access.mode,\n duration: access.time,\n transitLeg: false,\n from: {\n name: locationString(origin)\n },\n to: {\n name: locationString(destination)\n }\n };\n}\n\n// helper functions for profileOptionsToItineraries:\n\nfunction optionToItinerary(option, query) {\n const itin = {\n duration: option.time,\n legs: [],\n walkTime: 0,\n waitingTime: 0\n };\n\n // access leg\n if (option.access && option.access.length > 0) {\n if (option.access[0].mode === \"BICYCLE_RENT\") {\n let status = \"WALK_ON\";\n const walkOnEdges = [];\n const bikeEdges = [];\n const walkOffEdges = [];\n let onStationName;\n let walkOnTime = 0;\n let offStationName;\n let walkOffTime = 0;\n option.access[0].streetEdges.forEach(edge => {\n // check if we're returning the bike\n if (edge.bikeRentalOffStation) {\n status = \"WALK_OFF\";\n offStationName = edge.bikeRentalOffStation.name;\n }\n\n if (status === \"WALK_ON\") {\n walkOnEdges.push(edge);\n walkOnTime += edge.distance;\n } else if (status === \"BIKE\") {\n bikeEdges.push(edge);\n } else if (status === \"WALK_OFF\") {\n walkOffEdges.push(edge);\n walkOffTime += edge.distance;\n }\n\n // check if we're picking up the bike\n if (edge.bikeRentalOnStation) {\n status = \"BIKE\";\n onStationName = edge.bikeRentalOnStation.name;\n }\n });\n\n itin.walkTime += walkOnTime + walkOffTime;\n\n // create the 'on' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOnTime,\n transitLeg: false,\n from: {\n name: locationString(query && query.from.name)\n },\n to: {\n name: onStationName\n }\n });\n\n // create the bike leg\n itin.legs.push({\n mode: \"BICYCLE_RENT\",\n duration: option.time - walkOnTime - walkOffTime,\n transitLeg: false,\n from: {\n name: onStationName\n },\n to: {\n name: offStationName\n }\n });\n\n // create the 'off' walk leg\n itin.legs.push({\n mode: \"WALK\",\n duration: walkOffTime,\n transitLeg: false,\n from: {\n name: offStationName\n },\n to: {\n name: locationString(query && query.to.name)\n }\n });\n } else {\n itin.legs.push(\n accessToLeg(\n option.access[0],\n query && query.from.name,\n option.transit ? null : query && query.to.name\n )\n );\n if (option.access[0].mode === \"WALK\")\n itin.walkTime += option.access[0].time;\n }\n }\n\n // transit legs\n if (option.transit) {\n option.transit.forEach(transit => {\n itin.legs.push({\n transitLeg: true,\n mode: transit.mode,\n from: {\n name: transit.fromName\n },\n to: {\n name: transit.toName\n },\n routes: transit.routes,\n duration: transit.rideStats.avg,\n averageWait: transit.waitStats.avg\n });\n itin.waitingTime += transit.waitStats.avg;\n });\n }\n\n // egress leg\n if (option.egress && option.egress.length > 0) {\n // find the origin name, for transit trips\n const origin = option.transit\n ? option.transit[option.transit.length - 1].toName\n : null;\n\n itin.legs.push(\n accessToLeg(option.egress[0], origin, query && query.to.name)\n );\n if (option.egress[0].mode === \"WALK\")\n itin.walkTime += option.egress[0].time;\n }\n\n return itin;\n}\n\n/** profileOptionsToItineraries * */\n\nexport function profileOptionsToItineraries(options, query) {\n return options.map(option => optionToItinerary(option, query));\n}\n"],"file":"profile.js"}
@@ -256,7 +256,7 @@ const queryParams = [{
256
256
  }, {
257
257
  /* optimize -- how to optimize a trip (non-bike, non-micromobility trips) */
258
258
  name: "optimize",
259
- applicable: query => (0, _itinerary.hasTransit)(query.mode) && !(0, _itinerary.hasBike)(query.mode),
259
+ applicable: query => !query.otp2 && (0, _itinerary.hasTransit)(query.mode) && !(0, _itinerary.hasBike)(query.mode),
260
260
  routingTypes: ["ITINERARY"],
261
261
  default: "QUICK",
262
262
  selector: "DROPDOWN",
@@ -271,7 +271,7 @@ const queryParams = [{
271
271
  }, {
272
272
  /* optimizeBike -- how to optimize an bike-based trip */
273
273
  name: "optimizeBike",
274
- applicable: query => (0, _itinerary.hasBike)(query.mode),
274
+ applicable: query => !query.otp2 && (0, _itinerary.hasBike)(query.mode),
275
275
  routingTypes: ["ITINERARY"],
276
276
  default: "SAFE",
277
277
  selector: "DROPDOWN",
@@ -356,6 +356,8 @@ const queryParams = [{
356
356
  high: 20,
357
357
  step: 0.5,
358
358
  label: "walk reluctance",
359
+ labelLow: "More Walking",
360
+ labelHigh: "More Transit",
359
361
  applicable: query =>
360
362
  /* Since this query variable isn't in this list, it's not included in the generated query
361
363
  * It does however allow us to determine if we should show the OTP1 max walk distance
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/query-params.js"],"names":["formatPlace","location","alternateName","name","lat","lon","storedSettings","queryParams","routingTypes","default","itineraryRewrite","value","fromPlace","profileRewrite","from","toPlace","to","getCurrentDate","getCurrentTime","arriveBy","accessModes","directModes","transitModes","length","split","forEach","m","push","applicable","query","otp2","mode","indexOf","selector","label","options","text","maxWalkDistance","maxBikeDistance","opts","splice","optimize","low","high","step","maxEScooterDistance","watts","maximumMicromobilitySpeed","weight","TYPICAL_RIDER_WEIGHT","icon","config","modes","configModes","concat","some","configMode","find","showWheelchairSetting","company","companies","includes","places","Array","isArray","intermediatePlaces","map","place","undefined","param","userDefaultOverride","getCustomQueryParams","customizations","clonedParams","Object","keys","k","paramIndex","findIndex"],"mappings":";;;;;;;;;;;AAIA;;AACA;;AACA;;AAEA;;AAQA;;AACA;;AAjBA;AACA;AAEA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,SAASA,WAAT,CAAqBC,QAArB,EAA+BC,aAA/B,EAA8C;AACnD,MAAI,CAACD,QAAL,EAAe,OAAO,IAAP;AACf,QAAME,IAAI,GACRF,QAAQ,CAACE,IAAT,IACC,GAAED,aAAa,GAAI,GAAEA,aAAc,GAApB,GAAyB,EAAG,IAAGD,QAAQ,CAACG,GAAI,IAC1DH,QAAQ,CAACI,GACV,GAJH,CAFmD,CAOnD;;AACA,SAAQ,GAAEF,IAAK,KAAIF,QAAQ,CAACG,GAAI,IAAGH,QAAQ,CAACI,GAAI,EAAhD;AACD,C,CAED;;;AACA,MAAMC,cAAc,GAAG,sBAAQ,cAAR,EAAwB,EAAxB,CAAvB;AAEA,MAAMC,WAAW,GAAG,CAClB;AACE;AACAJ,EAAAA,IAAI,EAAE,MAFR;AAGEK,EAAAA,YAAY,EAAE,CAAC,WAAD,EAAc,SAAd,CAHhB;AAIEC,EAAAA,OAAO,EAAE,IAJX;AAKEC,EAAAA,gBAAgB,EAAEC,KAAK,KAAK;AAAEC,IAAAA,SAAS,EAAEZ,WAAW,CAACW,KAAD;AAAxB,GAAL,CALzB;AAMEE,EAAAA,cAAc,EAAEF,KAAK,KAAK;AAAEG,IAAAA,IAAI,EAAE;AAAEV,MAAAA,GAAG,EAAEO,KAAK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AK,IAAIA,KAAK,CAAClE,IAAN,KAAeyE,CAA/C,CAAnB;;AACA,QAAIC,UAAU,KAAK,CAAC,CAApB,EAAuB;AACrBJ,MAAAA,YAAY,CAACI,UAAD,CAAZ,GAA2B,EACzB,GAAGJ,YAAY,CAACI,UAAD,CADU;AAEzB,WAAGL,cAAc,CAACI,CAAD;AAFQ,OAA3B;AAID;AACF,GATD;AAUA,SAAOH,YAAP;AACD","sourcesContent":["// TODO: Remove this entire file, as it is deprecated in favor of i18n-queryParams within\n// the SettingsSelector package\n\n// This is only used within stories\nimport cloneDeep from \"lodash.clonedeep\";\nimport React from \"react\";\nimport { Wheelchair } from \"@styled-icons/foundation/Wheelchair\";\n\nimport {\n isTransit,\n isAccessMode,\n isCar,\n hasTransit,\n hasBike,\n hasMicromobility\n} from \"./itinerary\";\nimport { getItem } from \"./storage\";\nimport { getCurrentDate, getCurrentTime } from \"./time\";\n\n/**\n * name: the default name of the parameter used for internal reference and API calls\n *\n * routingTypes: array of routing type(s) (ITINERARY, PROFILE, or both) this param applies to\n *\n * applicable: an optional function (accepting the current full query as a\n * parameter) indicating whether this query parameter is applicable to the query.\n * (Applicability is assumed if this function is not provided.)\n *\n * default: the default value for this parameter. The default can be also be a\n * function that gets executed when accessing the default value.\n *\n * itineraryRewrite: an optional function for translating the key and/or value\n * for ITINERARY mode only (e.g. 'to' is rewritten as 'toPlace'). Accepts the\n * initial internal value as a function parameter.\n *\n * profileRewrite: an optional function for translating the value for PROFILE mode\n *\n * label: a text label for for onscreen display. May either be a text string or a\n * function (accepting the current full query as a parameter) returning a string\n *\n * selector: the default type of UI selector to use in the form. Can be one of:\n * - DROPDOWN: a standard drop-down menu selector\n *\n * options: an array of text/value pairs used with a dropdown selector\n *\n * TODO: validation system for rewrite functions and/or better user documentation\n * TODO: alphabetize below list\n */\n\n// FIXME: Use for parsing URL values?\n// const stringToLocation = string => {\n// const split = string.split(',')\n// return split.length === 2\n// ? {lat: split[0], lon: split[1]}\n// : {lat: null, lon: null}\n// }\n\n/**\n * Format location object as string for use in fromPlace or toPlace query param.\n */\nexport function formatPlace(location, alternateName) {\n if (!location) return null;\n const name =\n location.name ||\n `${alternateName ? `${alternateName} ` : \"\"}(${location.lat},${\n location.lon\n })`;\n // This string is not language-specific\n return `${name}::${location.lat},${location.lon}`;\n}\n\n// Load stored default query settings from local storage\nconst storedSettings = getItem(\"defaultQuery\", {});\n\nconst queryParams = [\n {\n /* from - the trip origin. stored internally as a location (lat/lon/name) object */\n name: \"from\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: null,\n itineraryRewrite: value => ({ fromPlace: formatPlace(value) }),\n profileRewrite: value => ({ from: { lat: value.lat, lon: value.lon } })\n // FIXME: Use for parsing URL values?\n // fromURL: stringToLocation\n },\n\n {\n /* to - the trip destination. stored internally as a location (lat/lon/name) object */\n name: \"to\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: null,\n itineraryRewrite: value => ({ toPlace: formatPlace(value) }),\n profileRewrite: value => ({ to: { lat: value.lat, lon: value.lon } })\n // FIXME: Use for parsing URL values?\n // fromURL: stringToLocation\n },\n\n {\n /* date - the date of travel, in MM-DD-YYYY format */\n name: \"date\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: getCurrentDate\n },\n\n {\n /* time - the arrival/departure time for an itinerary trip, in HH:mm format */\n name: \"time\",\n routingTypes: [\"ITINERARY\"],\n default: getCurrentTime\n },\n\n {\n /* departArrive - whether this is a depart-at, arrive-by, or leave-now trip */\n name: \"departArrive\",\n routingTypes: [\"ITINERARY\"],\n default: \"NOW\",\n itineraryRewrite: value => ({ arriveBy: value === \"ARRIVE\" })\n },\n\n {\n /* startTime - the start time for a profile trip, in HH:mm format */\n name: \"startTime\",\n routingTypes: [\"PROFILE\"],\n default: \"07:00\"\n },\n\n {\n /* endTime - the end time for a profile trip, in HH:mm format */\n name: \"endTime\",\n routingTypes: [\"PROFILE\"],\n default: \"09:00\"\n },\n\n {\n /* mode - the allowed modes for a trip, as a comma-separated list */\n name: \"mode\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: \"WALK,TRANSIT\", // TODO: make this dependent on routingType?\n profileRewrite: value => {\n const accessModes = [];\n const directModes = [];\n const transitModes = [];\n\n if (value && value.length > 0) {\n value.split(\",\").forEach(m => {\n if (isTransit(m)) transitModes.push(m);\n if (isAccessMode(m)) {\n accessModes.push(m);\n // TODO: make configurable whether direct-driving is considered\n if (!isCar(m)) directModes.push(m);\n }\n });\n }\n\n return { accessModes, directModes, transitModes };\n }\n },\n\n {\n /* showIntermediateStops - whether response should include intermediate stops for transit legs */\n name: \"showIntermediateStops\",\n routingTypes: [\"ITINERARY\"],\n default: true\n },\n\n {\n /* maxWalkDistance - the maximum distance in meters the user will walk to transit. */\n name: \"maxWalkDistance\",\n routingTypes: [\"ITINERARY\"],\n applicable: query =>\n /* Since this query variable isn't in this list, it's not included in the generated query\n * It does however allow us to determine if we should show the OTP1 max walk distance\n * dropdown or the OTP2 walk reluctance slider\n */\n !query.otp2 &&\n query.mode &&\n hasTransit(query.mode) &&\n query.mode.indexOf(\"WALK\") !== -1,\n default: 1207, // 3/4 mi.\n selector: \"DROPDOWN\",\n label: \"Maximum Walk\",\n options: [\n {\n text: \"1/10 mile\",\n value: 160.9\n },\n {\n text: \"1/4 mile\",\n value: 402.3\n },\n {\n text: \"1/2 mile\",\n value: 804.7\n },\n {\n text: \"3/4 mile\",\n value: 1207\n },\n {\n text: \"1 mile\",\n value: 1609\n },\n {\n text: \"2 miles\",\n value: 3219\n },\n {\n text: \"5 miles\",\n value: 8047\n }\n ]\n },\n\n {\n /* maxBikeDistance - the maximum distance in meters the user will bike. Not\n * actually an OTP parameter (maxWalkDistance doubles for biking) but we\n * store it separately internally in order to allow different default values,\n * options, etc. Translated to 'maxWalkDistance' via the rewrite function.\n */\n name: \"maxBikeDistance\",\n routingTypes: [\"ITINERARY\"],\n applicable: query =>\n query.mode &&\n hasTransit(query.mode) &&\n query.mode.indexOf(\"BICYCLE\") !== -1,\n default: 4828, // 3 mi.\n selector: \"DROPDOWN\",\n label: \"Maximum Bike\",\n options: [\n {\n text: \"1/4 mile\",\n value: 402.3\n },\n {\n text: \"1/2 mile\",\n value: 804.7\n },\n {\n text: \"3/4 mile\",\n value: 1207\n },\n {\n text: \"1 mile\",\n value: 1609\n },\n {\n text: \"2 miles\",\n value: 3219\n },\n {\n text: \"3 miles\",\n value: 4828\n },\n {\n text: \"5 miles\",\n value: 8047\n },\n {\n text: \"10 miles\",\n value: 16093\n },\n {\n text: \"20 miles\",\n value: 32187\n },\n {\n text: \"30 miles\",\n value: 48280\n }\n ],\n itineraryRewrite: value => ({\n maxWalkDistance: value,\n // ensures that the value is repopulated when loaded from URL params\n maxBikeDistance: value\n })\n },\n\n {\n /* optimize -- how to optimize a trip (non-bike, non-micromobility trips) */\n name: \"optimize\",\n applicable: query => hasTransit(query.mode) && !hasBike(query.mode),\n routingTypes: [\"ITINERARY\"],\n default: \"QUICK\",\n selector: \"DROPDOWN\",\n label: \"Optimize for\",\n options: [\n {\n text: \"Speed\",\n value: \"QUICK\"\n },\n {\n text: \"Fewest Transfers\",\n value: \"TRANSFERS\"\n }\n ]\n },\n\n {\n /* optimizeBike -- how to optimize an bike-based trip */\n name: \"optimizeBike\",\n applicable: query => hasBike(query.mode),\n routingTypes: [\"ITINERARY\"],\n default: \"SAFE\",\n selector: \"DROPDOWN\",\n label: \"Optimize for\",\n options: query => {\n const opts = [\n {\n text: \"Speed\",\n value: \"QUICK\"\n },\n {\n text: \"Bike-Friendly Trip\",\n value: \"SAFE\"\n },\n {\n text: \"Flat Trip\",\n value: \"FLAT\"\n }\n ];\n\n // Include transit-specific option, if applicable\n if (hasTransit(query.mode)) {\n opts.splice(1, 0, {\n text: \"Fewest Transfers\",\n value: \"TRANSFERS\"\n });\n }\n\n return opts;\n },\n itineraryRewrite: value => ({ optimize: value })\n },\n\n {\n /* maxWalkTime -- the maximum time the user will spend walking in minutes */\n name: \"maxWalkTime\",\n routingTypes: [\"PROFILE\"],\n default: 15,\n selector: \"DROPDOWN\",\n label: \"Max Walk Time\",\n applicable: query =>\n query.mode && hasTransit(query.mode) && query.mode.indexOf(\"WALK\") !== -1,\n options: [\n {\n text: \"5 minutes\",\n value: 5\n },\n {\n text: \"10 minutes\",\n value: 10\n },\n {\n text: \"15 minutes\",\n value: 15\n },\n {\n text: \"20 minutes\",\n value: 20\n },\n {\n text: \"30 minutes\",\n value: 30\n },\n {\n text: \"45 minutes\",\n value: 45\n },\n {\n text: \"1 hour\",\n value: 60\n }\n ]\n },\n\n {\n /* walkSpeed -- the user's walking speed in m/s */\n name: \"walkSpeed\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: 1.34,\n selector: \"DROPDOWN\",\n label: \"Walk Speed\",\n applicable: query => query.mode && query.mode.indexOf(\"WALK\") !== -1,\n options: [\n {\n text: \"2 MPH\",\n value: 0.89\n },\n {\n text: \"3 MPH\",\n value: 1.34\n },\n {\n text: \"4 MPH\",\n value: 1.79\n }\n ]\n },\n\n {\n name: \"walkReluctance\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n selector: \"SLIDER\",\n low: 0.5,\n high: 20,\n step: 0.5,\n label: \"walk reluctance\",\n applicable: query =>\n /* Since this query variable isn't in this list, it's not included in the generated query\n * It does however allow us to determine if we should show the OTP1 max walk distance\n * dropdown or the OTP2 walk reluctance slider\n */\n !!query.otp2 && query.mode && query.mode.indexOf(\"WALK\") !== -1\n },\n {\n /* maxBikeTime -- the maximum time the user will spend biking in minutes */\n name: \"maxBikeTime\",\n routingTypes: [\"PROFILE\"],\n default: 20,\n selector: \"DROPDOWN\",\n label: \"Max Bike Time\",\n applicable: query =>\n query.mode &&\n hasTransit(query.mode) &&\n query.mode.indexOf(\"BICYCLE\") !== -1,\n options: [\n {\n text: \"5 minutes\",\n value: 5\n },\n {\n text: \"10 minutes\",\n value: 10\n },\n {\n text: \"15 minutes\",\n value: 15\n },\n {\n text: \"20 minutes\",\n value: 20\n },\n {\n text: \"30 minutes\",\n value: 30\n },\n {\n text: \"45 minutes\",\n value: 45\n },\n {\n text: \"1 hour\",\n value: 60\n }\n ]\n },\n\n {\n /* bikeSpeed -- the user's bikeSpeed speed in m/s */\n name: \"bikeSpeed\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: 3.58,\n selector: \"DROPDOWN\",\n label: \"Bicycle Speed\",\n applicable: query => query.mode && query.mode.indexOf(\"BICYCLE\") !== -1,\n options: [\n {\n text: \"6 MPH\",\n value: 2.68\n },\n {\n text: \"8 MPH\",\n value: 3.58\n },\n {\n text: \"10 MPH\",\n value: 4.47\n },\n {\n text: \"12 MPH\",\n value: 5.36\n }\n ]\n },\n\n {\n /* maxEScooterDistance - the maximum distance in meters the user will ride\n * an E-scooter. Not actually an OTP parameter (maxWalkDistance doubles for\n * any non-transit mode except for car) but we store it separately\n * internally in order to allow different default values, options, etc.\n * Translated to 'maxWalkDistance' via the rewrite function.\n */\n name: \"maxEScooterDistance\",\n routingTypes: [\"ITINERARY\"],\n applicable: query =>\n query.mode && hasTransit(query.mode) && hasMicromobility(query.mode),\n default: 4828, // 3 mi.\n selector: \"DROPDOWN\",\n label: \"Maximum E-scooter Distance\",\n options: [\n {\n text: \"1/4 mile\",\n value: 402.3\n },\n {\n text: \"1/2 mile\",\n value: 804.7\n },\n {\n text: \"3/4 mile\",\n value: 1207\n },\n {\n text: \"1 mile\",\n value: 1609\n },\n {\n text: \"2 miles\",\n value: 3219\n },\n {\n text: \"3 miles\",\n value: 4828\n },\n {\n text: \"5 miles\",\n value: 8047\n },\n {\n text: \"10 miles\",\n value: 16093\n },\n {\n text: \"20 miles\",\n value: 32187\n },\n {\n text: \"30 miles\",\n value: 48280\n }\n ],\n itineraryRewrite: value => ({\n maxWalkDistance: value,\n // ensures that the value is repopulated when loaded from URL params\n maxEScooterDistance: value\n })\n },\n\n {\n /* bikeSpeed -- the user's bikeSpeed speed in m/s */\n name: \"watts\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: 250,\n selector: \"DROPDOWN\",\n label: \"E-scooter Power\",\n // this configuration should only be allowed for personal E-scooters as these\n // settings will be defined by the vehicle type of an E-scooter being rented\n applicable: query =>\n query.mode &&\n query.mode.indexOf(\"MICROMOBILITY\") !== -1 &&\n query.mode.indexOf(\"MICROMOBILITY_RENT\") === -1,\n options: [\n {\n text: \"Kid's hoverboard (6mph)\",\n value: 125\n },\n {\n text: \"Entry-level scooter (11mph)\",\n value: 250\n },\n {\n text: \"Robust E-scooter (18mph)\",\n value: 500\n },\n {\n text: \"Powerful E-scooter (24mph)\",\n value: 1500\n }\n ],\n // rewrite a few other values to add some baseline assumptions about the\n // vehicle\n itineraryRewrite: value => {\n const watts = value;\n // the maximum cruising and downhill speed. Units in m/s\n let maximumMicromobilitySpeed;\n let weight;\n // see https://en.wikipedia.org/wiki/Human_body_weight#Average_weight_around_the_world\n // estimate is for an average North American human with clothes and stuff\n // units are in kg\n const TYPICAL_RIDER_WEIGHT = 90;\n switch (watts) {\n case 125:\n // exemplar: Swagtron Turbo 5 hoverboard (https://swagtron.com/product/recertified-swagtron-turbo-five-hoverboard-classic/)\n maximumMicromobilitySpeed = 2.8; // ~= 6mph\n weight = TYPICAL_RIDER_WEIGHT + 9;\n break;\n case 250:\n // exemplar: Xiaomi M365 (https://www.gearbest.com/skateboard/pp_596618.html)\n maximumMicromobilitySpeed = 5; // ~= 11.5mph\n weight = TYPICAL_RIDER_WEIGHT + 12.5;\n break;\n case 500:\n // exemplar: Razor EcoSmart Metro (https://www.amazon.com/Razor-EcoSmart-Metro-Electric-Scooter/dp/B002ZDAEIS?SubscriptionId=AKIAJMXJ2YFJTEDLQMUQ&tag=digitren08-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B002ZDAEIS&ascsubtag=15599460143449ocb)\n maximumMicromobilitySpeed = 8; // ~= 18mph\n weight = TYPICAL_RIDER_WEIGHT + 30;\n break;\n case 1000:\n // exemplar: Boosted Rev (https://boostedboards.com/vehicles/scooters/boosted-rev)\n maximumMicromobilitySpeed = 11; // ~= 24mph\n weight = TYPICAL_RIDER_WEIGHT + 21;\n break;\n default:\n break;\n }\n return { maximumMicromobilitySpeed, watts, weight };\n }\n },\n\n {\n /* ignoreRealtimeUpdates -- if true, do not use realtime updates in routing */\n name: \"ignoreRealtimeUpdates\",\n routingTypes: [\"ITINERARY\"],\n default: false\n },\n\n {\n /* companies -- tnc companies to query */\n name: \"companies\",\n routingTypes: [\"ITINERARY\"]\n },\n\n {\n /* wheelchair -- whether the user requires a wheelchair-accessible trip */\n name: \"wheelchair\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: false,\n selector: \"CHECKBOX\",\n label: \"Prefer Wheelchair Accessible Routes\",\n icon: <Wheelchair />,\n applicable: (query, config) => {\n if (!query.mode || !config.modes) return false;\n const configModes = (config.modes.accessModes || []).concat(\n config.modes.transitModes || []\n );\n return query.mode.split(\",\").some(mode => {\n const configMode = configModes.find(m => m.mode === mode);\n if (!configMode || !configMode.showWheelchairSetting) return false;\n if (\n configMode.company &&\n (!query.companies ||\n !query.companies.split(\",\").includes(configMode.company))\n )\n return false;\n return true;\n });\n }\n },\n\n {\n name: \"bannedRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"numItineraries\",\n routingTypes: [\"ITINERARY\"],\n default: 3\n },\n {\n name: \"intermediatePlaces\",\n default: [],\n routingTypes: [\"ITINERARY\"],\n itineraryRewrite: places =>\n Array.isArray(places) && places.length > 0\n ? {\n intermediatePlaces: places.map(place => formatPlace(place))\n }\n : undefined\n },\n {\n // Time penalty in seconds the requester is willing to accept in order to\n // complete journey on preferred route. I.e., number of seconds that we are\n // willing to wait for the preferred route.\n name: \"otherThanPreferredRoutesPenalty\",\n default: 15 * 60, // 15 minutes\n routingTypes: [\"ITINERARY\"]\n },\n // Below are less commonly used query params included so that in case they are\n // passed in a query parameter they do not get filtered out from the ultimate\n // API request.\n {\n name: \"preferredRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"maxPreTransitTime\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"waitReluctance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"driveDistanceReluctance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"driveTimeReluctance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"waitAtBeginningFactor\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bikeSwitchTime\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bikeSwitchCost\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"minTransferTime\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"preferredAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"unpreferredRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"unpreferredAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"walkBoardCost\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bikeBoardCost\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"whiteListedRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"whiteListedAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedTrips\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedStops\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedStopsHard\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"transferPenalty\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"nonpreferredTransferPenalty\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"maxTransfers\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"batch\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"startTransitStopId\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"startTransitTripId\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"clampInitialWait\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"reverseOptimizeOnTheFly\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"boardSlack\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"alightSlack\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"locale\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"disableRemainingWeightHeuristic\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexFlagStopBufferSize\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexUseReservationServices\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexUseEligibilityServices\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexIgnoreDrtAdvanceBookMin\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"maxHours\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"useRequestedDateTimeInMaxHours\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"disableAlertFiltering\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"geoidElevation\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"invalidDateStrategy\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"minTransitDistance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"searchTimeout\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"pathComparator\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"onlyTransitTrips\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"minimumMicromobilitySpeed\",\n routingTypes: [\"ITINERARY\"]\n }\n];\n// Iterate over stored settings and update query param defaults.\n// FIXME: this does not get updated if the user defaults are cleared\nqueryParams.forEach(param => {\n if (param.name in storedSettings) {\n param.default = storedSettings[param.name];\n param.userDefaultOverride = true;\n }\n});\n\nexport default queryParams;\n\n/**\n * You can customize the queryParams labels and options, and labels and values for each option.\n * @param customizations The optional customizations to apply: an object whose fields\n * correspond to the items in queryParams with the corresponding name,\n * the value for those fields being an object which fields (label, options...)\n * will override the originals.\n * Example:\n * {\n * // Matches the name param\n * maxWalkDistance: {\n * // Any fields that should be overridden go here\n * options: [\n * // ...new options\n * ],\n * default: 500,\n * label: \"max walk dist\"\n * }\n * }\n * @returns A copy of the default queryParams that has the given customizations applied.\n * If no customizations parameter is provided, returns the queryParams object itself.\n */\nexport function getCustomQueryParams(customizations) {\n if (!customizations) return queryParams;\n\n const clonedParams = cloneDeep(queryParams);\n Object.keys(customizations).forEach(k => {\n // Merge fields into the cloned object\n const paramIndex = clonedParams.findIndex(param => param.name === k);\n if (paramIndex !== -1) {\n clonedParams[paramIndex] = {\n ...clonedParams[paramIndex],\n ...customizations[k]\n };\n }\n });\n return clonedParams;\n}\n"],"file":"query-params.js"}
1
+ {"version":3,"sources":["../src/query-params.js"],"names":["formatPlace","location","alternateName","name","lat","lon","storedSettings","queryParams","routingTypes","default","itineraryRewrite","value","fromPlace","profileRewrite","from","toPlace","to","getCurrentDate","getCurrentTime","arriveBy","accessModes","directModes","transitModes","length","split","forEach","m","push","applicable","query","otp2","mode","indexOf","selector","label","options","text","maxWalkDistance","maxBikeDistance","opts","splice","optimize","low","high","step","labelLow","labelHigh","maxEScooterDistance","watts","maximumMicromobilitySpeed","weight","TYPICAL_RIDER_WEIGHT","icon","config","modes","configModes","concat","some","configMode","find","showWheelchairSetting","company","companies","includes","places","Array","isArray","intermediatePlaces","map","place","undefined","param","userDefaultOverride","getCustomQueryParams","customizations","clonedParams","Object","keys","k","paramIndex","findIndex"],"mappings":";;;;;;;;;;;AAIA;;AACA;;AACA;;AAEA;;AAQA;;AACA;;AAjBA;AACA;AAEA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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A,SAAOH,YAAP;AACD","sourcesContent":["// TODO: Remove this entire file, as it is deprecated in favor of i18n-queryParams within\n// the SettingsSelector package\n\n// This is only used within stories\nimport cloneDeep from \"lodash.clonedeep\";\nimport React from \"react\";\nimport { Wheelchair } from \"@styled-icons/foundation/Wheelchair\";\n\nimport {\n isTransit,\n isAccessMode,\n isCar,\n hasTransit,\n hasBike,\n hasMicromobility\n} from \"./itinerary\";\nimport { getItem } from \"./storage\";\nimport { getCurrentDate, getCurrentTime } from \"./time\";\n\n/**\n * name: the default name of the parameter used for internal reference and API calls\n *\n * routingTypes: array of routing type(s) (ITINERARY, PROFILE, or both) this param applies to\n *\n * applicable: an optional function (accepting the current full query as a\n * parameter) indicating whether this query parameter is applicable to the query.\n * (Applicability is assumed if this function is not provided.)\n *\n * default: the default value for this parameter. The default can be also be a\n * function that gets executed when accessing the default value.\n *\n * itineraryRewrite: an optional function for translating the key and/or value\n * for ITINERARY mode only (e.g. 'to' is rewritten as 'toPlace'). Accepts the\n * initial internal value as a function parameter.\n *\n * profileRewrite: an optional function for translating the value for PROFILE mode\n *\n * label: a text label for for onscreen display. May either be a text string or a\n * function (accepting the current full query as a parameter) returning a string\n *\n * selector: the default type of UI selector to use in the form. Can be one of:\n * - DROPDOWN: a standard drop-down menu selector\n *\n * options: an array of text/value pairs used with a dropdown selector\n *\n * TODO: validation system for rewrite functions and/or better user documentation\n * TODO: alphabetize below list\n */\n\n// FIXME: Use for parsing URL values?\n// const stringToLocation = string => {\n// const split = string.split(',')\n// return split.length === 2\n// ? {lat: split[0], lon: split[1]}\n// : {lat: null, lon: null}\n// }\n\n/**\n * Format location object as string for use in fromPlace or toPlace query param.\n */\nexport function formatPlace(location, alternateName) {\n if (!location) return null;\n const name =\n location.name ||\n `${alternateName ? `${alternateName} ` : \"\"}(${location.lat},${\n location.lon\n })`;\n // This string is not language-specific\n return `${name}::${location.lat},${location.lon}`;\n}\n\n// Load stored default query settings from local storage\nconst storedSettings = getItem(\"defaultQuery\", {});\n\nconst queryParams = [\n {\n /* from - the trip origin. stored internally as a location (lat/lon/name) object */\n name: \"from\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: null,\n itineraryRewrite: value => ({ fromPlace: formatPlace(value) }),\n profileRewrite: value => ({ from: { lat: value.lat, lon: value.lon } })\n // FIXME: Use for parsing URL values?\n // fromURL: stringToLocation\n },\n\n {\n /* to - the trip destination. stored internally as a location (lat/lon/name) object */\n name: \"to\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: null,\n itineraryRewrite: value => ({ toPlace: formatPlace(value) }),\n profileRewrite: value => ({ to: { lat: value.lat, lon: value.lon } })\n // FIXME: Use for parsing URL values?\n // fromURL: stringToLocation\n },\n\n {\n /* date - the date of travel, in MM-DD-YYYY format */\n name: \"date\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: getCurrentDate\n },\n\n {\n /* time - the arrival/departure time for an itinerary trip, in HH:mm format */\n name: \"time\",\n routingTypes: [\"ITINERARY\"],\n default: getCurrentTime\n },\n\n {\n /* departArrive - whether this is a depart-at, arrive-by, or leave-now trip */\n name: \"departArrive\",\n routingTypes: [\"ITINERARY\"],\n default: \"NOW\",\n itineraryRewrite: value => ({ arriveBy: value === \"ARRIVE\" })\n },\n\n {\n /* startTime - the start time for a profile trip, in HH:mm format */\n name: \"startTime\",\n routingTypes: [\"PROFILE\"],\n default: \"07:00\"\n },\n\n {\n /* endTime - the end time for a profile trip, in HH:mm format */\n name: \"endTime\",\n routingTypes: [\"PROFILE\"],\n default: \"09:00\"\n },\n\n {\n /* mode - the allowed modes for a trip, as a comma-separated list */\n name: \"mode\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: \"WALK,TRANSIT\", // TODO: make this dependent on routingType?\n profileRewrite: value => {\n const accessModes = [];\n const directModes = [];\n const transitModes = [];\n\n if (value && value.length > 0) {\n value.split(\",\").forEach(m => {\n if (isTransit(m)) transitModes.push(m);\n if (isAccessMode(m)) {\n accessModes.push(m);\n // TODO: make configurable whether direct-driving is considered\n if (!isCar(m)) directModes.push(m);\n }\n });\n }\n\n return { accessModes, directModes, transitModes };\n }\n },\n\n {\n /* showIntermediateStops - whether response should include intermediate stops for transit legs */\n name: \"showIntermediateStops\",\n routingTypes: [\"ITINERARY\"],\n default: true\n },\n\n {\n /* maxWalkDistance - the maximum distance in meters the user will walk to transit. */\n name: \"maxWalkDistance\",\n routingTypes: [\"ITINERARY\"],\n applicable: query =>\n /* Since this query variable isn't in this list, it's not included in the generated query\n * It does however allow us to determine if we should show the OTP1 max walk distance\n * dropdown or the OTP2 walk reluctance slider\n */\n !query.otp2 &&\n query.mode &&\n hasTransit(query.mode) &&\n query.mode.indexOf(\"WALK\") !== -1,\n default: 1207, // 3/4 mi.\n selector: \"DROPDOWN\",\n label: \"Maximum Walk\",\n options: [\n {\n text: \"1/10 mile\",\n value: 160.9\n },\n {\n text: \"1/4 mile\",\n value: 402.3\n },\n {\n text: \"1/2 mile\",\n value: 804.7\n },\n {\n text: \"3/4 mile\",\n value: 1207\n },\n {\n text: \"1 mile\",\n value: 1609\n },\n {\n text: \"2 miles\",\n value: 3219\n },\n {\n text: \"5 miles\",\n value: 8047\n }\n ]\n },\n\n {\n /* maxBikeDistance - the maximum distance in meters the user will bike. Not\n * actually an OTP parameter (maxWalkDistance doubles for biking) but we\n * store it separately internally in order to allow different default values,\n * options, etc. Translated to 'maxWalkDistance' via the rewrite function.\n */\n name: \"maxBikeDistance\",\n routingTypes: [\"ITINERARY\"],\n applicable: query =>\n query.mode &&\n hasTransit(query.mode) &&\n query.mode.indexOf(\"BICYCLE\") !== -1,\n default: 4828, // 3 mi.\n selector: \"DROPDOWN\",\n label: \"Maximum Bike\",\n options: [\n {\n text: \"1/4 mile\",\n value: 402.3\n },\n {\n text: \"1/2 mile\",\n value: 804.7\n },\n {\n text: \"3/4 mile\",\n value: 1207\n },\n {\n text: \"1 mile\",\n value: 1609\n },\n {\n text: \"2 miles\",\n value: 3219\n },\n {\n text: \"3 miles\",\n value: 4828\n },\n {\n text: \"5 miles\",\n value: 8047\n },\n {\n text: \"10 miles\",\n value: 16093\n },\n {\n text: \"20 miles\",\n value: 32187\n },\n {\n text: \"30 miles\",\n value: 48280\n }\n ],\n itineraryRewrite: value => ({\n maxWalkDistance: value,\n // ensures that the value is repopulated when loaded from URL params\n maxBikeDistance: value\n })\n },\n\n {\n /* optimize -- how to optimize a trip (non-bike, non-micromobility trips) */\n name: \"optimize\",\n applicable: query =>\n !query.otp2 && hasTransit(query.mode) && !hasBike(query.mode),\n routingTypes: [\"ITINERARY\"],\n default: \"QUICK\",\n selector: \"DROPDOWN\",\n label: \"Optimize for\",\n options: [\n {\n text: \"Speed\",\n value: \"QUICK\"\n },\n {\n text: \"Fewest Transfers\",\n value: \"TRANSFERS\"\n }\n ]\n },\n\n {\n /* optimizeBike -- how to optimize an bike-based trip */\n name: \"optimizeBike\",\n applicable: query => !query.otp2 && hasBike(query.mode),\n routingTypes: [\"ITINERARY\"],\n default: \"SAFE\",\n selector: \"DROPDOWN\",\n label: \"Optimize for\",\n options: query => {\n const opts = [\n {\n text: \"Speed\",\n value: \"QUICK\"\n },\n {\n text: \"Bike-Friendly Trip\",\n value: \"SAFE\"\n },\n {\n text: \"Flat Trip\",\n value: \"FLAT\"\n }\n ];\n\n // Include transit-specific option, if applicable\n if (hasTransit(query.mode)) {\n opts.splice(1, 0, {\n text: \"Fewest Transfers\",\n value: \"TRANSFERS\"\n });\n }\n\n return opts;\n },\n itineraryRewrite: value => ({ optimize: value })\n },\n\n {\n /* maxWalkTime -- the maximum time the user will spend walking in minutes */\n name: \"maxWalkTime\",\n routingTypes: [\"PROFILE\"],\n default: 15,\n selector: \"DROPDOWN\",\n label: \"Max Walk Time\",\n applicable: query =>\n query.mode && hasTransit(query.mode) && query.mode.indexOf(\"WALK\") !== -1,\n options: [\n {\n text: \"5 minutes\",\n value: 5\n },\n {\n text: \"10 minutes\",\n value: 10\n },\n {\n text: \"15 minutes\",\n value: 15\n },\n {\n text: \"20 minutes\",\n value: 20\n },\n {\n text: \"30 minutes\",\n value: 30\n },\n {\n text: \"45 minutes\",\n value: 45\n },\n {\n text: \"1 hour\",\n value: 60\n }\n ]\n },\n\n {\n /* walkSpeed -- the user's walking speed in m/s */\n name: \"walkSpeed\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: 1.34,\n selector: \"DROPDOWN\",\n label: \"Walk Speed\",\n applicable: query => query.mode && query.mode.indexOf(\"WALK\") !== -1,\n options: [\n {\n text: \"2 MPH\",\n value: 0.89\n },\n {\n text: \"3 MPH\",\n value: 1.34\n },\n {\n text: \"4 MPH\",\n value: 1.79\n }\n ]\n },\n\n {\n name: \"walkReluctance\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n selector: \"SLIDER\",\n low: 0.5,\n high: 20,\n step: 0.5,\n label: \"walk reluctance\",\n labelLow: \"More Walking\",\n labelHigh: \"More Transit\",\n applicable: query =>\n /* Since this query variable isn't in this list, it's not included in the generated query\n * It does however allow us to determine if we should show the OTP1 max walk distance\n * dropdown or the OTP2 walk reluctance slider\n */\n !!query.otp2 && query.mode && query.mode.indexOf(\"WALK\") !== -1\n },\n {\n /* maxBikeTime -- the maximum time the user will spend biking in minutes */\n name: \"maxBikeTime\",\n routingTypes: [\"PROFILE\"],\n default: 20,\n selector: \"DROPDOWN\",\n label: \"Max Bike Time\",\n applicable: query =>\n query.mode &&\n hasTransit(query.mode) &&\n query.mode.indexOf(\"BICYCLE\") !== -1,\n options: [\n {\n text: \"5 minutes\",\n value: 5\n },\n {\n text: \"10 minutes\",\n value: 10\n },\n {\n text: \"15 minutes\",\n value: 15\n },\n {\n text: \"20 minutes\",\n value: 20\n },\n {\n text: \"30 minutes\",\n value: 30\n },\n {\n text: \"45 minutes\",\n value: 45\n },\n {\n text: \"1 hour\",\n value: 60\n }\n ]\n },\n\n {\n /* bikeSpeed -- the user's bikeSpeed speed in m/s */\n name: \"bikeSpeed\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: 3.58,\n selector: \"DROPDOWN\",\n label: \"Bicycle Speed\",\n applicable: query => query.mode && query.mode.indexOf(\"BICYCLE\") !== -1,\n options: [\n {\n text: \"6 MPH\",\n value: 2.68\n },\n {\n text: \"8 MPH\",\n value: 3.58\n },\n {\n text: \"10 MPH\",\n value: 4.47\n },\n {\n text: \"12 MPH\",\n value: 5.36\n }\n ]\n },\n\n {\n /* maxEScooterDistance - the maximum distance in meters the user will ride\n * an E-scooter. Not actually an OTP parameter (maxWalkDistance doubles for\n * any non-transit mode except for car) but we store it separately\n * internally in order to allow different default values, options, etc.\n * Translated to 'maxWalkDistance' via the rewrite function.\n */\n name: \"maxEScooterDistance\",\n routingTypes: [\"ITINERARY\"],\n applicable: query =>\n query.mode && hasTransit(query.mode) && hasMicromobility(query.mode),\n default: 4828, // 3 mi.\n selector: \"DROPDOWN\",\n label: \"Maximum E-scooter Distance\",\n options: [\n {\n text: \"1/4 mile\",\n value: 402.3\n },\n {\n text: \"1/2 mile\",\n value: 804.7\n },\n {\n text: \"3/4 mile\",\n value: 1207\n },\n {\n text: \"1 mile\",\n value: 1609\n },\n {\n text: \"2 miles\",\n value: 3219\n },\n {\n text: \"3 miles\",\n value: 4828\n },\n {\n text: \"5 miles\",\n value: 8047\n },\n {\n text: \"10 miles\",\n value: 16093\n },\n {\n text: \"20 miles\",\n value: 32187\n },\n {\n text: \"30 miles\",\n value: 48280\n }\n ],\n itineraryRewrite: value => ({\n maxWalkDistance: value,\n // ensures that the value is repopulated when loaded from URL params\n maxEScooterDistance: value\n })\n },\n\n {\n /* bikeSpeed -- the user's bikeSpeed speed in m/s */\n name: \"watts\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: 250,\n selector: \"DROPDOWN\",\n label: \"E-scooter Power\",\n // this configuration should only be allowed for personal E-scooters as these\n // settings will be defined by the vehicle type of an E-scooter being rented\n applicable: query =>\n query.mode &&\n query.mode.indexOf(\"MICROMOBILITY\") !== -1 &&\n query.mode.indexOf(\"MICROMOBILITY_RENT\") === -1,\n options: [\n {\n text: \"Kid's hoverboard (6mph)\",\n value: 125\n },\n {\n text: \"Entry-level scooter (11mph)\",\n value: 250\n },\n {\n text: \"Robust E-scooter (18mph)\",\n value: 500\n },\n {\n text: \"Powerful E-scooter (24mph)\",\n value: 1500\n }\n ],\n // rewrite a few other values to add some baseline assumptions about the\n // vehicle\n itineraryRewrite: value => {\n const watts = value;\n // the maximum cruising and downhill speed. Units in m/s\n let maximumMicromobilitySpeed;\n let weight;\n // see https://en.wikipedia.org/wiki/Human_body_weight#Average_weight_around_the_world\n // estimate is for an average North American human with clothes and stuff\n // units are in kg\n const TYPICAL_RIDER_WEIGHT = 90;\n switch (watts) {\n case 125:\n // exemplar: Swagtron Turbo 5 hoverboard (https://swagtron.com/product/recertified-swagtron-turbo-five-hoverboard-classic/)\n maximumMicromobilitySpeed = 2.8; // ~= 6mph\n weight = TYPICAL_RIDER_WEIGHT + 9;\n break;\n case 250:\n // exemplar: Xiaomi M365 (https://www.gearbest.com/skateboard/pp_596618.html)\n maximumMicromobilitySpeed = 5; // ~= 11.5mph\n weight = TYPICAL_RIDER_WEIGHT + 12.5;\n break;\n case 500:\n // exemplar: Razor EcoSmart Metro (https://www.amazon.com/Razor-EcoSmart-Metro-Electric-Scooter/dp/B002ZDAEIS?SubscriptionId=AKIAJMXJ2YFJTEDLQMUQ&tag=digitren08-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B002ZDAEIS&ascsubtag=15599460143449ocb)\n maximumMicromobilitySpeed = 8; // ~= 18mph\n weight = TYPICAL_RIDER_WEIGHT + 30;\n break;\n case 1000:\n // exemplar: Boosted Rev (https://boostedboards.com/vehicles/scooters/boosted-rev)\n maximumMicromobilitySpeed = 11; // ~= 24mph\n weight = TYPICAL_RIDER_WEIGHT + 21;\n break;\n default:\n break;\n }\n return { maximumMicromobilitySpeed, watts, weight };\n }\n },\n\n {\n /* ignoreRealtimeUpdates -- if true, do not use realtime updates in routing */\n name: \"ignoreRealtimeUpdates\",\n routingTypes: [\"ITINERARY\"],\n default: false\n },\n\n {\n /* companies -- tnc companies to query */\n name: \"companies\",\n routingTypes: [\"ITINERARY\"]\n },\n\n {\n /* wheelchair -- whether the user requires a wheelchair-accessible trip */\n name: \"wheelchair\",\n routingTypes: [\"ITINERARY\", \"PROFILE\"],\n default: false,\n selector: \"CHECKBOX\",\n label: \"Prefer Wheelchair Accessible Routes\",\n icon: <Wheelchair />,\n applicable: (query, config) => {\n if (!query.mode || !config.modes) return false;\n const configModes = (config.modes.accessModes || []).concat(\n config.modes.transitModes || []\n );\n return query.mode.split(\",\").some(mode => {\n const configMode = configModes.find(m => m.mode === mode);\n if (!configMode || !configMode.showWheelchairSetting) return false;\n if (\n configMode.company &&\n (!query.companies ||\n !query.companies.split(\",\").includes(configMode.company))\n )\n return false;\n return true;\n });\n }\n },\n\n {\n name: \"bannedRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"numItineraries\",\n routingTypes: [\"ITINERARY\"],\n default: 3\n },\n {\n name: \"intermediatePlaces\",\n default: [],\n routingTypes: [\"ITINERARY\"],\n itineraryRewrite: places =>\n Array.isArray(places) && places.length > 0\n ? {\n intermediatePlaces: places.map(place => formatPlace(place))\n }\n : undefined\n },\n {\n // Time penalty in seconds the requester is willing to accept in order to\n // complete journey on preferred route. I.e., number of seconds that we are\n // willing to wait for the preferred route.\n name: \"otherThanPreferredRoutesPenalty\",\n default: 15 * 60, // 15 minutes\n routingTypes: [\"ITINERARY\"]\n },\n // Below are less commonly used query params included so that in case they are\n // passed in a query parameter they do not get filtered out from the ultimate\n // API request.\n {\n name: \"preferredRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"maxPreTransitTime\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"waitReluctance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"driveDistanceReluctance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"driveTimeReluctance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"waitAtBeginningFactor\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bikeSwitchTime\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bikeSwitchCost\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"minTransferTime\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"preferredAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"unpreferredRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"unpreferredAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"walkBoardCost\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bikeBoardCost\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"whiteListedRoutes\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"whiteListedAgencies\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedTrips\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedStops\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"bannedStopsHard\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"transferPenalty\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"nonpreferredTransferPenalty\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"maxTransfers\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"batch\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"startTransitStopId\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"startTransitTripId\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"clampInitialWait\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"reverseOptimizeOnTheFly\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"boardSlack\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"alightSlack\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"locale\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"disableRemainingWeightHeuristic\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexFlagStopBufferSize\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexUseReservationServices\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexUseEligibilityServices\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"flexIgnoreDrtAdvanceBookMin\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"maxHours\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"useRequestedDateTimeInMaxHours\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"disableAlertFiltering\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"geoidElevation\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"invalidDateStrategy\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"minTransitDistance\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"searchTimeout\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"pathComparator\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"onlyTransitTrips\",\n routingTypes: [\"ITINERARY\"]\n },\n {\n name: \"minimumMicromobilitySpeed\",\n routingTypes: [\"ITINERARY\"]\n }\n];\n// Iterate over stored settings and update query param defaults.\n// FIXME: this does not get updated if the user defaults are cleared\nqueryParams.forEach(param => {\n if (param.name in storedSettings) {\n param.default = storedSettings[param.name];\n param.userDefaultOverride = true;\n }\n});\n\nexport default queryParams;\n\n/**\n * You can customize the queryParams labels and options, and labels and values for each option.\n * @param customizations The optional customizations to apply: an object whose fields\n * correspond to the items in queryParams with the corresponding name,\n * the value for those fields being an object which fields (label, options...)\n * will override the originals.\n * Example:\n * {\n * // Matches the name param\n * maxWalkDistance: {\n * // Any fields that should be overridden go here\n * options: [\n * // ...new options\n * ],\n * default: 500,\n * label: \"max walk dist\"\n * }\n * }\n * @returns A copy of the default queryParams that has the given customizations applied.\n * If no customizations parameter is provided, returns the queryParams object itself.\n */\nexport function getCustomQueryParams(customizations) {\n if (!customizations) return queryParams;\n\n const clonedParams = cloneDeep(queryParams);\n Object.keys(customizations).forEach(k => {\n // Merge fields into the cloned object\n const paramIndex = clonedParams.findIndex(param => param.name === k);\n if (paramIndex !== -1) {\n clonedParams[paramIndex] = {\n ...clonedParams[paramIndex],\n ...customizations[k]\n };\n }\n });\n return clonedParams;\n}\n"],"file":"query-params.js"}
package/lib/time.js CHANGED
@@ -127,9 +127,9 @@ function formatDuration(seconds) {
127
127
  }
128
128
  /**
129
129
  * Formats an elapsed time in seconds, minutes, hours duration for display in narrative
130
- * TODO: internationalization
131
130
  * @param {number} seconds duration in seconds
132
- * @returns {string} formatted text representation
131
+ * @param {object} region an object that allows internationalization of the time
132
+ * @returns {string} formatted text representation
133
133
  */
134
134
 
135
135
 
package/lib/time.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/time.js"],"names":["OTP_API_DATE_FORMAT","OTP_API_DATE_FORMAT_DATE_FNS","OTP_API_TIME_FORMAT","formatDurationLikeMoment","seconds","showSeconds","localize","enabled","code","hours","Math","floor","minutes","secondsLeftOver","specLookup","xHours","xMinutes","xSeconds","locale","formatDistance","spec","val","undefined","format","toHoursMinutesSeconds","getTimeFormat","config","dateTime","timeFormat","getDateFormat","dateFormat","getLongDateFormat","longDateFormat","formatDuration","formatDurationWithSeconds","region","offsetTime","ms","options","offset","formatTime","formatSecondsAfterMidnight","time","Date","getUserTimezone","fallbackTimezone","process","env","NODE_ENV","TZ","Intl","DateTimeFormat","resolvedOptions","timeZone","getCurrentTime","timezone","now","getCurrentDate"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AAMA;;AAEA;AACA;AACO,MAAMA,mBAAmB,GAAG,YAA5B,C,CACP;AACA;;;AACO,MAAMC,4BA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QAA3B,CAAP,EAA6CrD,mBAA7C,CAAP;AACD;AAED;AACA;AACA;AACA;;;AACO,SAASuD,cAAT,CAAwBF,QAAQ,GAAGX,eAAe,EAAlD,EAAsD;AAC3D,SAAO,qBACL,+BAAeD,IAAI,CAACa,GAAL,EAAf,EAA2BD,QAA3B,CADK,EAELtD,4BAFK,CAAP;AAID","sourcesContent":["import {\n startOfDay,\n add,\n format,\n formatDuration as dateFnsFormatDuration\n} from \"date-fns\";\nimport { utcToZonedTime } from \"date-fns-tz\";\n\n// special constants for making sure the following date format is always sent to\n// OTP regardless of whatever the user has configured as the display format\nexport const OTP_API_DATE_FORMAT = \"YYYY-MM-DD\";\n// Date-Fns uses a different string format than moment.js\n// see https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\nexport const OTP_API_DATE_FORMAT_DATE_FNS = \"yyyy-MM-dd\";\nexport const OTP_API_TIME_FORMAT = \"HH:mm\";\n\n/**\n * To ease the transition away from moment.js, this method uses date-fns to format durations\n * the way moment.js did.\n * @param {number} seconds The number of seconds to format\n * @param {boolean} showSeconds Whether to render seconds or not\n * @param {boolean} localize If true, will create output like moment.js using date-fns locale.\n * Otherwise, uses date-fns default\n * @returns Formatted duration\n */\nfunction formatDurationLikeMoment(\n seconds,\n showSeconds,\n localize = { enabled: true, code: \"en-US\" }\n) {\n // date-fns doesn't do this automatically\n if ((!showSeconds && seconds < 60) || seconds === 0) {\n return \"0 min\";\n }\n\n const hours = Math.floor(seconds / 3600);\n const minutes = Math.floor((seconds - hours * 3600) / 60);\n const secondsLeftOver = showSeconds\n ? seconds - hours * 3600 - minutes * 60\n : 0;\n const specLookup = {\n xHours: \"hr\",\n xMinutes: \"min\",\n xSeconds: \"sec\"\n };\n const locale = localize\n ? {\n // Maintain backwards compatibility when called with localize=true\n code: localize?.code || \"en-US\",\n formatDistance: (spec, val) => {\n return `${val} ${specLookup[spec]}`;\n }\n }\n : undefined;\n\n return dateFnsFormatDuration(\n {\n hours,\n minutes,\n seconds: secondsLeftOver\n },\n {\n format: [\"hours\", \"minutes\", \"seconds\"],\n locale\n }\n );\n}\n\n/**\n * Breaks up a duration in seconds into hours, minutes, and seconds.\n * @param {number} seconds The number of seconds to break up\n * @returns an object with fields with the corresponding, hours, minutes, seconds.\n */\nexport function toHoursMinutesSeconds(seconds) {\n const hours = Math.floor(seconds / 3600);\n const minutes = Math.floor((seconds - hours * 3600) / 60);\n return {\n hours,\n minutes,\n seconds: seconds - hours * 3600 - minutes * 60\n };\n}\n\n/**\n * @param {[type]} config the OTP config object found in store\n * @return {string} the config-defined time formatter or HH:mm (24-hr time)\n */\nexport function getTimeFormat(config) {\n return config?.dateTime?.timeFormat || OTP_API_TIME_FORMAT;\n}\n\nexport function getDateFormat(config) {\n return config?.dateTime?.dateFormat || OTP_API_DATE_FORMAT;\n}\n\nexport function getLongDateFormat(config) {\n return config?.dateTime?.longDateFormat || \"D MMMM YYYY\";\n}\n\n/**\n * Formats an elapsed time duration for display in narrative.\n * TODO: internationalization\n * @param {number} seconds duration in seconds\n * @returns {string} formatted text representation\n */\nexport function formatDuration(seconds) {\n return formatDurationLikeMoment(seconds, false);\n}\n\n/**\n * Formats an elapsed time in seconds, minutes, hours duration for display in narrative\n * TODO: internationalization\n * @param {number} seconds duration in seconds\n * @returns {string} formatted text representation\n */\nexport function formatDurationWithSeconds(seconds, region) {\n return formatDurationLikeMoment(seconds, { enabled: true, code: region });\n}\n\n/**\n * Offsets a time according to the provided time options\n * and returns the result.\n */\nexport function offsetTime(ms, options) {\n return ms + (options?.offset || 0);\n}\n\n/**\n * Formats a time value for display in narrative\n * TODO: internationalization/timezone\n * @param {number} ms epoch time value in milliseconds\n * @returns {string} formatted text representation\n */\nexport function formatTime(ms, options) {\n return format(\n offsetTime(ms, options),\n options?.format || OTP_API_TIME_FORMAT\n );\n}\n\n/**\n * Formats a seconds after midnight value for display in narrative\n * @param {number} seconds time since midnight in seconds\n * @param {string} timeFormat A valid date-fns time format\n * @return {string} formatted text representation\n */\nexport function formatSecondsAfterMidnight(seconds, timeFormat) {\n const time = add(startOfDay(new Date()), { seconds });\n return format(time, timeFormat);\n}\n\n/**\n * Uses Intl.DateTimeFormat() api to get the user's time zone. In a test\n * environment, pulls timezone information from an env variable. Default to\n * GMT+0 if the Intl API is unavailable.\n */\nexport function getUserTimezone(fallbackTimezone = \"Etc/Greenwich\") {\n if (process.env.NODE_ENV === \"test\") return process.env.TZ;\n return Intl?.DateTimeFormat().resolvedOptions().timeZone || fallbackTimezone;\n}\n\n/**\n * Formats current time for use in OTP query\n * The conversion to the user's timezone is needed for testing purposes.\n */\nexport function getCurrentTime(timezone = getUserTimezone()) {\n return format(utcToZonedTime(Date.now(), timezone), OTP_API_TIME_FORMAT);\n}\n\n/**\n * Formats current date for use in OTP query\n * The conversion to the user's timezone is needed for testing purposes.\n */\nexport function getCurrentDate(timezone = getUserTimezone()) {\n return format(\n utcToZonedTime(Date.now(), timezone),\n OTP_API_DATE_FORMAT_DATE_FNS\n );\n}\n"],"file":"time.js"}
1
+ {"version":3,"sources":["../src/time.js"],"names":["OTP_API_DATE_FORMAT","OTP_API_DATE_FORMAT_DATE_FNS","OTP_API_TIME_FORMAT","formatDurationLikeMoment","seconds","showSeconds","localize","enabled","code","hours","Math","floor","minutes","secondsLeftOver","specLookup","xHours","xMinutes","xSeconds","locale","formatDistance","spec","val","undefined","format","toHoursMinutesSeconds","getTimeFormat","config","dateTime","timeFormat","getDateFormat","dateFormat","getLongDateFormat","longDateFormat","formatDuration","formatDurationWithSeconds","region","offsetTime","ms","options","offset","formatTime","formatSecondsAfterMidnight","time","Date","getUserTimezone","fallbackTimezone","process","env","NODE_ENV","TZ","Intl","DateTimeFormat","resolvedOptions","timeZone","getCurrentTime","timezone","now","getCurrentDate"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AAMA;;AAEA;AACA;AACO,MAAMA,mBAAmB,GAAG,YAA5B,C,CACP;AACA;;;AACO,MAAMC,4BAA4B,GAAG,YAArC;;AACA,MAAMC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C,CAAP;AACD;AAED;AACA;AACA;AACA;;;AACO,SAASuD,cAAT,CAAwBF,QAAQ,GAAGX,eAAe,EAAlD,EAAsD;AAC3D,SAAO,qBACL,+BAAeD,IAAI,CAACa,GAAL,EAAf,EAA2BD,QAA3B,CADK,EAELtD,4BAFK,CAAP;AAID","sourcesContent":["import {\n startOfDay,\n add,\n format,\n formatDuration as dateFnsFormatDuration\n} from \"date-fns\";\nimport { utcToZonedTime } from \"date-fns-tz\";\n\n// special constants for making sure the following date format is always sent to\n// OTP regardless of whatever the user has configured as the display format\nexport const OTP_API_DATE_FORMAT = \"YYYY-MM-DD\";\n// Date-Fns uses a different string format than moment.js\n// see https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\nexport const OTP_API_DATE_FORMAT_DATE_FNS = \"yyyy-MM-dd\";\nexport const OTP_API_TIME_FORMAT = \"HH:mm\";\n\n/**\n * To ease the transition away from moment.js, this method uses date-fns to format durations\n * the way moment.js did.\n * @param {number} seconds The number of seconds to format\n * @param {boolean} showSeconds Whether to render seconds or not\n * @param {boolean} localize If true, will create output like moment.js using date-fns locale.\n * Otherwise, uses date-fns default\n * @returns Formatted duration\n */\nfunction formatDurationLikeMoment(\n seconds,\n showSeconds,\n localize = { enabled: true, code: \"en-US\" }\n) {\n // date-fns doesn't do this automatically\n if ((!showSeconds && seconds < 60) || seconds === 0) {\n return \"0 min\";\n }\n\n const hours = Math.floor(seconds / 3600);\n const minutes = Math.floor((seconds - hours * 3600) / 60);\n const secondsLeftOver = showSeconds\n ? seconds - hours * 3600 - minutes * 60\n : 0;\n const specLookup = {\n xHours: \"hr\",\n xMinutes: \"min\",\n xSeconds: \"sec\"\n };\n const locale = localize\n ? {\n // Maintain backwards compatibility when called with localize=true\n code: localize?.code || \"en-US\",\n formatDistance: (spec, val) => {\n return `${val} ${specLookup[spec]}`;\n }\n }\n : undefined;\n\n return dateFnsFormatDuration(\n {\n hours,\n minutes,\n seconds: secondsLeftOver\n },\n {\n format: [\"hours\", \"minutes\", \"seconds\"],\n locale\n }\n );\n}\n\n/**\n * Breaks up a duration in seconds into hours, minutes, and seconds.\n * @param {number} seconds The number of seconds to break up\n * @returns an object with fields with the corresponding, hours, minutes, seconds.\n */\nexport function toHoursMinutesSeconds(seconds) {\n const hours = Math.floor(seconds / 3600);\n const minutes = Math.floor((seconds - hours * 3600) / 60);\n return {\n hours,\n minutes,\n seconds: seconds - hours * 3600 - minutes * 60\n };\n}\n\n/**\n * @param {[type]} config the OTP config object found in store\n * @return {string} the config-defined time formatter or HH:mm (24-hr time)\n */\nexport function getTimeFormat(config) {\n return config?.dateTime?.timeFormat || OTP_API_TIME_FORMAT;\n}\n\nexport function getDateFormat(config) {\n return config?.dateTime?.dateFormat || OTP_API_DATE_FORMAT;\n}\n\nexport function getLongDateFormat(config) {\n return config?.dateTime?.longDateFormat || \"D MMMM YYYY\";\n}\n\n/**\n * Formats an elapsed time duration for display in narrative.\n * TODO: internationalization\n * @param {number} seconds duration in seconds\n * @returns {string} formatted text representation\n */\nexport function formatDuration(seconds) {\n return formatDurationLikeMoment(seconds, false);\n}\n\n/**\n * Formats an elapsed time in seconds, minutes, hours duration for display in narrative\n * @param {number} seconds duration in seconds\n * @param {object} region an object that allows internationalization of the time\n * @returns {string} formatted text representation\n */\nexport function formatDurationWithSeconds(seconds, region) {\n return formatDurationLikeMoment(seconds, { enabled: true, code: region });\n}\n\n/**\n * Offsets a time according to the provided time options\n * and returns the result.\n */\nexport function offsetTime(ms, options) {\n return ms + (options?.offset || 0);\n}\n\n/**\n * Formats a time value for display in narrative\n * TODO: internationalization/timezone\n * @param {number} ms epoch time value in milliseconds\n * @returns {string} formatted text representation\n */\nexport function formatTime(ms, options) {\n return format(\n offsetTime(ms, options),\n options?.format || OTP_API_TIME_FORMAT\n );\n}\n\n/**\n * Formats a seconds after midnight value for display in narrative\n * @param {number} seconds time since midnight in seconds\n * @param {string} timeFormat A valid date-fns time format\n * @return {string} formatted text representation\n */\nexport function formatSecondsAfterMidnight(seconds, timeFormat) {\n const time = add(startOfDay(new Date()), { seconds });\n return format(time, timeFormat);\n}\n\n/**\n * Uses Intl.DateTimeFormat() api to get the user's time zone. In a test\n * environment, pulls timezone information from an env variable. Default to\n * GMT+0 if the Intl API is unavailable.\n */\nexport function getUserTimezone(fallbackTimezone = \"Etc/Greenwich\") {\n if (process.env.NODE_ENV === \"test\") return process.env.TZ;\n return Intl?.DateTimeFormat().resolvedOptions().timeZone || fallbackTimezone;\n}\n\n/**\n * Formats current time for use in OTP query\n * The conversion to the user's timezone is needed for testing purposes.\n */\nexport function getCurrentTime(timezone = getUserTimezone()) {\n return format(utcToZonedTime(Date.now(), timezone), OTP_API_TIME_FORMAT);\n}\n\n/**\n * Formats current date for use in OTP query\n * The conversion to the user's timezone is needed for testing purposes.\n */\nexport function getCurrentDate(timezone = getUserTimezone()) {\n return format(\n utcToZonedTime(Date.now(), timezone),\n OTP_API_DATE_FORMAT_DATE_FNS\n );\n}\n"],"file":"time.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentripplanner/core-utils",
3
- "version": "4.11.0",
3
+ "version": "4.11.1",
4
4
  "description": "Core functionality that is shared among numerous UI components",
5
5
  "engines": {
6
6
  "node": ">=13"
@@ -249,6 +249,8 @@ Array [
249
249
  "applicable": [Function],
250
250
  "high": 20,
251
251
  "label": "walk reluctance",
252
+ "labelHigh": "More Transit",
253
+ "labelLow": "More Walking",
252
254
  "low": 0.5,
253
255
  "name": "walkReluctance",
254
256
  "routingTypes": Array [
package/src/deprecated.js CHANGED
@@ -1,7 +1,14 @@
1
1
  import moment from "moment";
2
2
 
3
- // Need to avoid cyclic dependency resolution
3
+ /**
4
+ * To disable cyclic dependency resolution we need to require() within methods
5
+ * This is a good reason to disable this eslint-rule
6
+ */
4
7
  /* eslint-disable global-require */
8
+
9
+ /**
10
+ * Generates a warning to tell developer that they are using deprecated methods!
11
+ */
5
12
  export function logDeprecationWarning(method, alternative) {
6
13
  console.warn(
7
14
  `${method ||
package/src/profile.js CHANGED
@@ -28,7 +28,7 @@ export function filterProfileOptions(response) {
28
28
  }
29
29
 
30
30
  function locationString(str) {
31
- return str ? str.split(",")[0] : null;
31
+ return str?.split(",")[0];
32
32
  }
33
33
 
34
34
  function accessToLeg(access, origin, destination) {
@@ -278,7 +278,8 @@ const queryParams = [
278
278
  {
279
279
  /* optimize -- how to optimize a trip (non-bike, non-micromobility trips) */
280
280
  name: "optimize",
281
- applicable: query => hasTransit(query.mode) && !hasBike(query.mode),
281
+ applicable: query =>
282
+ !query.otp2 && hasTransit(query.mode) && !hasBike(query.mode),
282
283
  routingTypes: ["ITINERARY"],
283
284
  default: "QUICK",
284
285
  selector: "DROPDOWN",
@@ -298,7 +299,7 @@ const queryParams = [
298
299
  {
299
300
  /* optimizeBike -- how to optimize an bike-based trip */
300
301
  name: "optimizeBike",
301
- applicable: query => hasBike(query.mode),
302
+ applicable: query => !query.otp2 && hasBike(query.mode),
302
303
  routingTypes: ["ITINERARY"],
303
304
  default: "SAFE",
304
305
  selector: "DROPDOWN",
@@ -405,6 +406,8 @@ const queryParams = [
405
406
  high: 20,
406
407
  step: 0.5,
407
408
  label: "walk reluctance",
409
+ labelLow: "More Walking",
410
+ labelHigh: "More Transit",
408
411
  applicable: query =>
409
412
  /* Since this query variable isn't in this list, it's not included in the generated query
410
413
  * It does however allow us to determine if we should show the OTP1 max walk distance
package/src/time.js CHANGED
@@ -109,9 +109,9 @@ export function formatDuration(seconds) {
109
109
 
110
110
  /**
111
111
  * Formats an elapsed time in seconds, minutes, hours duration for display in narrative
112
- * TODO: internationalization
113
112
  * @param {number} seconds duration in seconds
114
- * @returns {string} formatted text representation
113
+ * @param {object} region an object that allows internationalization of the time
114
+ * @returns {string} formatted text representation
115
115
  */
116
116
  export function formatDurationWithSeconds(seconds, region) {
117
117
  return formatDurationLikeMoment(seconds, { enabled: true, code: region });