-
Notifications
You must be signed in to change notification settings - Fork 940
/
config.js
376 lines (340 loc) · 9.96 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
import * as custom from './marketplace-custom-config.js';
import defaultLocationSearches from './default-location-searches';
const env = process.env.REACT_APP_ENV;
const dev = process.env.REACT_APP_ENV === 'development';
// If you want to change the language, remember to also change the
// locale data and the messages in the app.js file.
const locale = 'en';
const i18n = {
/*
0: Sunday
1: Monday
...
6: Saturday
*/
firstDayOfWeek: 0,
};
// Should search results be ordered by distance to origin.
const sortSearchByDistance = false;
// API supports custom processes to be used in booking process.
// We need to specify it when we are initiating a new order
// (or fetching price information by calling 'initiateSpeculative' endpoint).
//
// In a way, 'processAlias' defines which transaction process (or processes)
// this particular web application is able to handle.
const bookingProcessAlias = 'preauth-with-nightly-booking/release-1';
// The transaction line item code for the main unit type in bookings.
//
// Possible values: ['line-item/night', 'line-item/day', 'line-item/units';]
//
// Note: if you change this, many of the generic translations will
// still show information about nights. Make sure to go through the
// translations when the unit is changed.
const bookingUnitType = 'line-item/night';
// Should the application fetch available time slots (currently defined as
// start and end dates) to be shown on listing page.
const fetchAvailableTimeSlots = process.env.REACT_APP_AVAILABILITY_ENABLED === 'true';
// A maximum number of days forwards during which a booking can be made.
// This is limited due to Stripe holding funds up to 90 days from the
// moment they are charged. Also note that available time slots can only
// be fetched for 180 days in the future.
const dayCountAvailableForBooking = 90;
// To pass environment variables to the client app in the build
// script, react-scripts (and the sharetribe-scripts fork of
// react-scripts) require using the REACT_APP_ prefix to avoid
// exposing server secrets to the client side.
const sdkClientId = process.env.REACT_APP_SHARETRIBE_SDK_CLIENT_ID;
const sdkBaseUrl = process.env.REACT_APP_SHARETRIBE_SDK_BASE_URL;
const sdkTransitVerbose = process.env.REACT_APP_SHARETRIBE_SDK_TRANSIT_VERBOSE === 'true';
const currency = process.env.REACT_APP_SHARETRIBE_MARKETPLACE_CURRENCY;
// Listing minimum price in currency sub units, e.g. cents.
// 0 means no restriction to the price
const listingMinimumPriceSubUnits = 0;
// Sentry DSN (Data Source Name), a client key for authenticating calls to Sentry
const sentryDsn = process.env.REACT_APP_PUBLIC_SENTRY_DSN;
// If webapp is using SSL (i.e. it's behind 'https' protocol)
const usingSSL = process.env.REACT_APP_SHARETRIBE_USING_SSL === 'true';
// Currency formatting options.
// See: https://github.com/yahoo/react-intl/wiki/API#formatnumber
//
// TODO: Remove this and hide formating within the util/currency module
const currencyConfig = {
style: 'currency',
currency,
currencyDisplay: 'symbol',
useGrouping: true,
minimumFractionDigits: 2,
maximumFractionDigits: 2,
};
const stripePublishableKey = process.env.REACT_APP_STRIPE_PUBLISHABLE_KEY;
// Stripe only supports payments in certain countries, see full list
// at https://stripe.com/global
//
// We currently only support EU countries, US, and AU.
const stripeSupportedCountries = [
{
// Australia
code: 'AU',
currency: 'AUD',
payoutAddressRequired: false,
accountConfig: {
bsb: true,
accountNumber: true,
},
},
{
// Austria
code: 'AT',
currency: 'EUR',
payoutAddressRequired: true,
accountConfig: {
iban: true,
},
},
{
// Belgium
code: 'BE',
currency: 'EUR',
payoutAddressRequired: true,
accountConfig: {
iban: true,
},
},
{
// Denmark
code: 'DK',
currency: 'DKK',
payoutAddressRequired: true,
accountConfig: {
iban: true,
},
},
{
// Finland
code: 'FI',
currency: 'EUR',
payoutAddressRequired: true,
accountConfig: {
iban: true,
},
},
{
// France
code: 'FR',
currency: 'EUR',
payoutAddressRequired: true,
accountConfig: {
iban: true,
},
},
{
// Germany
code: 'DE',
currency: 'EUR',
payoutAddressRequired: true,
accountConfig: {
iban: true,
},
},
{
// Ireland
code: 'IE',
currency: 'EUR',
payoutAddressRequired: true,
accountConfig: {
iban: true,
},
},
{
// Italy
code: 'IT',
currency: 'EUR',
payoutAddressRequired: true,
accountConfig: {
iban: true,
},
},
{
// Luxembourg
code: 'LU',
currency: 'EUR',
payoutAddressRequired: true,
accountConfig: {
iban: true,
},
},
{
// Netherlands
code: 'NL',
currency: 'EUR',
payoutAddressRequired: true,
accountConfig: {
iban: true,
},
},
{
// Portugal
code: 'PT',
currency: 'EUR',
payoutAddressRequired: true,
accountConfig: {
iban: true,
},
},
{
// Spain
code: 'ES',
currency: 'EUR',
payoutAddressRequired: true,
accountConfig: {
iban: true,
},
},
{
// Sweden
code: 'SE',
currency: 'SEK',
payoutAddressRequired: true,
accountConfig: {
iban: true,
},
},
{
// United Kingdom
code: 'GB',
currency: 'GBP',
payoutAddressRequired: true,
accountConfig: {
sortCode: true,
accountNumber: true,
},
},
{
// United States
code: 'US',
currency: 'USD',
payoutAddressRequired: false,
accountConfig: {
routingNumber: true,
accountNumber: true,
},
},
];
// Address information is used in SEO schema for Organization (http://schema.org/PostalAddress)
const addressCountry = 'FI';
const addressRegion = 'Helsinki';
const postalCode = '00100';
const streetAddress = 'Bulevardi 14';
// Canonical root url is needed in social media sharing and SEO optimization purposes.
const canonicalRootURL = process.env.REACT_APP_CANONICAL_ROOT_URL;
// Site title is needed in meta tags (bots and social media sharing reads those)
const siteTitle = 'Saunatime';
// Twitter handle is needed in meta tags (twitter:site). Start it with '@' character
const siteTwitterHandle = '@sharetribe';
// Instagram page is used in SEO schema (http://schema.org/Organization)
const siteInstagramPage = null;
// Facebook page is used in SEO schema (http://schema.org/Organization)
const siteFacebookPage = 'https://www.facebook.com/Sharetribe/';
// Facebook counts shares with app or page associated by this id
// Currently it is unset, but you can read more about fb:app_id from
// https://developers.facebook.com/docs/sharing/webmasters#basic
// You should create one to track social sharing in Facebook
const facebookAppId = null;
const maps = {
mapboxAccessToken: process.env.REACT_APP_MAPBOX_ACCESS_TOKEN,
googleMapsAPIKey: process.env.REACT_APP_GOOGLE_MAPS_API_KEY,
// The location search input can be configured to show default
// searches when the user focuses on the input and hasn't yet typed
// anything. This reduces typing and avoids too many Geolocation API
// calls for common searches.
search: {
// When enabled, the first suggestion is "Current location" that
// uses the browser Geolocation API to query the user's current
// location.
suggestCurrentLocation: process.env.REACT_APP_DEFAULT_SEARCHES_ENABLED === 'true',
// Distance in meters for calculating the bounding box around the
// current location.
currentLocationBoundsDistance: 1000,
// Example location can be edited in the
// `default-location-searches.js` file.
defaults:
process.env.REACT_APP_DEFAULT_SEARCHES_ENABLED === 'true' ? defaultLocationSearches : [],
},
// When fuzzy locations are enabled, coordinates on maps are
// obfuscated randomly around the actual location.
//
// NOTE: This only hides the locations in the UI level, the actual
// coordinates are still accessible in the HTTP requests and the
// Redux store.
fuzzy: {
enabled: false,
// Amount of maximum offset in meters that is applied to obfuscate
// the original coordinates. The actual value is random, but the
// obfuscated coordinates are withing a circle that has the same
// radius as the offset.
offset: 500,
// Default zoom level when showing a single circle on a Map. Should
// be small enough so the whole circle fits in.
defaultZoomLevel: 13,
// Color of the circle on the Map component.
circleColor: '#c0392b',
},
// Custom marker image to use in the Map component.
//
// NOTE: Not used if fuzzy locations are enabled.
customMarker: {
enabled: false,
// Publicly accessible URL for the custom marker image.
//
// The easiest place is /public/static/icons/ folder, but then the
// marker image is not available while developing through
// localhost.
url: encodeURI(`${canonicalRootURL}/static/icons/map-marker-32x32.png`),
// Dimensions of the marker image.
width: 32,
height: 32,
// Position to anchor the image in relation to the coordinates,
// ignored when using Mapbox.
anchorX: 16,
anchorY: 32,
},
};
// NOTE: only expose configuration that should be visible in the
// client side, don't add any server secrets in this file.
const config = {
env,
dev,
locale,
bookingProcessAlias,
bookingUnitType,
fetchAvailableTimeSlots,
dayCountAvailableForBooking,
i18n,
sdk: {
clientId: sdkClientId,
baseUrl: sdkBaseUrl,
transitVerbose: sdkTransitVerbose,
},
sortSearchByDistance,
currency,
listingMinimumPriceSubUnits,
currencyConfig,
stripe: { publishableKey: stripePublishableKey, supportedCountries: stripeSupportedCountries },
canonicalRootURL,
address: {
addressCountry,
addressRegion,
postalCode,
streetAddress,
},
siteTitle,
siteFacebookPage,
siteInstagramPage,
siteTwitterHandle,
facebookAppId,
sentryDsn,
usingSSL,
maps,
custom,
};
export default config;