Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support middleware CDP changes #478

Merged
merged 6 commits into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions __tests__/actions/__snapshots__/api.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Array [
"error": [TypeError: Cannot read property 'trackRecent' of undefined],
"requestId": "abcd1239",
"searchId": "abcd1234",
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false",
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false&batchId=abcd1234",
},
"type": "ROUTING_ERROR",
},
Expand Down Expand Up @@ -67,7 +67,7 @@ Array [
"error": [Error: Received error from server],
"requestId": "abcd1240",
"searchId": "abcd1237",
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false",
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false&batchId=abcd1237",
},
"type": "ROUTING_ERROR",
},
Expand Down Expand Up @@ -113,12 +113,12 @@ Array [
"error": [TypeError: Cannot read property 'trackRecent' of undefined],
"requestId": "abcd1236",
"searchId": "abcd1234",
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false",
"url": "http://mock-host.com:80/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false&batchId=abcd1234",
},
"type": "ROUTING_ERROR",
},
],
]
`;

exports[`actions > api routingQuery should make a query to OTP: OTP Query Path 1`] = `"/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false"`;
exports[`actions > api routingQuery should make a query to OTP: OTP Query Path 1`] = `"/api/plan?fromPlace=Origin%20%2812%2C34%29%3A%3A12%2C34&toPlace=Destination%20%2834%2C12%29%3A%3A34%2C12&mode=WALK%2CTRANSIT&ignoreRealtimeUpdates=false&batchId=abcd1234"`;
7 changes: 4 additions & 3 deletions i18n/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ components:
stopsTo: "Towards"
selectADirection: "Select a direction..."
RouteRow:
operatorLogoAltText: '{operatorName} logo'
operatorLogoAltText: "{operatorName} logo"
RouteViewer:
agencyFilter: Agency Filter
allAgencies: All Agencies
Expand Down Expand Up @@ -295,6 +295,9 @@ components:
termsOfStorageStatement: >
Optional: I consent to the Trip Planner storing my historical planned trips in order to
improve transit services in my area. <termsOfStorageLink>More info...</termsOfStorageLink>
confirmDeletionPrompt: >
Removing your consent to storage of historical trips will cause your trip history to be deleted.
Are you sure you want to continue?
TransitVehicleOverlay:
# keys designed to match API output
incoming_at: "approaching {stop}"
Expand Down Expand Up @@ -404,7 +407,6 @@ components:
to verify your email address before finishing your account setup.
instructions2: Once you're verified, click the button below to continue.
resendVerification: Resend verification email


# Common messages that appear in multiple components and modules
# are grouped below by topic.
Expand Down Expand Up @@ -491,4 +493,3 @@ common:
other {{hours, number} hr {minutes, number} min}}
# If trip is less than one hour only display the minutes.
tripDurationFormatZeroHours: "{minutes, number} min"

3 changes: 3 additions & 0 deletions i18n/fr-FR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ components:
termsOfStorageStatement: >
Facultatif: Je consens à ce que le Planificateur de trajets sauvegarde mes recherches
afin d'améliorer les transports publics dans ma region. <termsOfStorageLink>Plus d'informations...</termsOfStorageLink>
confirmDeletionPrompt: >
En révoquant votre accord sur l'enregistrement de vos recherches de trajets, tout l'historique de vos de trajets sera supprimé.
Voulez-vous continuer ?
TransitVehicleOverlay:
# keys designed to match API output
incoming_at: "Approchant {stop}"
Expand Down
4 changes: 2 additions & 2 deletions lib/actions/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function routingQuery (searchId = null, updateSearchInReducer = false) {
return Promise.all(iterations.map((injectedParams, i) => {
const requestId = randId()
// fetch a realtime route
const url = constructRoutingQuery(state, false, injectedParams)
const url = constructRoutingQuery(state, false, { batchId: searchId, ...injectedParams })
const realTimeFetch = fetch(url, getOtpFetchOptions(state))
.then(getJsonAndCheckResponse)
.then(json => {
Expand Down Expand Up @@ -185,7 +185,7 @@ export function routingQuery (searchId = null, updateSearchInReducer = false) {
user.loggedInUser.storeTripHistory

const nonRealtimeFetch = fetch(
constructRoutingQuery(state, true),
constructRoutingQuery(state, true, { batchId: searchId, ...injectedParams }),
getOtpFetchOptions(state, storeTripHistory)
)
.then(getJsonAndCheckResponse)
Expand Down
15 changes: 13 additions & 2 deletions lib/components/user/terms-of-use-pane.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { connect } from 'react-redux'
import { Checkbox, ControlLabel, FormGroup } from 'react-bootstrap'
import { FormattedMessage } from 'react-intl'
import { FormattedMessage, useIntl } from 'react-intl'

import { TERMS_OF_SERVICE_PATH, TERMS_OF_STORAGE_PATH } from '../../util/constants'

Expand All @@ -15,6 +15,7 @@ const TermsOfUsePane = ({
termsOfStorageSet,
values: userData
}) => {
const intl = useIntl()
const {
hasConsentedToTerms,
storeTripHistory
Expand Down Expand Up @@ -48,7 +49,17 @@ const TermsOfUsePane = ({
checked={storeTripHistory}
name='storeTripHistory'
onBlur={handleBlur}
onChange={handleChange}
onChange={(e) => {
// Show alert when user is unchecking the checkbox
if (storeTripHistory) {
// Do nothing if the user hits cancel
if (!confirm(intl.formatMessage({id: 'components.TermsOfUsePane.confirmDeletionPrompt'}))) {
return
}
}

handleChange(e)
}}
>
<FormattedMessage
id='components.TermsOfUsePane.termsOfStorageStatement'
Expand Down