mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
Merge pull request #963 from sharetribe/update-sdk
Update JS SDK to 1.2
This commit is contained in:
commit
361b1b0559
8 changed files with 38 additions and 30 deletions
|
|
@ -11,7 +11,6 @@ REACT_APP_MAPBOX_ACCESS_TOKEN=
|
|||
# Defaults
|
||||
#
|
||||
|
||||
REACT_APP_SHARETRIBE_SDK_BASE_URL=https://flex-api.sharetribe.com
|
||||
REACT_APP_SHARETRIBE_MARKETPLACE_CURRENCY=USD
|
||||
REACT_APP_CANONICAL_ROOT_URL=http://localhost:3000
|
||||
|
||||
|
|
@ -32,6 +31,7 @@ REACT_APP_ENV=production
|
|||
# BASIC_AUTH_USERNAME=sharetribe
|
||||
# BASIC_AUTH_PASSWORD=secret
|
||||
# REACT_APP_GOOGLE_ANALYTICS_ID=change-me
|
||||
# REACT_APP_SHARETRIBE_SDK_BASE_URL=change-me
|
||||
|
||||
|
||||
# Features
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ way to update this template, but currently, we follow a pattern:
|
|||
|
||||
## Upcoming version 2018-11-XX
|
||||
|
||||
* [change] Update Flex JS SDK to 1.2.
|
||||
[#963](https://github.com/sharetribe/flex-template-web/pull/963)
|
||||
* [add] Add French as a default language in addition to English.
|
||||
[#962](https://github.com/sharetribe/flex-template-web/pull/962)
|
||||
* [fix] Show Stripe error message on CheckoutPage if payment request fails because of Stripe error.
|
||||
|
|
|
|||
44
docs/env.md
44
docs/env.md
|
|
@ -3,28 +3,28 @@
|
|||
The following configuration variables can be set to control the Flex template app behaviour. Most of
|
||||
them have defaults that work for development environment. For production deploys most should be set.
|
||||
|
||||
| Variable | Description |
|
||||
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
||||
| REACT_APP_MAPBOX_ACCESS_TOKEN | See: [Integrating to map providers](./map-providers.md) |
|
||||
| REACT_APP_GOOGLE_MAPS_API_KEY | See: [Google Maps API key](./google-maps.md) (Alternative map provider) |
|
||||
| REACT_APP_SHARETRIBE_SDK_CLIENT_ID | Client ID (API key). You will get this from the Sharetribe team. |
|
||||
| REACT_APP_STRIPE_PUBLISHABLE_KEY | Stripe publishable API key for generating tokens with Stripe API. Use test key (prefix pk*test*) for development. |
|
||||
| REACT_APP_SHARETRIBE_SDK_BASE_URL | The base url to access the Sharetribe Flex Marketplace API. |
|
||||
| REACT_APP_SHARETRIBE_MARKETPLACE_CURRENCY | The currency used in the Marketplace as ISO 4217 currency code. For example: USD, EUR, CAD, AUD, etc. |
|
||||
| REACT_APP_CANONICAL_ROOT_URL | Canonical root url of the marketplace. Needed for social media sharing and SEO optimization. |
|
||||
| NODE_ENV | Node env. Use 'development' for development and 'production' for production. |
|
||||
| PORT | Port for server to accept connections. |
|
||||
| REACT_APP_ENV | A more fine grained env definition than NODE_ENV. Is used for example to differentiate envs in logging. |
|
||||
| REACT_APP_SHARETRIBE_USING_SSL | Redirect HTTP to HTTPS? |
|
||||
| SERVER_SHARETRIBE_TRUST_PROXY | Set when running the app behind a reverse proxy, e.g. in Heroku. |
|
||||
| REACT_APP_PUBLIC_SENTRY_DSN | See: [Error logging with Sentry](./sentry.md) |
|
||||
| SERVER_SENTRY_DSN | See: [Error logging with Sentry](./sentry.md) |
|
||||
| REACT_APP_CSP | See: [Content Security Policy (CSP)](./content-security-policy.md) |
|
||||
| BASIC_AUTH_USERNAME | Set to enable HTTP Basic Auth |
|
||||
| BASIC_AUTH_PASSWORD | Set to enable HTTP Basic Auth |
|
||||
| REACT_APP_GOOGLE_ANALYTICS_ID | See: [Google Analytics](./analytics.md) |
|
||||
| REACT_APP_AVAILABILITY_ENABLED | Enables availability calendar for listings. |
|
||||
| REACT_APP_DEFAULT_SEARCHES_ENABLED | Enables default search suggestions in location autocomplete search input. |
|
||||
| Variable | Description |
|
||||
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
||||
| REACT_APP_MAPBOX_ACCESS_TOKEN | See: [Integrating to map providers](./map-providers.md) |
|
||||
| REACT_APP_GOOGLE_MAPS_API_KEY | See: [Google Maps API key](./google-maps.md) (Alternative map provider) |
|
||||
| REACT_APP_SHARETRIBE_SDK_CLIENT_ID | Client ID (API key). You will get this from the Sharetribe team. |
|
||||
| REACT_APP_STRIPE_PUBLISHABLE_KEY | Stripe publishable API key for generating tokens with Stripe API. Use test key (prefix pk*test*) for development. |
|
||||
| REACT_APP_SHARETRIBE_MARKETPLACE_CURRENCY | The currency used in the Marketplace as ISO 4217 currency code. For example: USD, EUR, CAD, AUD, etc. |
|
||||
| REACT_APP_CANONICAL_ROOT_URL | Canonical root url of the marketplace. Needed for social media sharing and SEO optimization. |
|
||||
| NODE_ENV | Node env. Use 'development' for development and 'production' for production. |
|
||||
| PORT | Port for server to accept connections. |
|
||||
| REACT_APP_ENV | A more fine grained env definition than NODE_ENV. Is used for example to differentiate envs in logging. |
|
||||
| REACT_APP_SHARETRIBE_USING_SSL | Redirect HTTP to HTTPS? |
|
||||
| SERVER_SHARETRIBE_TRUST_PROXY | Set when running the app behind a reverse proxy, e.g. in Heroku. |
|
||||
| REACT_APP_PUBLIC_SENTRY_DSN | See: [Error logging with Sentry](./sentry.md) |
|
||||
| SERVER_SENTRY_DSN | See: [Error logging with Sentry](./sentry.md) |
|
||||
| REACT_APP_CSP | See: [Content Security Policy (CSP)](./content-security-policy.md) |
|
||||
| BASIC_AUTH_USERNAME | Set to enable HTTP Basic Auth |
|
||||
| BASIC_AUTH_PASSWORD | Set to enable HTTP Basic Auth |
|
||||
| REACT_APP_GOOGLE_ANALYTICS_ID | See: [Google Analytics](./analytics.md) |
|
||||
| REACT_APP_AVAILABILITY_ENABLED | Enables availability calendar for listings. |
|
||||
| REACT_APP_DEFAULT_SEARCHES_ENABLED | Enables default search suggestions in location autocomplete search input. |
|
||||
| REACT_APP_SHARETRIBE_SDK_BASE_URL | The base url to access the Sharetribe Flex Marketplace API. FTW uses the correct one by default so no need to set this. |
|
||||
|
||||
## Defining configuration
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
"redux-thunk": "^2.2.0",
|
||||
"sanitize.css": "^5.0.0",
|
||||
"seedrandom": "^2.4.3",
|
||||
"sharetribe-flex-sdk": "^1.1.0",
|
||||
"sharetribe-flex-sdk": "^1.2.0",
|
||||
"sharetribe-scripts": "1.1.5",
|
||||
"smoothscroll-polyfill": "^0.4.0",
|
||||
"source-map-support": "^0.5.4",
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ const unsafeEval = "'unsafe-eval'";
|
|||
const data = 'data:';
|
||||
const blob = 'blob:';
|
||||
const devImagesMaybe = dev ? ['*.localhost:8000'] : [];
|
||||
const baseUrl = process.env.REACT_APP_SHARETRIBE_SDK_BASE_URL || 'https://flex-api.sharetribe.com';
|
||||
|
||||
// Default CSP whitelist.
|
||||
//
|
||||
|
|
@ -18,7 +19,7 @@ const defaultDirectives = {
|
|||
childSrc: [blob],
|
||||
connectSrc: [
|
||||
self,
|
||||
process.env.REACT_APP_SHARETRIBE_SDK_BASE_URL,
|
||||
baseUrl,
|
||||
'maps.googleapis.com',
|
||||
'*.tiles.mapbox.com',
|
||||
'api.mapbox.com',
|
||||
|
|
|
|||
|
|
@ -167,10 +167,11 @@ app.get('*', (req, res) => {
|
|||
secure: USING_SSL,
|
||||
});
|
||||
|
||||
const baseUrl = BASE_URL ? { baseUrl: BASE_URL } : {};
|
||||
|
||||
const sdk = sharetribeSdk.createInstance({
|
||||
transitVerbose: TRANSIT_VERBOSE,
|
||||
clientId: CLIENT_ID,
|
||||
baseUrl: BASE_URL,
|
||||
httpAgent: httpAgent,
|
||||
httpsAgent: httpsAgent,
|
||||
tokenStore,
|
||||
|
|
@ -182,6 +183,7 @@ app.get('*', (req, res) => {
|
|||
reader: v => new Decimal(v.value),
|
||||
},
|
||||
],
|
||||
...baseUrl,
|
||||
});
|
||||
|
||||
// Until we have a better plan for caching dynamic content and we
|
||||
|
|
|
|||
|
|
@ -77,13 +77,14 @@ if (typeof window !== 'undefined') {
|
|||
// set up logger with Sentry DSN client key and environment
|
||||
log.setup();
|
||||
|
||||
const baseUrl = config.sdk.baseUrl ? { baseUrl: config.sdk.baseUrl } : {};
|
||||
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
const preloadedState = window.__PRELOADED_STATE__ || '{}';
|
||||
const initialState = JSON.parse(preloadedState, sdkTypes.reviver);
|
||||
const sdk = createInstance({
|
||||
transitVerbose: config.sdk.transitVerbose,
|
||||
clientId: config.sdk.clientId,
|
||||
baseUrl: config.sdk.baseUrl,
|
||||
secure: config.usingSSL,
|
||||
typeHandlers: [
|
||||
{
|
||||
|
|
@ -93,6 +94,7 @@ if (typeof window !== 'undefined') {
|
|||
reader: v => new Decimal(v.value),
|
||||
},
|
||||
],
|
||||
...baseUrl,
|
||||
});
|
||||
const analyticsHandlers = setupAnalyticsHandlers();
|
||||
const store = configureStore(initialState, sdk, analyticsHandlers);
|
||||
|
|
|
|||
|
|
@ -7533,9 +7533,10 @@ shallowequal@^0.2.2:
|
|||
dependencies:
|
||||
lodash.keys "^3.1.2"
|
||||
|
||||
sharetribe-flex-sdk@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/sharetribe-flex-sdk/-/sharetribe-flex-sdk-1.1.0.tgz#13cc5120b6c0709b20a2ff275c1496184b2e7255"
|
||||
sharetribe-flex-sdk@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/sharetribe-flex-sdk/-/sharetribe-flex-sdk-1.2.0.tgz#8600d57a23bf693dddec49080e526cca664cb4a5"
|
||||
integrity sha512-1fywSn+FI/0sqnEmT5O6PHd/DK2Y1uKPNV6MzKgQ1hpz3RTVkxL96g6Fj6MF6QP3xs/T81lQxoekZ3Bp2HyKeQ==
|
||||
dependencies:
|
||||
axios "^0.18.0"
|
||||
js-cookie "^2.1.3"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue