diff --git a/CHANGELOG.md b/CHANGELOG.md index d278187c..49986934 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,29 @@ way to update this template, but currently, we follow a pattern: ## Upcoming version 2019-XX-XX +- [change] Update `react-intl` to 3.1.13. More information about the changes can be found from + [Upgrade guide for react-intl@3.x](https://github.com/formatjs/react-intl/blob/master/docs/Upgrade-Guide.md) + + - Proptype `intlShape` was removed so we needed to create it again. Because of this we added a new + `util/reactIntl.js` file. This file is now used to wrap all the react-intl related imports. + - `addLocaleDate` function was removed and react-intl library is now relying on native Intl APIs: + [Intl.PluralRules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/PluralRules) + and + [Intl.RelativeTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat). + In order to support older browsers we needed to add `intl-pluralrules` and + `intl-relativetimeformat` to `util/polyfills.js` + - Also Node must be now compiled with `full-icu` which caused changes to `start` and `test` + scripts in `package.json`. We also needed to add a specific config for `nodemon` + - Default `textComponent`in `IntlProvider` changed to `React.Fragment` so we need to explicitly + set `textComponent` to `span`. Otherwise all the snapshots would have changed and it might + affect to UI if there is styles added to these spans generally in customization projects. + + Note: `FormattedMessage` component now supports + [`tagName` prop](https://github.com/formatjs/react-intl/blob/master/docs/Components.md#formattedmessage) + and + [improved rich-text formatting](https://github.com/formatjs/react-intl/blob/master/docs/Components.md#rich-text-formatting). + [#1181](https://github.com/sharetribe/flex-template-web/pull/1181) + - [change] Update helmet (v3.20.0 > v3.20.1). [#1186](https://github.com/sharetribe/flex-template-web/pull/1186) - [fix] Lodash vulnerability: enforce newer version for react-google-maps and react-dates diff --git a/package.json b/package.json index 368302ed..e955f3ab 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "private": true, "license": "Apache-2.0", "dependencies": { + "@formatjs/intl-relativetimeformat": "^2.8.2", "@mapbox/polyline": "^1.0.0", "@sentry/browser": "5.6.2", "@sentry/node": "5.6.2", @@ -24,7 +25,9 @@ "express-sitemap": "^1.8.0", "final-form": "^4.18.5", "final-form-arrays": "^3.0.0", + "full-icu": "^1.3.0", "helmet": "^3.18.0", + "intl-pluralrules": "^1.0.3", "lodash": "^4.17.14", "mapbox-gl-multitouch": "^1.0.3", "moment": "^2.22.2", @@ -41,7 +44,7 @@ "react-final-form-arrays": "^3.1.1", "react-google-maps": "^9.4.5", "react-helmet-async": "^1.0.2", - "react-intl": "^2.9.0", + "react-intl": "^3.1.13", "react-moment-proptypes": "^1.6.0", "react-redux": "^7.1.1", "react-router-dom": "^5.0.1", @@ -70,6 +73,11 @@ "react-google-maps/lodash": "^4.17.14", "react-test-renderer": "^16.9.0" }, + "nodemonConfig": { + "execMap": { + "js": "node --icu-data-dir=node_modules/full-icu" + } + }, "scripts": { "audit": "yarn audit --json | node scripts/audit.js", "clean": "rm -rf build/*", @@ -79,10 +87,10 @@ "format": "prettier --write '**/*.{js,css}'", "format-ci": "prettier --list-different '**/*.{js,css}'", "format-docs": "prettier --write '**/*.md'", - "test": "sharetribe-scripts test", + "test": "NODE_ICU_DATA=node_modules/full-icu sharetribe-scripts test", "test-ci": "sharetribe-scripts test --runInBand", "eject": "sharetribe-scripts eject", - "start": "node server/index.js", + "start": "node --icu-data-dir=node_modules/full-icu server/index.js", "dev-server": "export NODE_ENV=development PORT=4000 REACT_APP_CANONICAL_ROOT_URL=http://localhost:4000&&yarn run build&&nodemon --watch server server/index.js", "heroku-postbuild": "yarn run build", "translate": "node scripts/translations.js" diff --git a/src/app.js b/src/app.js index 9d2dcb49..69854509 100644 --- a/src/app.js +++ b/src/app.js @@ -12,7 +12,7 @@ import { Provider } from 'react-redux'; import difference from 'lodash/difference'; import mapValues from 'lodash/mapValues'; import moment from 'moment'; -import { IntlProvider, addLocaleData } from 'react-intl'; +import { IntlProvider } from './util/reactIntl'; import configureStore from './store'; import routeConfiguration from './routeConfiguration'; import Routes from './Routes'; @@ -23,24 +23,20 @@ import defaultMessages from './translations/en.json'; // If you want to change the language, change the imports to match the wanted locale: // 1) Change the language in the config.js file! -// 2) Import correct locale rules for React Intl library -// 3) Import correct locale rules for Moment library -// 4) Use the `messagesInLocale` import to add the correct translation file. +// 2) Import correct locale rules for Moment library +// 3) Use the `messagesInLocale` import to add the correct translation file. +// 4) To support older browsers we need add the correct locale for intl-relativetimeformat to `util/polyfills.js` // Note that there is also translations in './translations/countryCodes.js' file // This file contains ISO 3166-1 alpha-2 country codes, country names and their translations in our default languages // This used to collect billing address in StripePaymentAddress on CheckoutPage // Step 2: -// Import locale rules for React Intl library -import localeData from 'react-intl/locale-data/en'; - -// Step 3: // If you are using a non-english locale with moment library, // you should also import time specific formatting rules for that locale // e.g. for French: import 'moment/locale/fr'; -// Step 4: +// Step 3: // If you are using a non-english locale, point `messagesInLocale` to correct .json file import messagesInLocale from './translations/fr.json'; @@ -75,13 +71,12 @@ const localeMessages = isTestEnv ? testMessages : messages; const setupLocale = () => { if (isTestEnv) { - // Don't change the locale in tests + // Use english as a default locale in tests + // This affects app.test.js and app.node.test.js tests + config.locale = 'en'; return; } - // Add the translation messages - addLocaleData([...localeData]); - // Set the Moment locale globally // See: http://momentjs.com/docs/#/i18n/changing-locale/ moment.locale(config.locale); @@ -91,7 +86,7 @@ export const ClientApp = props => { const { store } = props; setupLocale(); return ( - + @@ -112,7 +107,7 @@ export const ServerApp = props => { setupLocale(); HelmetProvider.canUseDOM = false; return ( - + diff --git a/src/components/ActivityFeed/ActivityFeed.js b/src/components/ActivityFeed/ActivityFeed.js index 7795d2ea..9d4ee91b 100644 --- a/src/components/ActivityFeed/ActivityFeed.js +++ b/src/components/ActivityFeed/ActivityFeed.js @@ -1,6 +1,6 @@ import React from 'react'; import { string, arrayOf, bool, func, number } from 'prop-types'; -import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import dropWhile from 'lodash/dropWhile'; import classNames from 'classnames'; import { Avatar, InlineTextButton, ReviewRating, UserDisplayName } from '../../components'; diff --git a/src/components/Avatar/Avatar.js b/src/components/Avatar/Avatar.js index d96bd622..81d0306d 100644 --- a/src/components/Avatar/Avatar.js +++ b/src/components/Avatar/Avatar.js @@ -1,6 +1,6 @@ import React from 'react'; import { string, oneOfType, bool } from 'prop-types'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import classNames from 'classnames'; import { propTypes } from '../../util/types'; import { diff --git a/src/components/BookingBreakdown/BookingBreakdown.js b/src/components/BookingBreakdown/BookingBreakdown.js index 2cfadf25..6d5cee30 100644 --- a/src/components/BookingBreakdown/BookingBreakdown.js +++ b/src/components/BookingBreakdown/BookingBreakdown.js @@ -4,7 +4,7 @@ */ import React from 'react'; import { oneOf, string } from 'prop-types'; -import { FormattedMessage, intlShape, injectIntl } from 'react-intl'; +import { FormattedMessage, intlShape, injectIntl } from '../../util/reactIntl'; import classNames from 'classnames'; import { propTypes, diff --git a/src/components/BookingBreakdown/LineItemBookingPeriod.js b/src/components/BookingBreakdown/LineItemBookingPeriod.js index bd018c54..f76c3221 100644 --- a/src/components/BookingBreakdown/LineItemBookingPeriod.js +++ b/src/components/BookingBreakdown/LineItemBookingPeriod.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage, FormattedHTMLMessage, FormattedDate } from 'react-intl'; +import { FormattedMessage, FormattedHTMLMessage, FormattedDate } from '../../util/reactIntl'; import moment from 'moment'; import { LINE_ITEM_NIGHT, LINE_ITEM_DAY, propTypes } from '../../util/types'; import { daysBetween, dateFromAPIToLocalNoon } from '../../util/dates'; diff --git a/src/components/BookingBreakdown/LineItemCustomerCommissionMaybe.js b/src/components/BookingBreakdown/LineItemCustomerCommissionMaybe.js index d926e292..5157c59e 100644 --- a/src/components/BookingBreakdown/LineItemCustomerCommissionMaybe.js +++ b/src/components/BookingBreakdown/LineItemCustomerCommissionMaybe.js @@ -1,6 +1,6 @@ import React from 'react'; import { bool } from 'prop-types'; -import { FormattedMessage, intlShape } from 'react-intl'; +import { FormattedMessage, intlShape } from '../../util/reactIntl'; import { formatMoney } from '../../util/currency'; import { types as sdkTypes } from '../../util/sdkLoader'; import { LINE_ITEM_CUSTOMER_COMMISSION, propTypes } from '../../util/types'; diff --git a/src/components/BookingBreakdown/LineItemCustomerCommissionRefundMaybe.js b/src/components/BookingBreakdown/LineItemCustomerCommissionRefundMaybe.js index f101c639..179578da 100644 --- a/src/components/BookingBreakdown/LineItemCustomerCommissionRefundMaybe.js +++ b/src/components/BookingBreakdown/LineItemCustomerCommissionRefundMaybe.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage, intlShape } from 'react-intl'; +import { FormattedMessage, intlShape } from '../../util/reactIntl'; import { formatMoney } from '../../util/currency'; import { propTypes, LINE_ITEM_CUSTOMER_COMMISSION } from '../../util/types'; diff --git a/src/components/BookingBreakdown/LineItemProviderCommissionMaybe.js b/src/components/BookingBreakdown/LineItemProviderCommissionMaybe.js index 8016e641..4c468dff 100644 --- a/src/components/BookingBreakdown/LineItemProviderCommissionMaybe.js +++ b/src/components/BookingBreakdown/LineItemProviderCommissionMaybe.js @@ -1,6 +1,6 @@ import React from 'react'; import { bool } from 'prop-types'; -import { FormattedMessage, intlShape } from 'react-intl'; +import { FormattedMessage, intlShape } from '../../util/reactIntl'; import { formatMoney } from '../../util/currency'; import { types as sdkTypes } from '../../util/sdkLoader'; import { LINE_ITEM_PROVIDER_COMMISSION, propTypes } from '../../util/types'; diff --git a/src/components/BookingBreakdown/LineItemProviderCommissionRefundMaybe.js b/src/components/BookingBreakdown/LineItemProviderCommissionRefundMaybe.js index 79cf6c9d..f0023397 100644 --- a/src/components/BookingBreakdown/LineItemProviderCommissionRefundMaybe.js +++ b/src/components/BookingBreakdown/LineItemProviderCommissionRefundMaybe.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage, intlShape } from 'react-intl'; +import { FormattedMessage, intlShape } from '../../util/reactIntl'; import { formatMoney } from '../../util/currency'; import { propTypes, LINE_ITEM_PROVIDER_COMMISSION } from '../../util/types'; diff --git a/src/components/BookingBreakdown/LineItemRefundMaybe.js b/src/components/BookingBreakdown/LineItemRefundMaybe.js index 77eb994c..04653bd2 100644 --- a/src/components/BookingBreakdown/LineItemRefundMaybe.js +++ b/src/components/BookingBreakdown/LineItemRefundMaybe.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage, intlShape } from 'react-intl'; +import { FormattedMessage, intlShape } from '../../util/reactIntl'; import Decimal from 'decimal.js'; import { formatMoney } from '../../util/currency'; import { types as sdkTypes } from '../../util/sdkLoader'; diff --git a/src/components/BookingBreakdown/LineItemSubTotalMaybe.js b/src/components/BookingBreakdown/LineItemSubTotalMaybe.js index 0e957316..f60da782 100644 --- a/src/components/BookingBreakdown/LineItemSubTotalMaybe.js +++ b/src/components/BookingBreakdown/LineItemSubTotalMaybe.js @@ -1,6 +1,6 @@ import React from 'react'; import { string } from 'prop-types'; -import { FormattedMessage, intlShape } from 'react-intl'; +import { FormattedMessage, intlShape } from '../../util/reactIntl'; import Decimal from 'decimal.js'; import { formatMoney } from '../../util/currency'; import config from '../../config'; diff --git a/src/components/BookingBreakdown/LineItemTotalPrice.js b/src/components/BookingBreakdown/LineItemTotalPrice.js index c55a036d..5a373a00 100644 --- a/src/components/BookingBreakdown/LineItemTotalPrice.js +++ b/src/components/BookingBreakdown/LineItemTotalPrice.js @@ -1,6 +1,6 @@ import React from 'react'; import { bool } from 'prop-types'; -import { FormattedMessage, intlShape } from 'react-intl'; +import { FormattedMessage, intlShape } from '../../util/reactIntl'; import { formatMoney } from '../../util/currency'; import { txIsCanceled, txIsDelivered, txIsDeclined } from '../../util/transaction'; import { propTypes } from '../../util/types'; diff --git a/src/components/BookingBreakdown/LineItemUnitPriceMaybe.js b/src/components/BookingBreakdown/LineItemUnitPriceMaybe.js index 29549016..18850bf9 100644 --- a/src/components/BookingBreakdown/LineItemUnitPriceMaybe.js +++ b/src/components/BookingBreakdown/LineItemUnitPriceMaybe.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage, intlShape } from 'react-intl'; +import { FormattedMessage, intlShape } from '../../util/reactIntl'; import { formatMoney } from '../../util/currency'; import { LINE_ITEM_NIGHT, LINE_ITEM_DAY, propTypes } from '../../util/types'; diff --git a/src/components/BookingBreakdown/LineItemUnitsMaybe.js b/src/components/BookingBreakdown/LineItemUnitsMaybe.js index a46118c2..f8b221bf 100644 --- a/src/components/BookingBreakdown/LineItemUnitsMaybe.js +++ b/src/components/BookingBreakdown/LineItemUnitsMaybe.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { LINE_ITEM_UNITS, propTypes } from '../../util/types'; import css from './BookingBreakdown.css'; diff --git a/src/components/BookingBreakdown/LineItemUnknownItemsMaybe.js b/src/components/BookingBreakdown/LineItemUnknownItemsMaybe.js index 3e5f3894..e96b0ea0 100644 --- a/src/components/BookingBreakdown/LineItemUnknownItemsMaybe.js +++ b/src/components/BookingBreakdown/LineItemUnknownItemsMaybe.js @@ -10,7 +10,7 @@ * component for them that can be used in the `BookingBreakdown` component. */ import React from 'react'; -import { intlShape } from 'react-intl'; +import { intlShape } from '../../util/reactIntl'; import { formatMoney } from '../../util/currency'; import { humanizeLineItemCode } from '../../util/data'; import { LINE_ITEMS, propTypes } from '../../util/types'; diff --git a/src/components/BookingDateRangeFilter/BookingDateRangeFilter.js b/src/components/BookingDateRangeFilter/BookingDateRangeFilter.js index b1d39683..fb3c77d7 100644 --- a/src/components/BookingDateRangeFilter/BookingDateRangeFilter.js +++ b/src/components/BookingDateRangeFilter/BookingDateRangeFilter.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { bool, func, number, object, string } from 'prop-types'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import { FieldDateRangeController, FilterPopup, FilterPlain } from '../../components'; import css from './BookingDateRangeFilter.css'; diff --git a/src/components/BookingDateRangeFilter/__snapshots__/BookingDateRangeFilter.test.js.snap b/src/components/BookingDateRangeFilter/__snapshots__/BookingDateRangeFilter.test.js.snap index fa20fb44..2d84624e 100644 --- a/src/components/BookingDateRangeFilter/__snapshots__/BookingDateRangeFilter.test.js.snap +++ b/src/components/BookingDateRangeFilter/__snapshots__/BookingDateRangeFilter.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`BookingDateRangeFilter matches plain snapshot 1`] = ` - - + `; exports[`BookingDateRangeFilter matches popup snapshot 1`] = ` - - + `; diff --git a/src/components/BookingPanel/BookingPanel.js b/src/components/BookingPanel/BookingPanel.js index 2de05a3e..5f655286 100644 --- a/src/components/BookingPanel/BookingPanel.js +++ b/src/components/BookingPanel/BookingPanel.js @@ -1,9 +1,8 @@ import React from 'react'; import { compose } from 'redux'; import { withRouter } from 'react-router-dom'; -import { intlShape, injectIntl } from 'react-intl'; +import { intlShape, injectIntl, FormattedMessage } from '../../util/reactIntl'; import { arrayOf, bool, func, node, oneOfType, shape, string } from 'prop-types'; -import { FormattedMessage } from 'react-intl'; import classNames from 'classnames'; import omit from 'lodash/omit'; import { propTypes, LISTING_STATE_CLOSED, LINE_ITEM_NIGHT, LINE_ITEM_DAY } from '../../util/types'; diff --git a/src/components/CookieConsent/CookieConsent.js b/src/components/CookieConsent/CookieConsent.js index 47694d58..a8e88923 100644 --- a/src/components/CookieConsent/CookieConsent.js +++ b/src/components/CookieConsent/CookieConsent.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { ExternalLink } from '../../components'; import classNames from 'classnames'; diff --git a/src/components/EditListingAvailabilityPanel/EditListingAvailabilityPanel.js b/src/components/EditListingAvailabilityPanel/EditListingAvailabilityPanel.js index 1ffef499..19b41e5f 100644 --- a/src/components/EditListingAvailabilityPanel/EditListingAvailabilityPanel.js +++ b/src/components/EditListingAvailabilityPanel/EditListingAvailabilityPanel.js @@ -1,7 +1,7 @@ import React from 'react'; import { bool, func, object, shape, string } from 'prop-types'; import classNames from 'classnames'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { ensureOwnListing } from '../../util/data'; import { LISTING_STATE_DRAFT } from '../../util/types'; import { ListingLink } from '../../components'; diff --git a/src/components/EditListingDescriptionPanel/EditListingDescriptionPanel.js b/src/components/EditListingDescriptionPanel/EditListingDescriptionPanel.js index 3b1dc8cf..3af8ac4f 100644 --- a/src/components/EditListingDescriptionPanel/EditListingDescriptionPanel.js +++ b/src/components/EditListingDescriptionPanel/EditListingDescriptionPanel.js @@ -1,7 +1,7 @@ import React from 'react'; import { bool, func, object, string } from 'prop-types'; import classNames from 'classnames'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { ensureOwnListing } from '../../util/data'; import { ListingLink } from '../../components'; import { LISTING_STATE_DRAFT } from '../../util/types'; diff --git a/src/components/EditListingFeaturesPanel/EditListingFeaturesPanel.js b/src/components/EditListingFeaturesPanel/EditListingFeaturesPanel.js index f64e8b94..ac436762 100644 --- a/src/components/EditListingFeaturesPanel/EditListingFeaturesPanel.js +++ b/src/components/EditListingFeaturesPanel/EditListingFeaturesPanel.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { LISTING_STATE_DRAFT } from '../../util/types'; import { ensureListing } from '../../util/data'; diff --git a/src/components/EditListingLocationPanel/EditListingLocationPanel.js b/src/components/EditListingLocationPanel/EditListingLocationPanel.js index 67a1d48f..587a24e7 100644 --- a/src/components/EditListingLocationPanel/EditListingLocationPanel.js +++ b/src/components/EditListingLocationPanel/EditListingLocationPanel.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { LISTING_STATE_DRAFT } from '../../util/types'; import { ensureOwnListing } from '../../util/data'; import { ListingLink } from '../../components'; diff --git a/src/components/EditListingPhotosPanel/EditListingPhotosPanel.js b/src/components/EditListingPhotosPanel/EditListingPhotosPanel.js index 282f0946..cc706def 100644 --- a/src/components/EditListingPhotosPanel/EditListingPhotosPanel.js +++ b/src/components/EditListingPhotosPanel/EditListingPhotosPanel.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { array, bool, func, object, string } from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { LISTING_STATE_DRAFT } from '../../util/types'; import { EditListingPhotosForm } from '../../forms'; diff --git a/src/components/EditListingPoliciesPanel/EditListingPoliciesPanel.js b/src/components/EditListingPoliciesPanel/EditListingPoliciesPanel.js index 44ac7b7c..90e692a1 100644 --- a/src/components/EditListingPoliciesPanel/EditListingPoliciesPanel.js +++ b/src/components/EditListingPoliciesPanel/EditListingPoliciesPanel.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { LISTING_STATE_DRAFT } from '../../util/types'; import { ensureOwnListing } from '../../util/data'; import { ListingLink } from '../../components'; diff --git a/src/components/EditListingPricingPanel/EditListingPricingPanel.js b/src/components/EditListingPricingPanel/EditListingPricingPanel.js index de457593..92552864 100644 --- a/src/components/EditListingPricingPanel/EditListingPricingPanel.js +++ b/src/components/EditListingPricingPanel/EditListingPricingPanel.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { LISTING_STATE_DRAFT } from '../../util/types'; import { ListingLink } from '../../components'; import { EditListingPricingForm } from '../../forms'; diff --git a/src/components/EditListingWizard/EditListingWizard.js b/src/components/EditListingWizard/EditListingWizard.js index 29e92709..bcbb6699 100644 --- a/src/components/EditListingWizard/EditListingWizard.js +++ b/src/components/EditListingWizard/EditListingWizard.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { array, bool, func, number, object, oneOf, shape, string } from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import classNames from 'classnames'; import config from '../../config'; import { withViewport } from '../../util/contextHelpers'; diff --git a/src/components/EditListingWizard/EditListingWizardTab.js b/src/components/EditListingWizard/EditListingWizardTab.js index 622c88bb..a0bd0604 100644 --- a/src/components/EditListingWizard/EditListingWizardTab.js +++ b/src/components/EditListingWizard/EditListingWizardTab.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { intlShape } from 'react-intl'; +import { intlShape } from '../../util/reactIntl'; import routeConfiguration from '../../routeConfiguration'; import { LISTING_PAGE_PARAM_TYPE_DRAFT, diff --git a/src/components/FieldBirthdayInput/FieldBirthdayInput.js b/src/components/FieldBirthdayInput/FieldBirthdayInput.js index cd61a6cc..811e1355 100644 --- a/src/components/FieldBirthdayInput/FieldBirthdayInput.js +++ b/src/components/FieldBirthdayInput/FieldBirthdayInput.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { func, instanceOf, object, node, string, bool } from 'prop-types'; import { Field } from 'react-final-form'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import classNames from 'classnames'; import range from 'lodash/range'; import { ValidationError } from '../../components'; diff --git a/src/components/FieldBoolean/FieldBoolean.js b/src/components/FieldBoolean/FieldBoolean.js index 3f19edcc..72253e1d 100644 --- a/src/components/FieldBoolean/FieldBoolean.js +++ b/src/components/FieldBoolean/FieldBoolean.js @@ -1,5 +1,5 @@ import React from 'react'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import { FieldSelect } from '../../components'; const FieldBoolean = props => { diff --git a/src/components/FieldCurrencyInput/FieldCurrencyInput.example.js b/src/components/FieldCurrencyInput/FieldCurrencyInput.example.js index 9f528f1d..fa9f4a07 100644 --- a/src/components/FieldCurrencyInput/FieldCurrencyInput.example.js +++ b/src/components/FieldCurrencyInput/FieldCurrencyInput.example.js @@ -1,10 +1,8 @@ /* eslint-disable no-console */ import React from 'react'; import PropTypes from 'prop-types'; -import { IntlProvider, addLocaleData } from 'react-intl'; import { Form as FinalForm, FormSpy } from 'react-final-form'; -import en from 'react-intl/locale-data/en'; -import fi from 'react-intl/locale-data/fi'; +import { IntlProvider } from '../../util/reactIntl'; import { currencyConfig } from '../../util/test-data'; import * as validators from '../../util/validators'; import FieldCurrencyInput, { CurrencyInput } from './FieldCurrencyInput'; @@ -24,13 +22,8 @@ const onChange = price => console.log('CurrencyInput - value:', price); // Different locales need to be initialized before their currency formatting is in use const CurrencyInputWithIntl = ({ locale, ...rest }) => { - if (locale === 'en') { - addLocaleData([...en]); - } else { - addLocaleData([...fi]); - } return ( - + ); diff --git a/src/components/FieldCurrencyInput/FieldCurrencyInput.js b/src/components/FieldCurrencyInput/FieldCurrencyInput.js index 19050c2e..cddfc6f0 100644 --- a/src/components/FieldCurrencyInput/FieldCurrencyInput.js +++ b/src/components/FieldCurrencyInput/FieldCurrencyInput.js @@ -5,7 +5,7 @@ */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { intlShape, injectIntl } from 'react-intl'; +import { intlShape, injectIntl } from '../../util/reactIntl'; import { Field } from 'react-final-form'; import classNames from 'classnames'; import Decimal from 'decimal.js'; diff --git a/src/components/FieldDateInput/DateInput.js b/src/components/FieldDateInput/DateInput.js index d31ce489..57d0caa9 100644 --- a/src/components/FieldDateInput/DateInput.js +++ b/src/components/FieldDateInput/DateInput.js @@ -12,7 +12,7 @@ import { isInclusivelyBeforeDay, isSameDay, } from 'react-dates'; -import { intlShape, injectIntl } from 'react-intl'; +import { intlShape, injectIntl } from '../../util/reactIntl'; import classNames from 'classnames'; import moment from 'moment'; import config from '../../config'; diff --git a/src/components/FieldDateRangeInput/DateRangeInput.js b/src/components/FieldDateRangeInput/DateRangeInput.js index 2925349c..a503ac8d 100644 --- a/src/components/FieldDateRangeInput/DateRangeInput.js +++ b/src/components/FieldDateRangeInput/DateRangeInput.js @@ -7,7 +7,7 @@ import React, { Component } from 'react'; import { bool, func, instanceOf, oneOf, shape, string, arrayOf } from 'prop-types'; import { DateRangePicker, isInclusivelyAfterDay, isInclusivelyBeforeDay } from 'react-dates'; -import { intlShape, injectIntl } from 'react-intl'; +import { intlShape, injectIntl } from '../../util/reactIntl'; import classNames from 'classnames'; import moment from 'moment'; import { START_DATE, END_DATE } from '../../util/dates'; diff --git a/src/components/FieldReviewRating/FieldReviewRating.js b/src/components/FieldReviewRating/FieldReviewRating.js index 25698b16..3a4be5e1 100644 --- a/src/components/FieldReviewRating/FieldReviewRating.js +++ b/src/components/FieldReviewRating/FieldReviewRating.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { intlShape, injectIntl } from 'react-intl'; +import { intlShape, injectIntl } from '../../util/reactIntl'; import { Field } from 'react-final-form'; import classNames from 'classnames'; import { IconReviewStar, ValidationError } from '../../components'; diff --git a/src/components/FilterPlain/FilterPlain.js b/src/components/FilterPlain/FilterPlain.js index 30839e3d..96a3e840 100644 --- a/src/components/FilterPlain/FilterPlain.js +++ b/src/components/FilterPlain/FilterPlain.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { bool, func, node, object, string } from 'prop-types'; import classNames from 'classnames'; -import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { FilterForm } from '../../forms'; import css from './FilterPlain.css'; diff --git a/src/components/FilterPopup/FilterPopup.js b/src/components/FilterPopup/FilterPopup.js index 6f54a0e2..78c441c8 100644 --- a/src/components/FilterPopup/FilterPopup.js +++ b/src/components/FilterPopup/FilterPopup.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { bool, func, node, number, object, string } from 'prop-types'; import classNames from 'classnames'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import { OutsideClickHandler } from '../../components'; import { FilterForm } from '../../forms'; diff --git a/src/components/Footer/Footer.js b/src/components/Footer/Footer.js index 623775ac..44437cfe 100644 --- a/src/components/Footer/Footer.js +++ b/src/components/Footer/Footer.js @@ -1,6 +1,6 @@ import React from 'react'; import { string } from 'prop-types'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import classNames from 'classnames'; import { twitterPageURL } from '../../util/urlHelpers'; import config from '../../config'; diff --git a/src/components/ImageCarousel/ImageCarousel.js b/src/components/ImageCarousel/ImageCarousel.js index dfe40577..c01b30d9 100644 --- a/src/components/ImageCarousel/ImageCarousel.js +++ b/src/components/ImageCarousel/ImageCarousel.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import classNames from 'classnames'; import { ResponsiveImage, IconSpinner } from '../../components'; import { propTypes } from '../../util/types'; diff --git a/src/components/ImageFromFile/ImageFromFile.js b/src/components/ImageFromFile/ImageFromFile.js index a1fbed48..5fad1cdd 100644 --- a/src/components/ImageFromFile/ImageFromFile.js +++ b/src/components/ImageFromFile/ImageFromFile.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { Promised } from '../../components'; diff --git a/src/components/KeywordFilter/KeywordFilter.js b/src/components/KeywordFilter/KeywordFilter.js index ab16a317..80f8728d 100644 --- a/src/components/KeywordFilter/KeywordFilter.js +++ b/src/components/KeywordFilter/KeywordFilter.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { func, number, string } from 'prop-types'; import classNames from 'classnames'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import debounce from 'lodash/debounce'; import { FieldTextInput } from '../../components'; diff --git a/src/components/LayoutWrapperAccountSettingsSideNav/LayoutWrapperAccountSettingsSideNav.js b/src/components/LayoutWrapperAccountSettingsSideNav/LayoutWrapperAccountSettingsSideNav.js index 0dbf9019..86d62d9b 100644 --- a/src/components/LayoutWrapperAccountSettingsSideNav/LayoutWrapperAccountSettingsSideNav.js +++ b/src/components/LayoutWrapperAccountSettingsSideNav/LayoutWrapperAccountSettingsSideNav.js @@ -5,7 +5,7 @@ import React from 'react'; import { node, number, string, shape } from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { withViewport } from '../../util/contextHelpers'; import { LayoutWrapperSideNav } from '../../components'; diff --git a/src/components/ListingCard/ListingCard.js b/src/components/ListingCard/ListingCard.js index d8fdb0f0..0ef61c62 100644 --- a/src/components/ListingCard/ListingCard.js +++ b/src/components/ListingCard/ListingCard.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { string, func } from 'prop-types'; -import { FormattedMessage, intlShape, injectIntl } from 'react-intl'; +import { FormattedMessage, intlShape, injectIntl } from '../../util/reactIntl'; import classNames from 'classnames'; import { lazyLoadWithDimensions } from '../../util/contextHelpers'; import { LINE_ITEM_DAY, LINE_ITEM_NIGHT, propTypes } from '../../util/types'; diff --git a/src/components/LocationAutocompleteInput/LocationAutocompleteInputImpl.js b/src/components/LocationAutocompleteInput/LocationAutocompleteInputImpl.js index eb9140b1..2c2327ed 100644 --- a/src/components/LocationAutocompleteInput/LocationAutocompleteInputImpl.js +++ b/src/components/LocationAutocompleteInput/LocationAutocompleteInputImpl.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { any, arrayOf, bool, func, number, shape, string, oneOfType, object } from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import debounce from 'lodash/debounce'; import { IconSpinner } from '../../components'; diff --git a/src/components/ManageListingCard/ManageListingCard.js b/src/components/ManageListingCard/ManageListingCard.js index 6d2bd786..0789f748 100644 --- a/src/components/ManageListingCard/ManageListingCard.js +++ b/src/components/ManageListingCard/ManageListingCard.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; import { withRouter } from 'react-router-dom'; -import { FormattedMessage, intlShape, injectIntl } from 'react-intl'; +import { FormattedMessage, intlShape, injectIntl } from '../../util/reactIntl'; import classNames from 'classnames'; import routeConfiguration from '../../routeConfiguration'; import { diff --git a/src/components/Modal/Modal.js b/src/components/Modal/Modal.js index 08db33e0..b4875992 100644 --- a/src/components/Modal/Modal.js +++ b/src/components/Modal/Modal.js @@ -11,7 +11,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -import { FormattedMessage, intlShape, injectIntl } from 'react-intl'; +import { FormattedMessage, intlShape, injectIntl } from '../../util/reactIntl'; import { Button, IconClose } from '../../components'; import css from './Modal.css'; diff --git a/src/components/ModalMissingInformation/EmailReminder.js b/src/components/ModalMissingInformation/EmailReminder.js index 86fe45f1..6a53a46f 100644 --- a/src/components/ModalMissingInformation/EmailReminder.js +++ b/src/components/ModalMissingInformation/EmailReminder.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { isTooManyEmailVerificationRequestsError } from '../../util/errors'; import { IconEmailAttention, InlineTextButton, NamedLink } from '../../components'; diff --git a/src/components/ModalMissingInformation/ModalMissingInformation.js b/src/components/ModalMissingInformation/ModalMissingInformation.js index 5094e9af..83ce894d 100644 --- a/src/components/ModalMissingInformation/ModalMissingInformation.js +++ b/src/components/ModalMissingInformation/ModalMissingInformation.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { bool, func, string } from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import routeConfiguration from '../../routeConfiguration'; import { ensureCurrentUser } from '../../util/data'; diff --git a/src/components/ModalMissingInformation/StripeAccountReminder.js b/src/components/ModalMissingInformation/StripeAccountReminder.js index fae1c657..4b1f2181 100644 --- a/src/components/ModalMissingInformation/StripeAccountReminder.js +++ b/src/components/ModalMissingInformation/StripeAccountReminder.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { NamedLink } from '../../components'; import css from './ModalMissingInformation.css'; diff --git a/src/components/Page/Page.js b/src/components/Page/Page.js index d0046a6b..05a3119a 100644 --- a/src/components/Page/Page.js +++ b/src/components/Page/Page.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Helmet } from 'react-helmet-async'; import { withRouter } from 'react-router-dom'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import classNames from 'classnames'; import routeConfiguration from '../../routeConfiguration'; import config from '../../config'; diff --git a/src/components/PaginationLinks/PaginationLinks.js b/src/components/PaginationLinks/PaginationLinks.js index 68c127ee..6d3eeb07 100644 --- a/src/components/PaginationLinks/PaginationLinks.js +++ b/src/components/PaginationLinks/PaginationLinks.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import classNames from 'classnames'; import range from 'lodash/range'; import { IconArrowHead, NamedLink } from '../../components'; diff --git a/src/components/PriceFilter/PriceFilterPlain.js b/src/components/PriceFilter/PriceFilterPlain.js index 560a652e..ce7d8553 100644 --- a/src/components/PriceFilter/PriceFilterPlain.js +++ b/src/components/PriceFilter/PriceFilterPlain.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { func, number, shape, string } from 'prop-types'; import classNames from 'classnames'; -import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { propTypes } from '../../util/types'; import { formatCurrencyMajorUnit } from '../../util/currency'; import config from '../../config'; diff --git a/src/components/PriceFilter/PriceFilterPopup.js b/src/components/PriceFilter/PriceFilterPopup.js index b50e84eb..b707cc3d 100644 --- a/src/components/PriceFilter/PriceFilterPopup.js +++ b/src/components/PriceFilter/PriceFilterPopup.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { func, number, shape, string } from 'prop-types'; import classNames from 'classnames'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import { propTypes } from '../../util/types'; import { formatCurrencyMajorUnit } from '../../util/currency'; import config from '../../config'; diff --git a/src/components/ResponsiveImage/ResponsiveImage.js b/src/components/ResponsiveImage/ResponsiveImage.js index 05446138..550743e5 100644 --- a/src/components/ResponsiveImage/ResponsiveImage.js +++ b/src/components/ResponsiveImage/ResponsiveImage.js @@ -36,7 +36,7 @@ import React from 'react'; import { arrayOf, string } from 'prop-types'; import classNames from 'classnames'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { propTypes } from '../../util/types'; import NoImageIcon from './NoImageIcon'; diff --git a/src/components/ReviewModal/ReviewModal.js b/src/components/ReviewModal/ReviewModal.js index 7290725a..213adcf7 100644 --- a/src/components/ReviewModal/ReviewModal.js +++ b/src/components/ReviewModal/ReviewModal.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { FormattedMessage, intlShape, injectIntl } from 'react-intl'; +import { FormattedMessage, intlShape, injectIntl } from '../../util/reactIntl'; import classNames from 'classnames'; import { propTypes } from '../../util/types'; import { IconReviewUser, Modal } from '../../components'; diff --git a/src/components/Reviews/Reviews.js b/src/components/Reviews/Reviews.js index 9233b6b7..a69a48cf 100644 --- a/src/components/Reviews/Reviews.js +++ b/src/components/Reviews/Reviews.js @@ -1,5 +1,5 @@ import React from 'react'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import { arrayOf, string } from 'prop-types'; import classNames from 'classnames'; import { Avatar, ReviewRating, UserDisplayName } from '../../components'; diff --git a/src/components/SavedCardDetails/SavedCardDetails.js b/src/components/SavedCardDetails/SavedCardDetails.js index 5e417eb6..7497d3c1 100644 --- a/src/components/SavedCardDetails/SavedCardDetails.js +++ b/src/components/SavedCardDetails/SavedCardDetails.js @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import ReactDOM from 'react-dom'; import { bool, func, number, shape, string } from 'prop-types'; import classNames from 'classnames'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import { IconArrowHead, IconCard, diff --git a/src/components/SearchFilters/SearchFilters.js b/src/components/SearchFilters/SearchFilters.js index d9a7a66d..189663df 100644 --- a/src/components/SearchFilters/SearchFilters.js +++ b/src/components/SearchFilters/SearchFilters.js @@ -1,7 +1,7 @@ import React from 'react'; import { compose } from 'redux'; import { object, string, bool, number, func, shape } from 'prop-types'; -import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import classNames from 'classnames'; import { withRouter } from 'react-router-dom'; import omit from 'lodash/omit'; diff --git a/src/components/SearchFiltersMobile/SearchFiltersMobile.js b/src/components/SearchFiltersMobile/SearchFiltersMobile.js index b582e049..4a4fba3b 100644 --- a/src/components/SearchFiltersMobile/SearchFiltersMobile.js +++ b/src/components/SearchFiltersMobile/SearchFiltersMobile.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { object, string, bool, number, func, shape, array } from 'prop-types'; import classNames from 'classnames'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { withRouter } from 'react-router-dom'; import omit from 'lodash/omit'; diff --git a/src/components/SearchFiltersPanel/SearchFiltersPanel.js b/src/components/SearchFiltersPanel/SearchFiltersPanel.js index 4a1946c6..436bb4ee 100644 --- a/src/components/SearchFiltersPanel/SearchFiltersPanel.js +++ b/src/components/SearchFiltersPanel/SearchFiltersPanel.js @@ -29,7 +29,7 @@ import React, { Component } from 'react'; import { array, func, object, shape, string } from 'prop-types'; import classNames from 'classnames'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { withRouter } from 'react-router-dom'; import omit from 'lodash/omit'; diff --git a/src/components/SearchMap/ReusableMapContainer.js b/src/components/SearchMap/ReusableMapContainer.js index 2cc2aabd..4a507a78 100644 --- a/src/components/SearchMap/ReusableMapContainer.js +++ b/src/components/SearchMap/ReusableMapContainer.js @@ -1,7 +1,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { node, string, object } from 'prop-types'; -import { IntlProvider } from 'react-intl'; +import { IntlProvider } from '../../util/reactIntl'; import config from '../../config'; import css from './SearchMap.css'; @@ -59,7 +59,7 @@ class ReusableMapContainer extends React.Component { // You need to provide onClick functions and URLs as props. const renderChildren = () => { const children = ( - + {this.props.children} ); diff --git a/src/components/SearchMapInfoCard/SearchMapInfoCard.js b/src/components/SearchMapInfoCard/SearchMapInfoCard.js index 1761d8ac..c96936e6 100644 --- a/src/components/SearchMapInfoCard/SearchMapInfoCard.js +++ b/src/components/SearchMapInfoCard/SearchMapInfoCard.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { arrayOf, bool, func, string } from 'prop-types'; import { compose } from 'redux'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import classNames from 'classnames'; import config from '../../config'; import { propTypes } from '../../util/types'; diff --git a/src/components/SearchMapPriceLabel/SearchMapPriceLabel.js b/src/components/SearchMapPriceLabel/SearchMapPriceLabel.js index 3e19f37d..22ef1e4d 100644 --- a/src/components/SearchMapPriceLabel/SearchMapPriceLabel.js +++ b/src/components/SearchMapPriceLabel/SearchMapPriceLabel.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import classNames from 'classnames'; import { propTypes } from '../../util/types'; import { formatMoney } from '../../util/currency'; diff --git a/src/components/SectionHero/SectionHero.js b/src/components/SectionHero/SectionHero.js index e3cd6482..c914f476 100644 --- a/src/components/SectionHero/SectionHero.js +++ b/src/components/SectionHero/SectionHero.js @@ -1,6 +1,6 @@ import React from 'react'; import { string } from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { NamedLink } from '../../components'; diff --git a/src/components/SectionHowItWorks/SectionHowItWorks.js b/src/components/SectionHowItWorks/SectionHowItWorks.js index 770fa08c..07cac80b 100644 --- a/src/components/SectionHowItWorks/SectionHowItWorks.js +++ b/src/components/SectionHowItWorks/SectionHowItWorks.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { NamedLink } from '../../components'; diff --git a/src/components/SectionLocations/SectionLocations.js b/src/components/SectionLocations/SectionLocations.js index c748e298..d8463f1c 100644 --- a/src/components/SectionLocations/SectionLocations.js +++ b/src/components/SectionLocations/SectionLocations.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { lazyLoadWithDimensions } from '../../util/contextHelpers'; diff --git a/src/components/SelectMultipleFilter/SelectMultipleFilter.js b/src/components/SelectMultipleFilter/SelectMultipleFilter.js index d8429f76..09c868d2 100644 --- a/src/components/SelectMultipleFilter/SelectMultipleFilter.js +++ b/src/components/SelectMultipleFilter/SelectMultipleFilter.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { array, arrayOf, func, number, string } from 'prop-types'; import classNames from 'classnames'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import { FieldCheckbox } from '../../components'; import { FilterPopup, FilterPlain } from '../../components'; diff --git a/src/components/SelectSingleFilter/SelectSingleFilterPlain.js b/src/components/SelectSingleFilter/SelectSingleFilterPlain.js index e99cfb07..1a1a0fd2 100644 --- a/src/components/SelectSingleFilter/SelectSingleFilterPlain.js +++ b/src/components/SelectSingleFilter/SelectSingleFilterPlain.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { arrayOf, bool, func, shape, string } from 'prop-types'; import classNames from 'classnames'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import css from './SelectSingleFilterPlain.css'; diff --git a/src/components/SelectSingleFilter/SelectSingleFilterPopup.js b/src/components/SelectSingleFilter/SelectSingleFilterPopup.js index bcce2899..d4062a1f 100644 --- a/src/components/SelectSingleFilter/SelectSingleFilterPopup.js +++ b/src/components/SelectSingleFilter/SelectSingleFilterPopup.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { string, func, arrayOf, shape, number } from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { Menu, MenuContent, MenuItem, MenuLabel } from '..'; diff --git a/src/components/StripeBankAccountTokenInputField/StripeBankAccountRequiredInput.js b/src/components/StripeBankAccountTokenInputField/StripeBankAccountRequiredInput.js index 43dd9d78..155ba94d 100644 --- a/src/components/StripeBankAccountTokenInputField/StripeBankAccountRequiredInput.js +++ b/src/components/StripeBankAccountTokenInputField/StripeBankAccountRequiredInput.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import css from './StripeBankAccountTokenInputField.css'; diff --git a/src/components/StripeBankAccountTokenInputField/StripeBankAccountTokenInputField.js b/src/components/StripeBankAccountTokenInputField/StripeBankAccountTokenInputField.js index 96f7cf0d..201b75c8 100644 --- a/src/components/StripeBankAccountTokenInputField/StripeBankAccountTokenInputField.js +++ b/src/components/StripeBankAccountTokenInputField/StripeBankAccountTokenInputField.js @@ -1,7 +1,7 @@ /* eslint-disable no-underscore-dangle */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { intlShape, injectIntl, FormattedMessage } from 'react-intl'; +import { intlShape, injectIntl, FormattedMessage } from '../../util/reactIntl'; import { Field } from 'react-final-form'; import classNames from 'classnames'; import debounce from 'lodash/debounce'; diff --git a/src/components/StripePaymentAddress/StripePaymentAddress.js b/src/components/StripePaymentAddress/StripePaymentAddress.js index b31dce65..294436a9 100644 --- a/src/components/StripePaymentAddress/StripePaymentAddress.js +++ b/src/components/StripePaymentAddress/StripePaymentAddress.js @@ -1,5 +1,5 @@ import React from 'react'; -import { intlShape } from 'react-intl'; +import { intlShape } from '../../util/reactIntl'; import { bool, object, string } from 'prop-types'; import config from '../../config'; import * as validators from '../../util/validators'; diff --git a/src/components/Topbar/Topbar.js b/src/components/Topbar/Topbar.js index 13d7b8de..9c5f09aa 100644 --- a/src/components/Topbar/Topbar.js +++ b/src/components/Topbar/Topbar.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, intlShape, injectIntl } from 'react-intl'; +import { FormattedMessage, intlShape, injectIntl } from '../../util/reactIntl'; import pickBy from 'lodash/pickBy'; import classNames from 'classnames'; import config from '../../config'; diff --git a/src/components/TopbarDesktop/TopbarDesktop.js b/src/components/TopbarDesktop/TopbarDesktop.js index 632e3faf..e38cec90 100644 --- a/src/components/TopbarDesktop/TopbarDesktop.js +++ b/src/components/TopbarDesktop/TopbarDesktop.js @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; -import { FormattedMessage, intlShape } from 'react-intl'; +import { FormattedMessage, intlShape } from '../../util/reactIntl'; import classNames from 'classnames'; import { ACCOUNT_SETTINGS_PAGES } from '../../routeConfiguration'; import { propTypes } from '../../util/types'; diff --git a/src/components/TopbarMobileMenu/TopbarMobileMenu.js b/src/components/TopbarMobileMenu/TopbarMobileMenu.js index 8c1ed145..f966ad21 100644 --- a/src/components/TopbarMobileMenu/TopbarMobileMenu.js +++ b/src/components/TopbarMobileMenu/TopbarMobileMenu.js @@ -4,7 +4,7 @@ */ import React from 'react'; import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { ACCOUNT_SETTINGS_PAGES } from '../../routeConfiguration'; import { propTypes } from '../../util/types'; diff --git a/src/components/TransactionPanel/BreakdownMaybe.js b/src/components/TransactionPanel/BreakdownMaybe.js index c2dc26d1..109af9ee 100644 --- a/src/components/TransactionPanel/BreakdownMaybe.js +++ b/src/components/TransactionPanel/BreakdownMaybe.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import config from '../../config'; import { BookingBreakdown } from '../../components'; diff --git a/src/components/TransactionPanel/FeedSection.js b/src/components/TransactionPanel/FeedSection.js index 51d7ccfb..9cf9705d 100644 --- a/src/components/TransactionPanel/FeedSection.js +++ b/src/components/TransactionPanel/FeedSection.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { ActivityFeed } from '../../components'; diff --git a/src/components/TransactionPanel/PanelHeading.js b/src/components/TransactionPanel/PanelHeading.js index 86a45dd0..189be529 100644 --- a/src/components/TransactionPanel/PanelHeading.js +++ b/src/components/TransactionPanel/PanelHeading.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { createSlug, stringify } from '../../util/urlHelpers'; import { NamedLink } from '../../components'; diff --git a/src/components/TransactionPanel/SaleActionButtonsMaybe.js b/src/components/TransactionPanel/SaleActionButtonsMaybe.js index 6951afd9..1d998af2 100644 --- a/src/components/TransactionPanel/SaleActionButtonsMaybe.js +++ b/src/components/TransactionPanel/SaleActionButtonsMaybe.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { PrimaryButton, SecondaryButton } from '../../components'; diff --git a/src/components/TransactionPanel/TransactionPanel.js b/src/components/TransactionPanel/TransactionPanel.js index 363e18f6..3f35870a 100644 --- a/src/components/TransactionPanel/TransactionPanel.js +++ b/src/components/TransactionPanel/TransactionPanel.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { array, arrayOf, bool, func, number, string } from 'prop-types'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import classNames from 'classnames'; import { TRANSITION_REQUEST_PAYMENT_AFTER_ENQUIRY, diff --git a/src/components/TransactionPanel/__snapshots__/TransactionPanel.test.js.snap b/src/components/TransactionPanel/__snapshots__/TransactionPanel.test.js.snap index 833d47d8..7b7bc168 100644 --- a/src/components/TransactionPanel/__snapshots__/TransactionPanel.test.js.snap +++ b/src/components/TransactionPanel/__snapshots__/TransactionPanel.test.js.snap @@ -41,7 +41,7 @@ exports[`TransactionPanel - Order accepted matches snapshot 1`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } @@ -83,7 +83,7 @@ exports[`TransactionPanel - Order accepted matches snapshot 1`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } @@ -708,7 +708,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i - - - - - - - - - - - - - - - - + - + diff --git a/src/containers/CheckoutPage/CheckoutPage.js b/src/containers/CheckoutPage/CheckoutPage.js index 48202d8c..9f4ddfd7 100644 --- a/src/containers/CheckoutPage/CheckoutPage.js +++ b/src/containers/CheckoutPage/CheckoutPage.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { bool, func, instanceOf, object, oneOfType, shape, string } from 'prop-types'; import { compose } from 'redux'; import { connect } from 'react-redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { withRouter } from 'react-router-dom'; import classNames from 'classnames'; import config from '../../config'; diff --git a/src/containers/CheckoutPage/__snapshots__/CheckoutPage.test.js.snap b/src/containers/CheckoutPage/__snapshots__/CheckoutPage.test.js.snap index 6e22ef14..112093b6 100644 --- a/src/containers/CheckoutPage/__snapshots__/CheckoutPage.test.js.snap +++ b/src/containers/CheckoutPage/__snapshots__/CheckoutPage.test.js.snap @@ -86,7 +86,7 @@ exports[`CheckoutPage matches snapshot 1`] = `
- - + diff --git a/src/containers/EditListingPage/EditListingPage.js b/src/containers/EditListingPage/EditListingPage.js index 04dede19..4c48832e 100644 --- a/src/containers/EditListingPage/EditListingPage.js +++ b/src/containers/EditListingPage/EditListingPage.js @@ -2,7 +2,7 @@ import React from 'react'; import { bool, func, object, shape, string, oneOf } from 'prop-types'; import { compose } from 'redux'; import { withRouter } from 'react-router-dom'; -import { intlShape, injectIntl } from 'react-intl'; +import { intlShape, injectIntl } from '../../util/reactIntl'; import { connect } from 'react-redux'; import { types as sdkTypes } from '../../util/sdkLoader'; import { diff --git a/src/containers/EditListingPage/__snapshots__/EditListingPage.test.js.snap b/src/containers/EditListingPage/__snapshots__/EditListingPage.test.js.snap index dc1bbae2..ac846bd4 100644 --- a/src/containers/EditListingPage/__snapshots__/EditListingPage.test.js.snap +++ b/src/containers/EditListingPage/__snapshots__/EditListingPage.test.js.snap @@ -6,7 +6,7 @@ exports[`EditListingPageComponent matches snapshot 1`] = ` title="EditListingPage.titleCreateListing" > - - + @@ -538,7 +538,7 @@ exports[`InboxPage matches snapshot 3`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } @@ -691,7 +691,7 @@ exports[`InboxPage matches snapshot 3`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } @@ -839,7 +839,7 @@ exports[`InboxPage matches snapshot 3`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/LandingPage/LandingPage.js b/src/containers/LandingPage/LandingPage.js index d87a1ac9..af2bc5df 100644 --- a/src/containers/LandingPage/LandingPage.js +++ b/src/containers/LandingPage/LandingPage.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { compose } from 'redux'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import { isScrollingDisabled } from '../../ducks/UI.duck'; import config from '../../config'; import { diff --git a/src/containers/LandingPage/__snapshots__/LandingPage.test.js.snap b/src/containers/LandingPage/__snapshots__/LandingPage.test.js.snap index fba8e759..bf08119a 100644 --- a/src/containers/LandingPage/__snapshots__/LandingPage.test.js.snap +++ b/src/containers/LandingPage/__snapshots__/LandingPage.test.js.snap @@ -89,7 +89,7 @@ exports[`LandingPage matches snapshot 1`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/ListingPage/ActionBarMaybe.js b/src/containers/ListingPage/ActionBarMaybe.js index 5b07d19a..8465555e 100644 --- a/src/containers/ListingPage/ActionBarMaybe.js +++ b/src/containers/ListingPage/ActionBarMaybe.js @@ -1,6 +1,6 @@ import React from 'react'; import { bool, oneOfType, object } from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { LISTING_STATE_PENDING_APPROVAL, diff --git a/src/containers/ListingPage/ListingPage.js b/src/containers/ListingPage/ListingPage.js index b956fe28..68eec5e5 100644 --- a/src/containers/ListingPage/ListingPage.js +++ b/src/containers/ListingPage/ListingPage.js @@ -1,7 +1,7 @@ /* eslint-disable jsx-a11y/no-static-element-interactions */ import React, { Component } from 'react'; import { array, arrayOf, bool, func, shape, string, oneOf } from 'prop-types'; -import { FormattedMessage, intlShape, injectIntl } from 'react-intl'; +import { FormattedMessage, intlShape, injectIntl } from '../../util/reactIntl'; import { compose } from 'redux'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; diff --git a/src/containers/ListingPage/ListingPage.test.js b/src/containers/ListingPage/ListingPage.test.js index b4c3d1fe..bedf83c3 100644 --- a/src/containers/ListingPage/ListingPage.test.js +++ b/src/containers/ListingPage/ListingPage.test.js @@ -1,6 +1,6 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { types as sdkTypes } from '../../util/sdkLoader'; import { createUser, diff --git a/src/containers/ListingPage/SectionDescriptionMaybe.js b/src/containers/ListingPage/SectionDescriptionMaybe.js index 099da686..d06d30ad 100644 --- a/src/containers/ListingPage/SectionDescriptionMaybe.js +++ b/src/containers/ListingPage/SectionDescriptionMaybe.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { richText } from '../../util/richText'; import css from './ListingPage.css'; diff --git a/src/containers/ListingPage/SectionFeaturesMaybe.js b/src/containers/ListingPage/SectionFeaturesMaybe.js index f1779203..48fc0bc0 100644 --- a/src/containers/ListingPage/SectionFeaturesMaybe.js +++ b/src/containers/ListingPage/SectionFeaturesMaybe.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { PropertyGroup } from '../../components'; import css from './ListingPage.css'; diff --git a/src/containers/ListingPage/SectionHeading.js b/src/containers/ListingPage/SectionHeading.js index 90b2d954..f64a9851 100644 --- a/src/containers/ListingPage/SectionHeading.js +++ b/src/containers/ListingPage/SectionHeading.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { InlineTextButton } from '../../components'; import { LINE_ITEM_NIGHT, LINE_ITEM_DAY } from '../../util/types'; import config from '../../config'; diff --git a/src/containers/ListingPage/SectionHostMaybe.js b/src/containers/ListingPage/SectionHostMaybe.js index 6bdefb31..2c958134 100644 --- a/src/containers/ListingPage/SectionHostMaybe.js +++ b/src/containers/ListingPage/SectionHostMaybe.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { UserCard, Modal } from '../../components'; import { EnquiryForm } from '../../forms'; diff --git a/src/containers/ListingPage/SectionImages.js b/src/containers/ListingPage/SectionImages.js index 675e09dc..a8b5227a 100644 --- a/src/containers/ListingPage/SectionImages.js +++ b/src/containers/ListingPage/SectionImages.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { ResponsiveImage, Modal, ImageCarousel } from '../../components'; import ActionBarMaybe from './ActionBarMaybe'; diff --git a/src/containers/ListingPage/SectionMapMaybe.js b/src/containers/ListingPage/SectionMapMaybe.js index 40037c4e..5458c20d 100644 --- a/src/containers/ListingPage/SectionMapMaybe.js +++ b/src/containers/ListingPage/SectionMapMaybe.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { string } from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { propTypes } from '../../util/types'; import { obfuscatedCoordinates } from '../../util/maps'; diff --git a/src/containers/ListingPage/SectionReviews.js b/src/containers/ListingPage/SectionReviews.js index 29d6fc42..4d6eb937 100644 --- a/src/containers/ListingPage/SectionReviews.js +++ b/src/containers/ListingPage/SectionReviews.js @@ -1,5 +1,5 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { Reviews } from '../../components'; import css from './ListingPage.css'; diff --git a/src/containers/ListingPage/SectionRulesMaybe.js b/src/containers/ListingPage/SectionRulesMaybe.js index b7085be7..8fc462c7 100644 --- a/src/containers/ListingPage/SectionRulesMaybe.js +++ b/src/containers/ListingPage/SectionRulesMaybe.js @@ -1,6 +1,6 @@ import React from 'react'; import { shape, string } from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import css from './SectionRulesMaybe.css'; diff --git a/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap b/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap index af79abac..aa630737 100644 --- a/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap +++ b/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap @@ -277,7 +277,7 @@ exports[`ListingPage matches snapshot 1`] = ` title="listing1 title" /> - - + diff --git a/src/containers/ManageListingsPage/ManageListingsPage.js b/src/containers/ManageListingsPage/ManageListingsPage.js index af650d6e..90dcb85d 100644 --- a/src/containers/ManageListingsPage/ManageListingsPage.js +++ b/src/containers/ManageListingsPage/ManageListingsPage.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; import { connect } from 'react-redux'; -import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { propTypes } from '../../util/types'; import { parse } from '../../util/urlHelpers'; import { isScrollingDisabled } from '../../ducks/UI.duck'; diff --git a/src/containers/ManageListingsPage/__snapshots__/ManageListingsPage.test.js.snap b/src/containers/ManageListingsPage/__snapshots__/ManageListingsPage.test.js.snap index 23d56ebb..3a0d1375 100644 --- a/src/containers/ManageListingsPage/__snapshots__/ManageListingsPage.test.js.snap +++ b/src/containers/ManageListingsPage/__snapshots__/ManageListingsPage.test.js.snap @@ -34,7 +34,7 @@ exports[`ContactDetailsPage matches snapshot 1`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/NotFoundPage/NotFoundPage.js b/src/containers/NotFoundPage/NotFoundPage.js index a94cb40d..15a04ac0 100644 --- a/src/containers/NotFoundPage/NotFoundPage.js +++ b/src/containers/NotFoundPage/NotFoundPage.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { compose } from 'redux'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; diff --git a/src/containers/NotFoundPage/__snapshots__/NotFoundPage.test.js.snap b/src/containers/NotFoundPage/__snapshots__/NotFoundPage.test.js.snap index 7e38d3eb..e4faa66e 100644 --- a/src/containers/NotFoundPage/__snapshots__/NotFoundPage.test.js.snap +++ b/src/containers/NotFoundPage/__snapshots__/NotFoundPage.test.js.snap @@ -36,7 +36,7 @@ exports[`NotFoundPageComponent matches snapshot 1`] = ` values={Object {}} />

- @@ -46,7 +46,7 @@ exports[`NotFoundPageComponent matches snapshot 1`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/PasswordChangePage/PasswordChangePage.js b/src/containers/PasswordChangePage/PasswordChangePage.js index ec7eeb45..ea8b5479 100644 --- a/src/containers/PasswordChangePage/PasswordChangePage.js +++ b/src/containers/PasswordChangePage/PasswordChangePage.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; import { connect } from 'react-redux'; -import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { propTypes } from '../../util/types'; import { isScrollingDisabled } from '../../ducks/UI.duck'; import { diff --git a/src/containers/PasswordChangePage/__snapshots__/PasswordChangePage.test.js.snap b/src/containers/PasswordChangePage/__snapshots__/PasswordChangePage.test.js.snap index 50763f24..69350a45 100644 --- a/src/containers/PasswordChangePage/__snapshots__/PasswordChangePage.test.js.snap +++ b/src/containers/PasswordChangePage/__snapshots__/PasswordChangePage.test.js.snap @@ -71,7 +71,7 @@ exports[`PasswordChangePage matches snapshot 1`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/PasswordRecoveryPage/PasswordRecoveryPage.js b/src/containers/PasswordRecoveryPage/PasswordRecoveryPage.js index 0f2ff664..7a7c02a9 100644 --- a/src/containers/PasswordRecoveryPage/PasswordRecoveryPage.js +++ b/src/containers/PasswordRecoveryPage/PasswordRecoveryPage.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; import { connect } from 'react-redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { propTypes } from '../../util/types'; import { isPasswordRecoveryEmailNotFoundError } from '../../util/errors'; import { isScrollingDisabled } from '../../ducks/UI.duck'; diff --git a/src/containers/PasswordRecoveryPage/__snapshots__/PasswordRecoveryPage.test.js.snap b/src/containers/PasswordRecoveryPage/__snapshots__/PasswordRecoveryPage.test.js.snap index 31a6afba..8ded18bb 100644 --- a/src/containers/PasswordRecoveryPage/__snapshots__/PasswordRecoveryPage.test.js.snap +++ b/src/containers/PasswordRecoveryPage/__snapshots__/PasswordRecoveryPage.test.js.snap @@ -54,7 +54,7 @@ exports[`ContactDetailsPage matches snapshot 1`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/PasswordResetPage/PasswordResetPage.js b/src/containers/PasswordResetPage/PasswordResetPage.js index 4d49862b..1fc0dba3 100644 --- a/src/containers/PasswordResetPage/PasswordResetPage.js +++ b/src/containers/PasswordResetPage/PasswordResetPage.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { compose } from 'redux'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { propTypes } from '../../util/types'; import { parse } from '../../util/urlHelpers'; import { isScrollingDisabled } from '../../ducks/UI.duck'; diff --git a/src/containers/PaymentMethodsPage/PaymentMethodsPage.js b/src/containers/PaymentMethodsPage/PaymentMethodsPage.js index 4f50334c..1d0d4288 100644 --- a/src/containers/PaymentMethodsPage/PaymentMethodsPage.js +++ b/src/containers/PaymentMethodsPage/PaymentMethodsPage.js @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { bool, func, object } from 'prop-types'; import { compose } from 'redux'; import { connect } from 'react-redux'; -import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { ensureCurrentUser, ensureStripeCustomer, ensurePaymentMethodCard } from '../../util/data'; import { propTypes } from '../../util/types'; import { savePaymentMethod, deletePaymentMethod } from '../../ducks/paymentMethods.duck'; diff --git a/src/containers/PayoutPreferencesPage/PayoutPreferencesPage.js b/src/containers/PayoutPreferencesPage/PayoutPreferencesPage.js index 15120fc5..ee5cda05 100644 --- a/src/containers/PayoutPreferencesPage/PayoutPreferencesPage.js +++ b/src/containers/PayoutPreferencesPage/PayoutPreferencesPage.js @@ -2,7 +2,7 @@ import React from 'react'; import { bool, func } from 'prop-types'; import { compose } from 'redux'; import { connect } from 'react-redux'; -import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { ensureCurrentUser } from '../../util/data'; import { propTypes } from '../../util/types'; import { isScrollingDisabled } from '../../ducks/UI.duck'; diff --git a/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap b/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap index 4caa8b6a..d9d5a6e5 100644 --- a/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap +++ b/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap @@ -49,7 +49,7 @@ exports[`PayoutPreferencesPage matches snapshot with Stripe connected 1`] = ` className={null} rootClassName={null} > - + @@ -98,7 +98,7 @@ exports[`PayoutPreferencesPage matches snapshot with Stripe not connected 1`] = values={Object {}} />

- - + @@ -168,7 +168,7 @@ exports[`PayoutPreferencesPage matches snapshot with details submitted 1`] = ` values={Object {}} />

- - + diff --git a/src/containers/PrivacyPolicyPage/PrivacyPolicyPage.js b/src/containers/PrivacyPolicyPage/PrivacyPolicyPage.js index 464ece07..d9a919c7 100644 --- a/src/containers/PrivacyPolicyPage/PrivacyPolicyPage.js +++ b/src/containers/PrivacyPolicyPage/PrivacyPolicyPage.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; import { connect } from 'react-redux'; -import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { isScrollingDisabled } from '../../ducks/UI.duck'; import { TopbarContainer } from '../../containers'; import { diff --git a/src/containers/ProfilePage/ProfilePage.js b/src/containers/ProfilePage/ProfilePage.js index 71f009ce..ca0298df 100644 --- a/src/containers/ProfilePage/ProfilePage.js +++ b/src/containers/ProfilePage/ProfilePage.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { compose } from 'redux'; import { connect } from 'react-redux'; import classNames from 'classnames'; diff --git a/src/containers/ProfilePage/__snapshots__/ProfilePage.test.js.snap b/src/containers/ProfilePage/__snapshots__/ProfilePage.test.js.snap index 55f1ead5..311ca367 100644 --- a/src/containers/ProfilePage/__snapshots__/ProfilePage.test.js.snap +++ b/src/containers/ProfilePage/__snapshots__/ProfilePage.test.js.snap @@ -118,7 +118,7 @@ exports[`ProfilePage matches snapshot 1`] = ` ] } /> - @@ -128,7 +128,7 @@ exports[`ProfilePage matches snapshot 1`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/ProfileSettingsPage/ProfileSettingsPage.js b/src/containers/ProfileSettingsPage/ProfileSettingsPage.js index db8918a2..bd8ddd39 100644 --- a/src/containers/ProfileSettingsPage/ProfileSettingsPage.js +++ b/src/containers/ProfileSettingsPage/ProfileSettingsPage.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; import { connect } from 'react-redux'; -import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { propTypes } from '../../util/types'; import { ensureCurrentUser } from '../../util/data'; import { isScrollingDisabled } from '../../ducks/UI.duck'; diff --git a/src/containers/ProfileSettingsPage/__snapshots__/ProfileSettingsPage.test.js.snap b/src/containers/ProfileSettingsPage/__snapshots__/ProfileSettingsPage.test.js.snap index 01f89d96..5c779d3d 100644 --- a/src/containers/ProfileSettingsPage/__snapshots__/ProfileSettingsPage.test.js.snap +++ b/src/containers/ProfileSettingsPage/__snapshots__/ProfileSettingsPage.test.js.snap @@ -41,7 +41,7 @@ exports[`ContactDetailsPage matches snapshot 1`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/SearchPage/MainPanel.js b/src/containers/SearchPage/MainPanel.js index cf52c449..a06e4730 100644 --- a/src/containers/SearchPage/MainPanel.js +++ b/src/containers/SearchPage/MainPanel.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { array, bool, func, number, object, objectOf, string } from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import merge from 'lodash/merge'; import { propTypes } from '../../util/types'; diff --git a/src/containers/SearchPage/SearchPage.js b/src/containers/SearchPage/SearchPage.js index 9cad11f2..0e0bf575 100644 --- a/src/containers/SearchPage/SearchPage.js +++ b/src/containers/SearchPage/SearchPage.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { array, bool, func, number, oneOf, object, shape, string } from 'prop-types'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import { connect } from 'react-redux'; import { compose } from 'redux'; import { withRouter } from 'react-router-dom'; diff --git a/src/containers/TermsOfServicePage/TermsOfServicePage.js b/src/containers/TermsOfServicePage/TermsOfServicePage.js index 015c28ea..74b54f13 100644 --- a/src/containers/TermsOfServicePage/TermsOfServicePage.js +++ b/src/containers/TermsOfServicePage/TermsOfServicePage.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; import { connect } from 'react-redux'; -import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { isScrollingDisabled } from '../../ducks/UI.duck'; import { TopbarContainer } from '../../containers'; import { diff --git a/src/containers/TransactionPage/TransactionPage.js b/src/containers/TransactionPage/TransactionPage.js index 02106187..804a3510 100644 --- a/src/containers/TransactionPage/TransactionPage.js +++ b/src/containers/TransactionPage/TransactionPage.js @@ -4,7 +4,7 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; import classNames from 'classnames'; -import { FormattedMessage, intlShape, injectIntl } from 'react-intl'; +import { FormattedMessage, intlShape, injectIntl } from '../../util/reactIntl'; import { createResourceLocatorString, findRouteByRouteName } from '../../util/routes'; import routeConfiguration from '../../routeConfiguration'; import { propTypes } from '../../util/types'; diff --git a/src/containers/TransactionPage/__snapshots__/TransactionPage.test.js.snap b/src/containers/TransactionPage/__snapshots__/TransactionPage.test.js.snap index 6ab1bd50..ad4fca73 100644 --- a/src/containers/TransactionPage/__snapshots__/TransactionPage.test.js.snap +++ b/src/containers/TransactionPage/__snapshots__/TransactionPage.test.js.snap @@ -20,7 +20,7 @@ exports[`TransactionPage - Order matches snapshot 1`] = ` rootClassName={null} >
- - + @@ -244,7 +244,7 @@ exports[`TransactionPage - Sale matches snapshot 1`] = ` rootClassName={null} >
- - + diff --git a/src/forms/BookingDatesForm/BookingDatesForm.js b/src/forms/BookingDatesForm/BookingDatesForm.js index 1f978cd2..5c022e12 100644 --- a/src/forms/BookingDatesForm/BookingDatesForm.js +++ b/src/forms/BookingDatesForm/BookingDatesForm.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { string, bool, arrayOf } from 'prop-types'; import { compose } from 'redux'; import { Form as FinalForm } from 'react-final-form'; -import { FormattedMessage, intlShape, injectIntl } from 'react-intl'; +import { FormattedMessage, intlShape, injectIntl } from '../../util/reactIntl'; import classNames from 'classnames'; import moment from 'moment'; import { required, bookingDatesRequired, composeValidators } from '../../util/validators'; diff --git a/src/forms/BookingDatesForm/__snapshots__/BookingDatesForm.test.js.snap b/src/forms/BookingDatesForm/__snapshots__/BookingDatesForm.test.js.snap index dc0e85b0..fab92d53 100644 --- a/src/forms/BookingDatesForm/__snapshots__/BookingDatesForm.test.js.snap +++ b/src/forms/BookingDatesForm/__snapshots__/BookingDatesForm.test.js.snap @@ -12,7 +12,7 @@ exports[`BookingDatesForm matches snapshot without selected dates 1`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } diff --git a/src/forms/ContactDetailsForm/ContactDetailsForm.js b/src/forms/ContactDetailsForm/ContactDetailsForm.js index b4ae414d..a2b0caa0 100644 --- a/src/forms/ContactDetailsForm/ContactDetailsForm.js +++ b/src/forms/ContactDetailsForm/ContactDetailsForm.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { Form as FinalForm } from 'react-final-form'; import isEqual from 'lodash/isEqual'; import classNames from 'classnames'; diff --git a/src/forms/EditListingAvailabilityForm/EditListingAvailabilityForm.js b/src/forms/EditListingAvailabilityForm/EditListingAvailabilityForm.js index 12a076f8..6324cdd0 100644 --- a/src/forms/EditListingAvailabilityForm/EditListingAvailabilityForm.js +++ b/src/forms/EditListingAvailabilityForm/EditListingAvailabilityForm.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { bool, func, object, string } from 'prop-types'; import { compose } from 'redux'; import { Form as FinalForm } from 'react-final-form'; -import { intlShape, injectIntl, FormattedMessage } from 'react-intl'; +import { intlShape, injectIntl, FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { propTypes } from '../../util/types'; import { Form, Button } from '../../components'; diff --git a/src/forms/EditListingAvailabilityForm/ManageAvailabilityCalendar.js b/src/forms/EditListingAvailabilityForm/ManageAvailabilityCalendar.js index 41efae9f..4b270b2e 100644 --- a/src/forms/EditListingAvailabilityForm/ManageAvailabilityCalendar.js +++ b/src/forms/EditListingAvailabilityForm/ManageAvailabilityCalendar.js @@ -6,7 +6,7 @@ import { isInclusivelyBeforeDay, isInclusivelyAfterDay, } from 'react-dates'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import memoize from 'lodash/memoize'; import classNames from 'classnames'; import moment from 'moment'; diff --git a/src/forms/EditListingAvailabilityForm/__snapshots__/EditListingAvailabilityForm.test.js.snap b/src/forms/EditListingAvailabilityForm/__snapshots__/EditListingAvailabilityForm.test.js.snap index be2742fc..c420ea48 100644 --- a/src/forms/EditListingAvailabilityForm/__snapshots__/EditListingAvailabilityForm.test.js.snap +++ b/src/forms/EditListingAvailabilityForm/__snapshots__/EditListingAvailabilityForm.test.js.snap @@ -54,7 +54,7 @@ exports[`EditListingAvailabilityForm matches snapshot 1`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } diff --git a/src/forms/EditListingDescriptionForm/EditListingDescriptionForm.js b/src/forms/EditListingDescriptionForm/EditListingDescriptionForm.js index 6d94f725..f2dc009f 100644 --- a/src/forms/EditListingDescriptionForm/EditListingDescriptionForm.js +++ b/src/forms/EditListingDescriptionForm/EditListingDescriptionForm.js @@ -2,7 +2,7 @@ import React from 'react'; import { arrayOf, bool, func, shape, string } from 'prop-types'; import { compose } from 'redux'; import { Form as FinalForm } from 'react-final-form'; -import { intlShape, injectIntl, FormattedMessage } from 'react-intl'; +import { intlShape, injectIntl, FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { propTypes } from '../../util/types'; import { maxLength, required, composeValidators } from '../../util/validators'; diff --git a/src/forms/EditListingFeaturesForm/EditListingFeaturesForm.js b/src/forms/EditListingFeaturesForm/EditListingFeaturesForm.js index 1820910d..c92da320 100644 --- a/src/forms/EditListingFeaturesForm/EditListingFeaturesForm.js +++ b/src/forms/EditListingFeaturesForm/EditListingFeaturesForm.js @@ -3,7 +3,7 @@ import { bool, func, shape, string } from 'prop-types'; import classNames from 'classnames'; import { Form as FinalForm } from 'react-final-form'; import arrayMutators from 'final-form-arrays'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import { propTypes } from '../../util/types'; import config from '../../config'; diff --git a/src/forms/EditListingLocationForm/EditListingLocationForm.js b/src/forms/EditListingLocationForm/EditListingLocationForm.js index c4126c9a..108d8da2 100644 --- a/src/forms/EditListingLocationForm/EditListingLocationForm.js +++ b/src/forms/EditListingLocationForm/EditListingLocationForm.js @@ -2,7 +2,7 @@ import React from 'react'; import { bool, func, shape, string } from 'prop-types'; import { compose } from 'redux'; import { Form as FinalForm } from 'react-final-form'; -import { intlShape, injectIntl, FormattedMessage } from 'react-intl'; +import { intlShape, injectIntl, FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { propTypes } from '../../util/types'; import { diff --git a/src/forms/EditListingLocationForm/__snapshots__/EditListingLocationForm.test.js.snap b/src/forms/EditListingLocationForm/__snapshots__/EditListingLocationForm.test.js.snap index ef131e56..042fcfb6 100644 --- a/src/forms/EditListingLocationForm/__snapshots__/EditListingLocationForm.test.js.snap +++ b/src/forms/EditListingLocationForm/__snapshots__/EditListingLocationForm.test.js.snap @@ -11,7 +11,7 @@ exports[`EditListingLocationForm matches snapshot 1`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } diff --git a/src/forms/EditListingPhotosForm/EditListingPhotosForm.js b/src/forms/EditListingPhotosForm/EditListingPhotosForm.js index b5f77c06..67b62697 100644 --- a/src/forms/EditListingPhotosForm/EditListingPhotosForm.js +++ b/src/forms/EditListingPhotosForm/EditListingPhotosForm.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { array, bool, func, shape, string } from 'prop-types'; import { compose } from 'redux'; import { Form as FinalForm, Field } from 'react-final-form'; -import { FormattedMessage, intlShape, injectIntl } from 'react-intl'; +import { FormattedMessage, intlShape, injectIntl } from '../../util/reactIntl'; import isEqual from 'lodash/isEqual'; import classNames from 'classnames'; import { propTypes } from '../../util/types'; diff --git a/src/forms/EditListingPhotosForm/__snapshots__/EditListingPhotosForm.test.js.snap b/src/forms/EditListingPhotosForm/__snapshots__/EditListingPhotosForm.test.js.snap index 4c0fadb9..029cb95e 100644 --- a/src/forms/EditListingPhotosForm/__snapshots__/EditListingPhotosForm.test.js.snap +++ b/src/forms/EditListingPhotosForm/__snapshots__/EditListingPhotosForm.test.js.snap @@ -18,7 +18,7 @@ exports[`EditListingPhotosForm matches snapshot 1`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } diff --git a/src/forms/EditListingPoliciesForm/EditListingPoliciesForm.js b/src/forms/EditListingPoliciesForm/EditListingPoliciesForm.js index af62bc3c..1099274e 100644 --- a/src/forms/EditListingPoliciesForm/EditListingPoliciesForm.js +++ b/src/forms/EditListingPoliciesForm/EditListingPoliciesForm.js @@ -2,7 +2,7 @@ import React from 'react'; import { bool, func, shape, string } from 'prop-types'; import { compose } from 'redux'; import { Form as FinalForm } from 'react-final-form'; -import { intlShape, injectIntl, FormattedMessage } from 'react-intl'; +import { intlShape, injectIntl, FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import { propTypes } from '../../util/types'; import { Form, Button, FieldTextInput } from '../../components'; diff --git a/src/forms/EditListingPoliciesForm/__snapshots__/EditListingPoliciesForm.test.js.snap b/src/forms/EditListingPoliciesForm/__snapshots__/EditListingPoliciesForm.test.js.snap index 9610a342..6b703bb3 100644 --- a/src/forms/EditListingPoliciesForm/__snapshots__/EditListingPoliciesForm.test.js.snap +++ b/src/forms/EditListingPoliciesForm/__snapshots__/EditListingPoliciesForm.test.js.snap @@ -10,7 +10,7 @@ exports[`EditListingPoliciesForm matches snapshot 1`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } diff --git a/src/forms/EditListingPricingForm/EditListingPricingForm.js b/src/forms/EditListingPricingForm/EditListingPricingForm.js index 19fad266..9149bd44 100644 --- a/src/forms/EditListingPricingForm/EditListingPricingForm.js +++ b/src/forms/EditListingPricingForm/EditListingPricingForm.js @@ -2,7 +2,7 @@ import React from 'react'; import { bool, func, shape, string } from 'prop-types'; import { compose } from 'redux'; import { Form as FinalForm } from 'react-final-form'; -import { intlShape, injectIntl, FormattedMessage } from 'react-intl'; +import { intlShape, injectIntl, FormattedMessage } from '../../util/reactIntl'; import classNames from 'classnames'; import config from '../../config'; import { LINE_ITEM_NIGHT, LINE_ITEM_DAY, propTypes } from '../../util/types'; diff --git a/src/forms/EmailVerificationForm/EmailVerificationForm.js b/src/forms/EmailVerificationForm/EmailVerificationForm.js index 41b670fb..a2302798 100644 --- a/src/forms/EmailVerificationForm/EmailVerificationForm.js +++ b/src/forms/EmailVerificationForm/EmailVerificationForm.js @@ -1,7 +1,7 @@ import React from 'react'; import { bool } from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, injectIntl } from 'react-intl'; +import { FormattedMessage, injectIntl } from '../../util/reactIntl'; import { Form as FinalForm, Field } from 'react-final-form'; import { Form, diff --git a/src/forms/EnquiryForm/EnquiryForm.js b/src/forms/EnquiryForm/EnquiryForm.js index ac3831f5..0bc44b57 100644 --- a/src/forms/EnquiryForm/EnquiryForm.js +++ b/src/forms/EnquiryForm/EnquiryForm.js @@ -1,7 +1,7 @@ import React from 'react'; import { string, bool } from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { Form as FinalForm } from 'react-final-form'; import classNames from 'classnames'; import { Form, PrimaryButton, FieldTextInput, IconEnquiry } from '../../components'; diff --git a/src/forms/FilterForm/FilterForm.js b/src/forms/FilterForm/FilterForm.js index 3b8cfc6f..cd825200 100644 --- a/src/forms/FilterForm/FilterForm.js +++ b/src/forms/FilterForm/FilterForm.js @@ -3,7 +3,7 @@ import { bool, func, node, object } from 'prop-types'; import classNames from 'classnames'; import { Form as FinalForm, FormSpy } from 'react-final-form'; import arrayMutators from 'final-form-arrays'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import { Form } from '../../components'; import css from './FilterForm.css'; diff --git a/src/forms/LocationSearchForm/LocationSearchForm.js b/src/forms/LocationSearchForm/LocationSearchForm.js index 0d0d619e..84edf7f9 100644 --- a/src/forms/LocationSearchForm/LocationSearchForm.js +++ b/src/forms/LocationSearchForm/LocationSearchForm.js @@ -1,7 +1,7 @@ import React from 'react'; import { func, string } from 'prop-types'; import { Form as FinalForm, Field } from 'react-final-form'; -import { intlShape, injectIntl } from 'react-intl'; +import { intlShape, injectIntl } from '../../util/reactIntl'; import classNames from 'classnames'; import { Form, LocationAutocompleteInput } from '../../components'; diff --git a/src/forms/LoginForm/LoginForm.js b/src/forms/LoginForm/LoginForm.js index 17e5dece..c596e1f3 100644 --- a/src/forms/LoginForm/LoginForm.js +++ b/src/forms/LoginForm/LoginForm.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { Form as FinalForm } from 'react-final-form'; import classNames from 'classnames'; import { Form, PrimaryButton, FieldTextInput, NamedLink } from '../../components'; diff --git a/src/forms/PasswordChangeForm/PasswordChangeForm.js b/src/forms/PasswordChangeForm/PasswordChangeForm.js index 5df3eaa8..3b103913 100644 --- a/src/forms/PasswordChangeForm/PasswordChangeForm.js +++ b/src/forms/PasswordChangeForm/PasswordChangeForm.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { Form as FinalForm } from 'react-final-form'; import isEqual from 'lodash/isEqual'; import classNames from 'classnames'; diff --git a/src/forms/PasswordRecoveryForm/PasswordRecoveryForm.js b/src/forms/PasswordRecoveryForm/PasswordRecoveryForm.js index 8c7b823d..796e548c 100644 --- a/src/forms/PasswordRecoveryForm/PasswordRecoveryForm.js +++ b/src/forms/PasswordRecoveryForm/PasswordRecoveryForm.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { Form as FinalForm } from 'react-final-form'; import isEqual from 'lodash/isEqual'; import classNames from 'classnames'; diff --git a/src/forms/PasswordResetForm/PasswordResetForm.js b/src/forms/PasswordResetForm/PasswordResetForm.js index d300b2a2..3967d071 100644 --- a/src/forms/PasswordResetForm/PasswordResetForm.js +++ b/src/forms/PasswordResetForm/PasswordResetForm.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { Form as FinalForm } from 'react-final-form'; import classNames from 'classnames'; import { Form, PrimaryButton, FieldTextInput } from '../../components'; diff --git a/src/forms/PaymentMethodsForm/PaymentMethodsForm.js b/src/forms/PaymentMethodsForm/PaymentMethodsForm.js index 632f2c5c..46b3cf58 100644 --- a/src/forms/PaymentMethodsForm/PaymentMethodsForm.js +++ b/src/forms/PaymentMethodsForm/PaymentMethodsForm.js @@ -5,7 +5,7 @@ */ import React, { Component } from 'react'; import { bool, func, object, string } from 'prop-types'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { Form as FinalForm } from 'react-final-form'; import classNames from 'classnames'; import config from '../../config'; diff --git a/src/forms/PayoutDetailsForm/PayoutDetailsAccountOpener.js b/src/forms/PayoutDetailsForm/PayoutDetailsAccountOpener.js index d73e7f19..72780596 100644 --- a/src/forms/PayoutDetailsForm/PayoutDetailsAccountOpener.js +++ b/src/forms/PayoutDetailsForm/PayoutDetailsAccountOpener.js @@ -1,6 +1,6 @@ import React from 'react'; import { bool, object, string } from 'prop-types'; -import { FormattedMessage, intlShape } from 'react-intl'; +import { FormattedMessage, intlShape } from '../../util/reactIntl'; import PayoutDetailsAddress from './PayoutDetailsAddress'; import PayoutDetailsPersonalDetails from './PayoutDetailsPersonalDetails'; diff --git a/src/forms/PayoutDetailsForm/PayoutDetailsAdditionalPersons.js b/src/forms/PayoutDetailsForm/PayoutDetailsAdditionalPersons.js index 9ee6bcac..b6a35194 100644 --- a/src/forms/PayoutDetailsForm/PayoutDetailsAdditionalPersons.js +++ b/src/forms/PayoutDetailsForm/PayoutDetailsAdditionalPersons.js @@ -1,6 +1,6 @@ import React from 'react'; import { bool, func, object, string } from 'prop-types'; -import { FormattedMessage, intlShape } from 'react-intl'; +import { FormattedMessage, intlShape } from '../../util/reactIntl'; import { FieldArray } from 'react-final-form-arrays'; import { ExternalLink, IconAdd, IconClose, InlineTextButton } from '../../components'; diff --git a/src/forms/PayoutDetailsForm/PayoutDetailsAddress.js b/src/forms/PayoutDetailsForm/PayoutDetailsAddress.js index 51a63184..89e2e0b4 100644 --- a/src/forms/PayoutDetailsForm/PayoutDetailsAddress.js +++ b/src/forms/PayoutDetailsForm/PayoutDetailsAddress.js @@ -1,5 +1,5 @@ import React from 'react'; -import { intlShape } from 'react-intl'; +import { intlShape } from '../../util/reactIntl'; import { bool, object, string } from 'prop-types'; import * as validators from '../../util/validators'; import { FieldSelect, FieldTextInput } from '../../components'; diff --git a/src/forms/PayoutDetailsForm/PayoutDetailsBankDetails.js b/src/forms/PayoutDetailsForm/PayoutDetailsBankDetails.js index 0243a827..014617f2 100644 --- a/src/forms/PayoutDetailsForm/PayoutDetailsBankDetails.js +++ b/src/forms/PayoutDetailsForm/PayoutDetailsBankDetails.js @@ -1,6 +1,6 @@ import React from 'react'; import { bool, string } from 'prop-types'; -import { FormattedMessage } from 'react-intl'; +import { FormattedMessage } from '../../util/reactIntl'; import * as validators from '../../util/validators'; import { StripeBankAccountTokenInputField } from '../../components'; diff --git a/src/forms/PayoutDetailsForm/PayoutDetailsBusinessProfile.js b/src/forms/PayoutDetailsForm/PayoutDetailsBusinessProfile.js index 08dae1fb..27214f25 100644 --- a/src/forms/PayoutDetailsForm/PayoutDetailsBusinessProfile.js +++ b/src/forms/PayoutDetailsForm/PayoutDetailsBusinessProfile.js @@ -1,6 +1,6 @@ import React from 'react'; import { bool, string } from 'prop-types'; -import { intlShape } from 'react-intl'; +import { intlShape } from '../../util/reactIntl'; import * as validators from '../../util/validators'; import { FieldSelect, FieldTextInput } from '../../components'; diff --git a/src/forms/PayoutDetailsForm/PayoutDetailsCompany.js b/src/forms/PayoutDetailsForm/PayoutDetailsCompany.js index e0f5385d..82670689 100644 --- a/src/forms/PayoutDetailsForm/PayoutDetailsCompany.js +++ b/src/forms/PayoutDetailsForm/PayoutDetailsCompany.js @@ -1,6 +1,6 @@ import React from 'react'; import { bool, string } from 'prop-types'; -import { FormattedMessage, intlShape } from 'react-intl'; +import { FormattedMessage, intlShape } from '../../util/reactIntl'; import * as validators from '../../util/validators'; import { FieldPhoneNumberInput, FieldTextInput } from '../../components'; diff --git a/src/forms/PayoutDetailsForm/PayoutDetailsCompanyAccount.js b/src/forms/PayoutDetailsForm/PayoutDetailsCompanyAccount.js index 5a82addf..b3fa7a56 100644 --- a/src/forms/PayoutDetailsForm/PayoutDetailsCompanyAccount.js +++ b/src/forms/PayoutDetailsForm/PayoutDetailsCompanyAccount.js @@ -1,7 +1,7 @@ import React from 'react'; import { bool, object, shape } from 'prop-types'; import { compose } from 'redux'; -import { injectIntl, intlShape } from 'react-intl'; +import { injectIntl, intlShape } from '../../util/reactIntl'; import PayoutDetailsAddress from './PayoutDetailsAddress'; import PayoutDetailsCompany from './PayoutDetailsCompany'; diff --git a/src/forms/PayoutDetailsForm/PayoutDetailsForm.js b/src/forms/PayoutDetailsForm/PayoutDetailsForm.js index acbd2e32..0930b7b0 100644 --- a/src/forms/PayoutDetailsForm/PayoutDetailsForm.js +++ b/src/forms/PayoutDetailsForm/PayoutDetailsForm.js @@ -1,7 +1,7 @@ import React from 'react'; import { bool, func, object, shape, string } from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { Form as FinalForm } from 'react-final-form'; import arrayMutators from 'final-form-arrays'; import classNames from 'classnames'; diff --git a/src/forms/PayoutDetailsForm/PayoutDetailsIndividualAccount.js b/src/forms/PayoutDetailsForm/PayoutDetailsIndividualAccount.js index bbaa2a6a..4558d9ff 100644 --- a/src/forms/PayoutDetailsForm/PayoutDetailsIndividualAccount.js +++ b/src/forms/PayoutDetailsForm/PayoutDetailsIndividualAccount.js @@ -1,7 +1,7 @@ import React from 'react'; import { bool, object, shape } from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import config from '../../config'; import routeConfiguration from '../../routeConfiguration'; import { propTypes } from '../../util/types'; diff --git a/src/forms/PayoutDetailsForm/PayoutDetailsPersonalDetails.js b/src/forms/PayoutDetailsForm/PayoutDetailsPersonalDetails.js index 372cada2..51da8339 100644 --- a/src/forms/PayoutDetailsForm/PayoutDetailsPersonalDetails.js +++ b/src/forms/PayoutDetailsForm/PayoutDetailsPersonalDetails.js @@ -1,6 +1,6 @@ import React from 'react'; import { bool, node, object, oneOf, string } from 'prop-types'; -import { FormattedMessage, intlShape } from 'react-intl'; +import { FormattedMessage, intlShape } from '../../util/reactIntl'; import * as validators from '../../util/validators'; import { FieldBirthdayInput, FieldCheckbox, FieldTextInput } from '../../components'; diff --git a/src/forms/PriceFilterForm/PriceFilterForm.js b/src/forms/PriceFilterForm/PriceFilterForm.js index 5981123d..efedfa14 100644 --- a/src/forms/PriceFilterForm/PriceFilterForm.js +++ b/src/forms/PriceFilterForm/PriceFilterForm.js @@ -3,7 +3,7 @@ import { bool, func, number, object, string } from 'prop-types'; import classNames from 'classnames'; import debounce from 'lodash/debounce'; import { Field, Form as FinalForm, FormSpy } from 'react-final-form'; -import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { Form, RangeSlider } from '../../components'; import css from './PriceFilterForm.css'; diff --git a/src/forms/ProfileSettingsForm/ProfileSettingsForm.js b/src/forms/ProfileSettingsForm/ProfileSettingsForm.js index 6e8fb664..9bac23ca 100644 --- a/src/forms/ProfileSettingsForm/ProfileSettingsForm.js +++ b/src/forms/ProfileSettingsForm/ProfileSettingsForm.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { bool, string } from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { Field, Form as FinalForm } from 'react-final-form'; import isEqual from 'lodash/isEqual'; import classNames from 'classnames'; diff --git a/src/forms/ReviewForm/ReviewForm.js b/src/forms/ReviewForm/ReviewForm.js index caf7c5e3..ccb38df0 100644 --- a/src/forms/ReviewForm/ReviewForm.js +++ b/src/forms/ReviewForm/ReviewForm.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { Form as FinalForm } from 'react-final-form'; import classNames from 'classnames'; import { isTransactionsTransitionAlreadyReviewed } from '../../util/errors'; diff --git a/src/forms/SendMessageForm/SendMessageForm.js b/src/forms/SendMessageForm/SendMessageForm.js index 821802d8..d996aa68 100644 --- a/src/forms/SendMessageForm/SendMessageForm.js +++ b/src/forms/SendMessageForm/SendMessageForm.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { string, bool, func } from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { Form as FinalForm } from 'react-final-form'; import classNames from 'classnames'; import { Form, FieldTextInput, SecondaryButton } from '../../components'; diff --git a/src/forms/SignupForm/SignupForm.js b/src/forms/SignupForm/SignupForm.js index becfb7af..4ff6f788 100644 --- a/src/forms/SignupForm/SignupForm.js +++ b/src/forms/SignupForm/SignupForm.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { compose } from 'redux'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { Form as FinalForm } from 'react-final-form'; import classNames from 'classnames'; import * as validators from '../../util/validators'; diff --git a/src/forms/StripePaymentForm/StripePaymentForm.js b/src/forms/StripePaymentForm/StripePaymentForm.js index bf5e1059..ba001d71 100644 --- a/src/forms/StripePaymentForm/StripePaymentForm.js +++ b/src/forms/StripePaymentForm/StripePaymentForm.js @@ -5,7 +5,7 @@ */ import React, { Component } from 'react'; import { bool, func, object, string } from 'prop-types'; -import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; +import { FormattedMessage, injectIntl, intlShape } from '../../util/reactIntl'; import { Form as FinalForm } from 'react-final-form'; import classNames from 'classnames'; import config from '../../config'; diff --git a/src/forms/TopbarSearchForm/TopbarSearchForm.js b/src/forms/TopbarSearchForm/TopbarSearchForm.js index 65c93057..4ec26bdf 100644 --- a/src/forms/TopbarSearchForm/TopbarSearchForm.js +++ b/src/forms/TopbarSearchForm/TopbarSearchForm.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Form as FinalForm, Field } from 'react-final-form'; -import { intlShape, injectIntl } from 'react-intl'; +import { intlShape, injectIntl } from '../../util/reactIntl'; import classNames from 'classnames'; import { Form, LocationAutocompleteInput } from '../../components'; diff --git a/src/util/dates.js b/src/util/dates.js index 5599df18..36072147 100644 --- a/src/util/dates.js +++ b/src/util/dates.js @@ -166,7 +166,10 @@ export const formatDate = (intl, todayString, d) => { if (!paramsValid) { throw new Error(`Invalid params for formatDate: (${intl}, ${todayString}, ${d})`); } - const now = moment(intl.now()); + + // By default we can use moment() directly but in tests we need to use a specific dates. + // fakeIntl used in tests contains now() function wich returns predefined date + const now = intl.now ? moment(intl.now()) : moment(); const formattedTime = intl.formatTime(d); let formattedDate; diff --git a/src/util/polyfills.js b/src/util/polyfills.js index 1f102c15..66028df6 100644 --- a/src/util/polyfills.js +++ b/src/util/polyfills.js @@ -33,3 +33,20 @@ if (typeof Number.isNaN === 'undefined') { // eslint-disable-next-line no-self-compare Number.isNaN = value => value !== value; } + +// To support browsers that do not have Intl.PluralRules (e.g IE11 & Safari 12-), include this polyfill in your build. + +if (!Intl.PluralRules) { + require('intl-pluralrules'); +} + +// To support browsers that do not have Intl.RelativeTimeFormat (e.g IE11, Edge, Safari 12-), include this polyfill in your build along with individual CLDR data for each locale you support. +if (!Intl.RelativeTimeFormat) { + require('@formatjs/intl-relativetimeformat/polyfill'); + require('@formatjs/intl-relativetimeformat/dist/include-aliases'); // Optional, if you care about edge cases in locale resolution, e.g zh-CN -> zh-Hans-CN + require('@formatjs/intl-relativetimeformat/dist/locale-data/en'); + + // By default, this library comes with en data. To load additional locale, you need include them on demand. + // e.g. + require('@formatjs/intl-relativetimeformat/dist/locale-data/fr'); +} diff --git a/src/util/reactIntl.js b/src/util/reactIntl.js new file mode 100644 index 00000000..398b8a4f --- /dev/null +++ b/src/util/reactIntl.js @@ -0,0 +1,26 @@ +import { func, shape } from 'prop-types'; +import { + IntlProvider, + FormattedMessage, + FormattedDate, + FormattedHTMLMessage, + injectIntl, +} from 'react-intl'; + +const intlShape = shape({ + formatDate: func.isRequired, + formatHTMLMessage: func.isRequired, + formatMessage: func.isRequired, + formatNumber: func.isRequired, + formatPlural: func.isRequired, + formatRelativeTime: func.isRequired, + formatTime: func.isRequired, +}); +export { + IntlProvider, + FormattedMessage, + FormattedDate, + FormattedHTMLMessage, + injectIntl, + intlShape, +}; diff --git a/src/util/test-data.js b/src/util/test-data.js index 62484c47..0ba077ee 100644 --- a/src/util/test-data.js +++ b/src/util/test-data.js @@ -294,7 +294,7 @@ export const fakeIntl = { formatMessage: msg => msg.id, formatNumber: d => d, formatPlural: d => d, - formatRelative: d => d, + formatRelativeTime: d => d, formatTime: d => `${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}`, now: () => Date.UTC(2017, 10, 23, 12, 59), }; diff --git a/src/util/test-helpers.js b/src/util/test-helpers.js index 2b288bd5..e24681ac 100644 --- a/src/util/test-helpers.js +++ b/src/util/test-helpers.js @@ -3,11 +3,10 @@ import mapValues from 'lodash/mapValues'; import Enzyme, { shallow, mount } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; import toJson from 'enzyme-to-json'; -import { IntlProvider, addLocaleData } from 'react-intl'; -import en from 'react-intl/locale-data/en'; import { BrowserRouter } from 'react-router-dom'; import { Provider } from 'react-redux'; import configureStore from '../store'; +import { IntlProvider } from './reactIntl'; // In case you have translated the template and have new translations that // are missing from the en translations file, the language for the tests can @@ -24,9 +23,8 @@ const testMessages = mapValues(messages, (val, key) => key); // store, i18n, router, etc. export const TestProvider = props => { const store = configureStore(); - addLocaleData([...en]); return ( - + {props.children} diff --git a/yarn.lock b/yarn.lock index 14b53c13..ba91a765 100644 --- a/yarn.lock +++ b/yarn.lock @@ -835,6 +835,20 @@ resolved "https://registry.yarnpkg.com/@csstools/normalize.css/-/normalize.css-9.0.1.tgz#c27b391d8457d1e893f1eddeaf5e5412d12ffbb5" integrity sha512-6It2EVfGskxZCQhuykrfnALg7oVeiI6KclWSmGDqB0AiInVrTGB9Jp9i4/Ad21u9Jde/voVQz6eFX/eSg/UsPA== +"@formatjs/intl-relativetimeformat@^2.8.2": + version "2.8.2" + resolved "https://registry.yarnpkg.com/@formatjs/intl-relativetimeformat/-/intl-relativetimeformat-2.8.2.tgz#b137c0333716e88c49c0f56e35edeadbcc170a12" + integrity sha512-ZsEpxaDkTv4Zrr6+yrMCcxRFAdE5nfraNVy2HLc51SYGiUO99BM/RPot1+Mb7whUrtjvjnYkzWMYOD0jxQmTMg== + dependencies: + "@formatjs/intl-utils" "^0.6.1" + +"@formatjs/intl-utils@^0.6.1": + version "0.6.1" + resolved "https://registry.yarnpkg.com/@formatjs/intl-utils/-/intl-utils-0.6.1.tgz#7661afd5abb2161dc8ac92238be9432aee28ad38" + integrity sha512-CthSQc/GV94y0cdMpTM69cwH98T/qx9twaZZXh9VZ6B0nL+2KptE5fXqcde4ffrHMZx1bPZJTIpwky4X1Is00A== + dependencies: + date-fns "^2.0.0" + "@hapi/address@2.x.x": version "2.0.0" resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.0.0.tgz#9f05469c88cb2fd3dcd624776b54ee95c312126a" @@ -1242,6 +1256,19 @@ resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== +"@types/hoist-non-react-statics@^3.3.1": + version "3.3.1" + resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f" + integrity sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA== + dependencies: + "@types/react" "*" + hoist-non-react-statics "^3.3.0" + +"@types/invariant@^2.2.30": + version "2.2.30" + resolved "https://registry.yarnpkg.com/@types/invariant/-/invariant-2.2.30.tgz#20efa342807606ada5483731a8137cb1561e5fe9" + integrity sha512-98fB+yo7imSD2F7PF7GIpELNgtLNgo5wjivu0W5V4jx+KVVJxo6p/qN4zdzSTBWy4/sN3pPyXwnhRSD28QX+ag== + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" @@ -1272,11 +1299,24 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.2.tgz#c4e63af5e8823ce9cc3f0b34f7b998c2171f0c44" integrity sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg== +"@types/prop-types@*": + version "15.7.1" + resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.1.tgz#f1a11e7babb0c3cad68100be381d1e064c68f1f6" + integrity sha512-CFzn9idOEpHrgdw8JsoTkaDDyRWk1jrzIV8djzcgpq0y9tG4B4lFT+Nxh52DVpDXV+n4+NPNv7M1Dj5uMp6XFg== + "@types/q@^1.5.1": version "1.5.2" resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.2.tgz#690a1475b84f2a884fd07cd797c00f5f31356ea8" integrity sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw== +"@types/react@*": + version "16.9.2" + resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.2.tgz#6d1765431a1ad1877979013906731aae373de268" + integrity sha512-jYP2LWwlh+FTqGd9v7ynUKZzjj98T8x7Yclz479QdRhHfuW9yQ+0jjnD31eXSXutmBpppj5PYNLYLRfnZJvcfg== + dependencies: + "@types/prop-types" "*" + csstype "^2.2.0" + "@types/stack-utils@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" @@ -3299,6 +3339,11 @@ cssstyle@^1.0.0, cssstyle@^1.1.1: dependencies: cssom "0.3.x" +csstype@^2.2.0: + version "2.6.6" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.6.tgz#c34f8226a94bbb10c32cc0d714afdf942291fc41" + integrity sha512-RpFbQGUE74iyPgvr46U9t1xoQBM8T4BL8SxrN66Le2xYAPSaDJJKeztV3awugusb3g3G9iL8StmkBBXhcbbXhg== + currently-unhandled@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" @@ -3345,6 +3390,11 @@ data-urls@^1.0.0, data-urls@^1.1.0: whatwg-mimetype "^2.2.0" whatwg-url "^7.0.0" +date-fns@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.1.tgz#c5f30e31d3294918e6b6a82753a4e719120e203d" + integrity sha512-C14oTzTZy8DH1Eq8N78owrCWvf3+cnJw88BTK/N3DYWVxDJuJzPaNdplzYxDYuuXXGvqBcO4Vy5SOrwAooXSWw== + date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" @@ -4738,6 +4788,11 @@ fsevents@^1.2.7: nan "^2.12.1" node-pre-gyp "^0.12.0" +full-icu@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/full-icu/-/full-icu-1.3.0.tgz#1fb4d60050103ad9dcf53735c000e4a03d80c574" + integrity sha512-LGLpSsbkHUT0T+EKrIJltYoejYzUqg1eW+n6wm/FTte1pDiYjeKTxO0uJvrE3jgv6V9eBzMAjF6A8jH16C0+eQ== + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -5557,29 +5612,35 @@ internal-ip@^4.2.0: default-gateway "^4.2.0" ipaddr.js "^1.9.0" -intl-format-cache@^2.0.5: - version "2.1.0" - resolved "https://registry.yarnpkg.com/intl-format-cache/-/intl-format-cache-2.1.0.tgz#04a369fecbfad6da6005bae1f14333332dcf9316" - integrity sha1-BKNp/sv61tpgBbrh8UMzMy3PkxY= +intl-format-cache@^4.1.15: + version "4.1.15" + resolved "https://registry.yarnpkg.com/intl-format-cache/-/intl-format-cache-4.1.15.tgz#325e6e45656ac12aa7ba528a800a57b0ee9c799a" + integrity sha512-b/wDoQRAV0wzwmYMMmUGt36pXNxTq4I4KVJa0q1CTvex2dsCpivCFwLcf44D+fhFQ09LMxq9a+P9F+4CYXTDIg== -intl-messageformat-parser@1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/intl-messageformat-parser/-/intl-messageformat-parser-1.4.0.tgz#b43d45a97468cadbe44331d74bb1e8dea44fc075" - integrity sha1-tD1FqXRoytvkQzHXS7Ho3qRPwHU= +intl-locales-supported@^1.4.5: + version "1.4.5" + resolved "https://registry.yarnpkg.com/intl-locales-supported/-/intl-locales-supported-1.4.5.tgz#be9774e6d4ea518f000165ecfe78c78d5bee7de5" + integrity sha512-D7oriM5x46rd7kNlSW0f9noIBegFr3ReIM6xlMpwH4lfIPD/zvBelPlCjR10IK16boGJG9lKccOvRAM8wzpbrA== -intl-messageformat@^2.0.0, intl-messageformat@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-2.2.0.tgz#345bcd46de630b7683330c2e52177ff5eab484fc" - integrity sha1-NFvNRt5jC3aDMwwuUhd/9eq0hPw= +intl-messageformat-parser@^3.0.7: + version "3.0.7" + resolved "https://registry.yarnpkg.com/intl-messageformat-parser/-/intl-messageformat-parser-3.0.7.tgz#d28493501a1bc40a094239b7ef26fe9412558e72" + integrity sha512-L16VbbV3NFaiZV65XwOIH9fBe52TS2EkOR0k8Y4ratsgTE7KPEbcUCUrz/iEQwJo7BcWY4ohkZbeYZRgAiPR1Q== + +intl-messageformat@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-7.1.0.tgz#496965b200cbf273096c0a0da8a54c7a206653e6" + integrity sha512-T4uj8B5rABJ27ugLYSsJ30sNBUJe3uHGinIDmFI6W7jUOV6UOOOWKIhaLqgjO3Jav1UMEVvN5ti6O1+fP1/2eg== dependencies: - intl-messageformat-parser "1.4.0" + intl-format-cache "^4.1.15" + intl-messageformat-parser "^3.0.7" -intl-relativeformat@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/intl-relativeformat/-/intl-relativeformat-2.1.0.tgz#010f1105802251f40ac47d0e3e1a201348a255df" - integrity sha1-AQ8RBYAiUfQKxH0OPhogE0iiVd8= +intl-pluralrules@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/intl-pluralrules/-/intl-pluralrules-1.0.3.tgz#25438469f76fd13a4ac54a68a0ae4c0d30248a47" + integrity sha512-N+q+NmxJD5Pi+h7DoemDcNZN86e1dPSFUsWUtYtnSc/fKRen4vxCTcsmGveWOUgI9O9uSLTaiwJpC9f5xa2X4w== dependencies: - intl-messageformat "^2.0.0" + make-plural "^4.3.0" invariant@2.2.4, invariant@^2.1.1, invariant@^2.2.1, invariant@^2.2.2, invariant@^2.2.4: version "2.2.4" @@ -6875,6 +6936,13 @@ make-dir@^2.0.0, make-dir@^2.1.0: pify "^4.0.1" semver "^5.6.0" +make-plural@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/make-plural/-/make-plural-4.3.0.tgz#f23de08efdb0cac2e0c9ba9f315b0dff6b4c2735" + integrity sha512-xTYd4JVHpSCW+aqDof6w/MebaMVNTVYBZhbB/vi513xXdiPT92JMVCo0Jq8W2UZnzYRFeVbQiQ+I25l13JuKvA== + optionalDependencies: + minimist "^1.2.0" + makeerror@1.0.x: version "1.0.11" resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" @@ -9189,16 +9257,21 @@ react-helmet-async@^1.0.2: react-fast-compare "2.0.4" shallowequal "1.1.0" -react-intl@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/react-intl/-/react-intl-2.9.0.tgz#c97c5d17d4718f1575fdbd5a769f96018a3b1843" - integrity sha512-27jnDlb/d2A7mSJwrbOBnUgD+rPep+abmoJE511Tf8BnoONIAUehy/U1zZCHGO17mnOwMWxqN4qC0nW11cD6rA== +react-intl@^3.1.13: + version "3.1.13" + resolved "https://registry.yarnpkg.com/react-intl/-/react-intl-3.1.13.tgz#21e7ee63033b3a0b5b8bb13a402408ea4738767d" + integrity sha512-dmkf4rm3HbT4xIL1SOhcruEOQZ7h+llmqN1bV9M13wYKLgalCU+WuMjET/ihyXT+2FupPZDRZ0JPX0xeqsXNog== dependencies: + "@formatjs/intl-relativetimeformat" "^2.8.2" + "@types/hoist-non-react-statics" "^3.3.1" + "@types/invariant" "^2.2.30" hoist-non-react-statics "^3.3.0" - intl-format-cache "^2.0.5" - intl-messageformat "^2.1.0" - intl-relativeformat "^2.1.0" + intl-format-cache "^4.1.15" + intl-locales-supported "^1.4.5" + intl-messageformat "^7.1.0" + intl-messageformat-parser "^3.0.7" invariant "^2.1.1" + shallow-equal "^1.1.0" react-is@^16.6.0, react-is@^16.7.0: version "16.8.6" @@ -10042,6 +10115,11 @@ shallow-clone@^3.0.0: dependencies: kind-of "^6.0.2" +shallow-equal@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shallow-equal/-/shallow-equal-1.2.0.tgz#fd828d2029ff4e19569db7e19e535e94e2d1f5cc" + integrity sha512-Z21pVxR4cXsfwpMKMhCEIO1PCi5sp7KEp+CmOpBQ+E8GpHwKOw2sEzk7sgblM3d/j4z4gakoWEoPcjK0VJQogA== + shallowequal@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8"