Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[feat] Introduce Foursquare cloud provider (#2437)

Giuseppe Macrìd60ef31dca67
diff --git a/docs/api-reference/cloud-providers/README.md b/docs/api-reference/cloud-providers/README.md
index 1b8a8e733..726b9180a 100644
--- a/docs/api-reference/cloud-providers/README.md
+++ b/docs/api-reference/cloud-providers/README.md
@@ -43,20 +43,21 @@ An instance of the provider is added to array of cloud providers in the file `sr
import {Provider} from 'kepler.gl/cloud-providers';
class MyProvider extends Provider {
- constructor() {
- this.name = 'foo';
- this.displayName = 'My Provider';
- }
- // ... other required methods below
+ constructor() {
+ this.name = 'foo';
+ this.displayName = 'My Provider';
+ }
+
+ // ... other required methods below
}
const myProvider = new MyProvider();
const App = () =>
- <KeplerGl
- mapboxApiAccessToken={AUTH_TOKENS.MAPBOX_TOKEN}
- id="map"
- cloudProviders={[myProvider]}
- />
+ <KeplerGl
+ mapboxApiAccessToken={CLOUD_PROVIDERS_CONFIGURATION.MAPBOX_TOKEN}
+ id="map"
+ cloudProviders={[myProvider]}
+ />
```
diff --git a/docs/api-reference/cloud-providers/cloud-provider.md b/docs/api-reference/cloud-providers/cloud-provider.md
index 03b5a6b43..434ad758f 100644
--- a/docs/api-reference/cloud-providers/cloud-provider.md
+++ b/docs/api-reference/cloud-providers/cloud-provider.md
@@ -23,9 +23,9 @@ The default provider class
**Parameters**
-- `props` **[object][27]**
- - `props.name` **[string][28]**
- - `props.displayName` **[string][28]**
+- `props` **[object][27]**
+ - `props.name` **[string][28]**
+ - `props.displayName` **[string][28]**
- `props.icon` **ReactElement** React element
- `props.thumbnail` **[object][27]** thumbnail size object
- `props.thumbnail.width` **[number][29]** thumbnail width in pixels
@@ -111,13 +111,13 @@ Returns **[string][28]** true if a user already logged in
Whether this provider support upload map to a private storage. If truthy, user will be displayed with the storage save icon on the top right of the side bar.
-Returns **[boolean][31]**
+Returns **[boolean][31]**
### hasSharingUrl
Whether this provider support share map via a public url, if truthy, user will be displayed with a share map via url under the export map option on the top right of the side bar
-Returns **[boolean][31]**
+Returns **[boolean][31]**
### listMaps
@@ -133,7 +133,7 @@ async listMaps() {
title: 'My map',
description: 'My first kepler map',
imageUrl: 'http://',
- lastModification: 1582677787000,
+ udpatedAt: 1582677787000,
privateMap: false,
loadParams: {}
}
@@ -168,7 +168,7 @@ With the option to overwrite already saved map, and upload as private or public
**Parameters**
-- `param` **[Object][27]**
+- `param` **[Object][27]**
- `param.mapData` **[Object][27]** the map object
- `param.mapData.map` **[Object][27]** {datasets. config, info: {title, description}}
- `param.mapData.thumbnail` **[Blob][35]** A thumbnail of current map. thumbnail size can be defined by provider by this.thumbnail
@@ -186,10 +186,10 @@ Type: [Object][27]
### Properties
-- `map` **[Object][27]**
- - `map.datasets` **[Array][32]&lt;[Object][27]>**
- - `map.config` **[Object][27]**
- - `map.info` **[Object][27]**
+- `map` **[Object][27]**
+ - `map.datasets` **[Array][32]&lt;[Object][27]>**
+ - `map.config` **[Object][27]**
+ - `map.info` **[Object][27]**
- `format` **[string][28]** one of 'csv': csv file string, 'geojson': geojson object, 'row': row object, 'keplergl': datasets array saved using KeplerGlSchema.save
## Viz
diff --git a/examples/demo-app/package.json b/examples/demo-app/package.json
index 86e3cfa20..32544e2e9 100644
--- a/examples/demo-app/package.json
+++ b/examples/demo-app/package.json
@@ -10,6 +10,7 @@
"start-local-https": "webpack-dev-server --mode development --https --env.es6 --progress --hot --open"
},
"dependencies": {
+ "@auth0/auth0-spa-js": "^2.1.2",
"@carto/toolkit": "0.0.1-rc.18",
"@kepler.gl/actions": "^3.0.0-alpha.1",
"@kepler.gl/components": "^3.0.0-alpha.1",
diff --git a/examples/demo-app/src/app.js b/examples/demo-app/src/app.js
index f5e94d727..e8a7e7f37 100644
--- a/examples/demo-app/src/app.js
+++ b/examples/demo-app/src/app.js
@@ -30,7 +30,7 @@ import Announcement, {FormLink} from './components/announcement';
import {replaceLoadDataModal} from './factories/load-data-modal';
import {replaceMapControl} from './factories/map-control';
import {replacePanelHeader} from './factories/panel-header';
-import {AUTH_TOKENS, DEFAULT_FEATURE_FLAGS} from './constants/default-settings';
+import {CLOUD_PROVIDERS_CONFIGURATION, DEFAULT_FEATURE_FLAGS} from './constants/default-settings';
import {messages} from './constants/localization';
import {
@@ -429,7 +429,7 @@ class App extends Component {
<AutoSizer>
{({height, width}) => (
<KeplerGl
- mapboxApiAccessToken={AUTH_TOKENS.MAPBOX_TOKEN}
+ mapboxApiAccessToken={CLOUD_PROVIDERS_CONFIGURATION.MAPBOX_TOKEN}
id="map"
/*
* Specify path to keplerGl state, because it is not mount at the root
diff --git a/examples/demo-app/src/cloud-providers/dropbox/dropbox-provider.js b/examples/demo-app/src/cloud-providers/dropbox/dropbox-provider.js
index 226331fa2..0b90ac1c3 100644
--- a/examples/demo-app/src/cloud-providers/dropbox/dropbox-provider.js
+++ b/examples/demo-app/src/cloud-providers/dropbox/dropbox-provider.js
@@ -21,10 +21,9 @@
// DROPBOX
import {Dropbox} from 'dropbox';
import window from 'global/window';
-import Console from 'global/console';
import DropboxIcon from './dropbox-icon';
import {MAP_URI} from '../../constants/default-settings';
-import {Provider} from '@kepler.gl/cloud-providers';
+import {KEPLER_FORMAT, Provider} from '@kepler.gl/cloud-providers';
const NAME = 'dropbox';
const DISPLAY_NAME = 'Dropbox';
@@ -220,11 +219,11 @@ export default class DropboxProvider extends Provider {
const response = {
map: json,
- format: 'keplergl'
+ format: KEPLER_FORMAT
};
this._loadParam = loadParams;
- return response;
+ return Promise.resolve(response);
}
getUserName() {
@@ -474,7 +473,7 @@ export default class DropboxProvider extends Provider {
name,
title,
id,
- lastModification: new Date(client_modified).getTime(),
+ updatedAt: new Date(client_modified).getTime(),
loadParams: {
path: path_lower
}
diff --git a/examples/demo-app/src/cloud-providers/foursquare/foursquare-icon.js b/examples/demo-app/src/cloud-providers/foursquare/foursquare-icon.js
new file mode 100644
index 000000000..bb9e55b02
--- /dev/null
+++ b/examples/demo-app/src/cloud-providers/foursquare/foursquare-icon.js
@@ -0,0 +1,41 @@
+import React, {Component} from 'react';
+import {Icons} from '@kepler.gl/components';
+import PropTypes from 'prop-types';
+
+const style = {
+ background: 'black'
+};
+export default class FoursquareIcon extends Component {
+ static propTypes = {
+ /** Set the height of the icon, ex. '16px' */
+ height: PropTypes.string,
+ colors: PropTypes.arrayOf(PropTypes.string)
+ };
+
+ static defaultProps = {
+ width: '64px',
+ fill: 'black',
+ predefinedClassName: 'cloud-provider-studio-icon',
+ totalColor: 1,
+ style
+ };
+
+ render() {
+ return (
+ <Icons.IconWrapper {...this.props} viewBox="0 -10 84 120">
+ <path
+ d="M2.30368 0H33.1681V5.341H8.33118V18.5748H30.1695V23.7674H8.33118V43.5885H2.30368V0Z"
+ fill="white"
+ />
+ <path
+ d="M5.66576 84.6965C5.80711 87.1692 6.40279 89.177 7.4528 90.72C9.45187 93.6081 12.9755 95.0521 18.0236 95.0521C20.2852 95.0521 22.3449 94.7356 24.2026 94.1026C27.7969 92.8762 29.594 90.6804 29.594 87.5154C29.594 85.1416 28.8368 83.4503 27.3223 82.4414C25.7877 81.4524 23.3848 80.5919 20.1136 79.86L14.0861 78.5247C10.1485 77.6543 7.36194 76.6949 5.72633 75.6465C2.89937 73.8266 1.48588 71.1067 1.48588 67.4867C1.48588 63.5699 2.86908 60.3554 5.63547 57.8432C8.40186 55.3309 12.3192 54.0748 17.3876 54.0748C22.0521 54.0748 26.0098 55.1826 29.2608 57.3981C32.532 59.5939 34.1676 63.115 34.1676 67.9614H28.5036C28.2007 65.6272 27.5546 63.837 26.5651 62.5907C24.7276 60.3159 21.6078 59.1784 17.2058 59.1784C13.6519 59.1784 11.0976 59.9104 9.54274 61.3742C7.98791 62.838 7.21049 64.5392 7.21049 66.4778C7.21049 68.6142 8.11916 70.1769 9.9365 71.166C11.1279 71.799 13.8236 72.5903 18.0236 73.5398L24.2632 74.9344C27.2719 75.607 29.594 76.5268 31.2296 77.6939C34.0566 79.7314 35.4701 82.6887 35.4701 86.5659C35.4701 91.3926 33.6729 94.8444 30.0786 96.9215C26.5045 98.9985 22.3449 100.037 17.5996 100.037C12.0668 100.037 7.7355 98.6524 4.60564 95.883C1.47579 93.1333 -0.0588526 89.4045 0.00172532 84.6965H5.66576Z"
+ fill="white"
+ />
+ <path
+ d="M83.8112 98.6425L80.7823 102.233L73.9067 97.0995C72.2509 97.9897 70.4538 98.7018 68.5153 99.2359C66.597 99.77 64.497 100.037 62.2152 100.037C55.3093 100.037 49.8977 97.8215 45.9803 93.3905C42.5274 89.0781 40.8009 83.6778 40.8009 77.1895C40.8009 71.2946 42.2952 66.2503 45.2837 62.0566C49.1203 56.6761 54.7944 53.9858 62.3061 53.9858C70.161 53.9858 75.9765 56.4585 79.7525 61.4039C82.7006 65.2612 84.1747 70.1967 84.1747 76.2103C84.1747 79.0193 83.8213 81.7194 83.1146 84.3108C82.0444 88.2671 80.2371 91.4915 77.6929 93.9839L83.8112 98.6425ZM62.9421 94.7554C64.1941 94.7554 65.3653 94.6763 66.4557 94.518C67.5461 94.34 68.4951 94.0037 69.3028 93.5092L64.4263 89.7705L67.4552 86.1208L73.2707 90.542C75.1082 88.4847 76.35 86.1801 76.9962 83.6283C77.6626 81.0765 77.9957 78.6335 77.9957 76.2993C77.9957 71.1759 76.6226 67.0515 73.8764 63.926C71.1504 60.8005 67.4148 59.2378 62.6695 59.2378C57.8637 59.2378 54.0574 60.7412 51.2506 63.748C48.4438 66.735 47.0404 71.344 47.0404 77.5752C47.0404 82.8173 48.3833 86.9912 51.0689 90.0969C53.7747 93.2026 57.7324 94.7554 62.9421 94.7554Z"
+ fill="white"
+ />
+ </Icons.IconWrapper>
+ );
+ }
+}
diff --git a/examples/demo-app/src/cloud-providers/foursquare/foursquare-provider.js b/examples/demo-app/src/cloud-providers/foursquare/foursquare-provider.js
new file mode 100644
index 000000000..a1d52e0f7
--- /dev/null
+++ b/examples/demo-app/src/cloud-providers/foursquare/foursquare-provider.js
@@ -0,0 +1,172 @@
+import FSQIcon from './foursquare-icon';
+import {Provider, KEPLER_FORMAT} from 'kepler.gl/cloud-providers';
+import {Auth0Client} from '@auth0/auth0-spa-js';
+
+const NAME = 'Foursquare';
+const DISPLAY_NAME = 'Foursquare';
+const APP_NAME = 'Kepler.gl';
+
+const FOURSQUARE_PRIVATE_STORAGE_ENABLED = true;
+const FOURSQUARE_AUTH_AUDIENCE = 'https://foursquare.com/api/';
+const FOURSQUARE_AUTH_SCOPE = 'openid profile email';
+
+// Foursquare stores kepler maps using kepler.gl-raw as ImportSource
+const FOURSQUARE_KEPLER_GL_IMPORT_SOURCE = 'kepler.gl-raw';
+
+/**
+ * Converts a FSQ map model to cloud provider map item
+ * @param model Foursquare Map
+ * @return {MapItem} Map
+ */
+function convertFSQModelToMapItem(model) {
+ return {
+ id: model.id,
+ title: model.name,
+ thumbnail: model.previewReadPath,
+ updatedAt: model.updatedAt,
+ description: model.description,
+ loadParams: {
+ mapId: model.id
+ }
+ };
+}
+
+function extractMapFromFSQResponse(response) {
+ const {
+ latestState: {data}
+ } = response;
+ return data;
+}
+
+export default class FoursquareProvider extends Provider {
+ constructor({clientId, authDomain, apiURL, userMapsURL}) {
+ super({name: NAME, displayName: DISPLAY_NAME, icon: FSQIcon});
+ this.icon = FSQIcon;
+ this.appName = APP_NAME;
+ this.apiURL = apiURL;
+
+ const redirect_uri = window.location.origin + window.location.pathname;
+
+ this._auth0 = new Auth0Client({
+ domain: authDomain,
+ clientId: clientId,
+ scope: FOURSQUARE_AUTH_SCOPE,
+ authorizationParams: {
+ redirect_uri,
+ audience: FOURSQUARE_AUTH_AUDIENCE
+ },
+ cacheLocation: 'localstorage'
+ });
+
+ // the domain needs to be passed as input param
+ this._folderLink = userMapsURL;
+ this.isNew = true;
+ }
+
+ hasPrivateStorage() {
+ return FOURSQUARE_PRIVATE_STORAGE_ENABLED;
+ }
+
+ async getUser() {
+ return this._auth0.getUser();
+ }
+
+ async login() {
+ return this._auth0.loginWithPopup();
+ }
+
+ async logout() {
+ return this._auth0.logout({
+ // this make sure after logging out the sdk will not redirect the user
+ openUrl: false
+ });
+ }
+
+ async uploadMap({mapData, options = {}}) {
+ // TODO: handle replace
+ const mode = options.overwrite ? 'overwrite' : 'add';
+ const method = options.overwrite ? 'PUT' : 'POST'
+ const {map, thumbnail} = mapData;
+
+ const {title = '', description = '', id} = map.info;
+ const headers = await this.getHeaders();
+ const payload = {
+ name: title,
+ description,
+ importSource: FOURSQUARE_KEPLER_GL_IMPORT_SOURCE,
+ latestState: {
+ data: map
+ }
+ };
+
+ const mapResponse = await fetch(`${this.apiURL}/v1/maps${mode === 'overwrite' ? `/${id}` : ''}`, {
+ method,
+ headers,
+ body: JSON.stringify(payload)
+ });
+
+ const createMap = await mapResponse.json();
+
+ await fetch(`${this.apiURL}/v1/maps/${createMap.id}/thumbnail`, {
+ method: 'PUT',
+ headers: {
+ ...headers,
+ 'Content-Type': 'image/png'
+ },
+ body: thumbnail
+ });
+
+ return map;
+ }
+
+ async listMaps() {
+ const headers = await this.getHeaders();
+ const response = await fetch(
+ `${this.apiURL}/v1/maps?importSource=${FOURSQUARE_KEPLER_GL_IMPORT_SOURCE}`,
+ {
+ method: 'GET',
+ mode: 'cors',
+ headers
+ }
+ );
+ const data = await response.json();
+ return data.items.map(convertFSQModelToMapItem);
+ }
+
+ async downloadMap(loadParams) {
+ const {mapId} = loadParams;
+ if (!mapId) {
+ return Promise.reject('No Map is was provider as part of loadParams');
+ }
+ const headers = await this.getHeaders();
+
+ const response = await fetch(`${this.apiURL}/v1/maps/${mapId}`, {
+ method: 'GET',
+ headers
+ });
+
+ const map = await response.json();
+
+ return Promise.resolve({
+ map: extractMapFromFSQResponse(map),
+ format: KEPLER_FORMAT
+ });
+ }
+
+ getManagementUrl() {
+ return this._folderLink;
+ }
+
+ async getAccessToken() {
+ return this._auth0.getTokenSilently();
+ }
+
+ async getHeaders() {
+ const accessToken = await this.getAccessToken();
+ return {
+ Authorization: `Bearer ${accessToken}`,
+ Accept: 'application/json',
+ 'Content-Type': 'application/json'
+ };
+ }
+}
diff --git a/examples/demo-app/src/cloud-providers/index.js b/examples/demo-app/src/cloud-providers/index.js
index 0aa2310b3..9b9f4c912 100644
--- a/examples/demo-app/src/cloud-providers/index.js
+++ b/examples/demo-app/src/cloud-providers/index.js
@@ -18,17 +18,39 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {AUTH_TOKENS} from '../constants/default-settings';
+import {CLOUD_PROVIDERS_CONFIGURATION} from '../constants/default-settings';
import DropboxProvider from './dropbox/dropbox-provider';
import CartoProvider from './carto/carto-provider';
+import FoursquareProvider from './foursquare/foursquare-provider';
+
+const {
+ DROPBOX_CLIENT_ID,
+ CARTO_CLIENT_ID,
+ FOURSQUARE_CLIENT_ID,
+ FOURSQUARE_DOMAIN,
+ FOURSQUARE_API_URL,
+ FOURSQUARE_USER_MAPS_URL
+} = CLOUD_PROVIDERS_CONFIGURATION;
+
+console.log('provider index', {
+ clientId: FOURSQUARE_CLIENT_ID,
+ authDomain: FOURSQUARE_DOMAIN,
+ apiURL: FOURSQUARE_API_URL,
+ userMapsURL: FOURSQUARE_USER_MAPS_URL
+});
-const {DROPBOX_CLIENT_ID, CARTO_CLIENT_ID} = AUTH_TOKENS;
const DROPBOX_CLIENT_NAME = 'Kepler.gl Demo App';
export const DEFAULT_CLOUD_PROVIDER = 'dropbox';
export const CLOUD_PROVIDERS = [
+ new FoursquareProvider({
+ clientId: FOURSQUARE_CLIENT_ID,
+ authDomain: FOURSQUARE_DOMAIN,
+ apiURL: FOURSQUARE_API_URL,
+ userMapsURL: FOURSQUARE_USER_MAPS_URL
+ }),
new DropboxProvider(DROPBOX_CLIENT_ID, DROPBOX_CLIENT_NAME),
new CartoProvider(CARTO_CLIENT_ID)
];
diff --git a/examples/demo-app/src/constants/default-settings.js b/examples/demo-app/src/constants/default-settings.js
index dd9697fd1..8b4e0ebb9 100644
--- a/examples/demo-app/src/constants/default-settings.js
+++ b/examples/demo-app/src/constants/default-settings.js
@@ -60,9 +60,13 @@ export const DEFAULT_FEATURE_FLAGS = {
cloudStorage: true
};
-export const AUTH_TOKENS = {
+export const CLOUD_PROVIDERS_CONFIGURATION = {
MAPBOX_TOKEN: process.env.MapboxAccessToken, // eslint-disable-line
DROPBOX_CLIENT_ID: process.env.DropboxClientId, // eslint-disable-line
EXPORT_MAPBOX_TOKEN: process.env.MapboxExportToken, // eslint-disable-line
- CARTO_CLIENT_ID: process.env.CartoClientId // eslint-disable-line
+ CARTO_CLIENT_ID: process.env.CartoClientId, // eslint-disable-line
+ FOURSQUARE_CLIENT_ID: process.env.FoursquareClientId, // eslint-disable-line
+ FOURSQUARE_DOMAIN: process.env.FoursquareDomain, // eslint-disable-line
+ FOURSQUARE_API_URL: process.env.FoursquareAPIURL, // eslint-disable-line
+ FOURSQUARE_USER_MAPS_URL: process.env.FoursquareUserMapsURL // eslint-disable-line
};
diff --git a/examples/demo-app/src/reducers/index.js b/examples/demo-app/src/reducers/index.js
index ccea8d51f..a7673ea93 100644
--- a/examples/demo-app/src/reducers/index.js
+++ b/examples/demo-app/src/reducers/index.js
@@ -34,7 +34,7 @@ import {
SET_SAMPLE_LOADING_STATUS
} from '../actions';
-import {AUTH_TOKENS} from '../constants/default-settings';
+import {CLOUD_PROVIDERS_CONFIGURATION} from '../constants/default-settings';
import {generateHashId} from '../utils/strings';
// INITIAL_APP_STATE
@@ -84,7 +84,7 @@ const demoReducer = combineReducers({
...DEFAULT_EXPORT_MAP,
[EXPORT_MAP_FORMATS.HTML]: {
...DEFAULT_EXPORT_MAP[[EXPORT_MAP_FORMATS.HTML]],
- exportMapboxAccessToken: AUTH_TOKENS.EXPORT_MAPBOX_TOKEN
+ exportMapboxAccessToken: CLOUD_PROVIDERS_CONFIGURATION.EXPORT_MAPBOX_TOKEN
}
}
},
diff --git a/examples/demo-app/webpack.config.js b/examples/demo-app/webpack.config.js
index 8b6ebb3a4..688892112 100644
--- a/examples/demo-app/webpack.config.js
+++ b/examples/demo-app/webpack.config.js
@@ -69,7 +69,11 @@ const CONFIG = {
'MapboxAccessToken',
'DropboxClientId',
'MapboxExportToken',
- 'CartoClientId'
+ 'CartoClientId',
+ 'FoursquareClientId',
+ 'FoursquareDomain',
+ 'FoursquareAPIURL',
+ 'FoursquareUserMapsURL'
])
]
};
diff --git a/examples/webpack.config.local.js b/examples/webpack.config.local.js
index ba6b4912d..382abe48d 100644
--- a/examples/webpack.config.local.js
+++ b/examples/webpack.config.local.js
@@ -161,7 +161,11 @@ function makeLocalDevConfig(env, EXAMPLE_DIR = LIB_DIR, externals = {}) {
'MapboxAccessToken',
'DropboxClientId',
'MapboxExportToken',
- 'CartoClientId'
+ 'CartoClientId',
+ 'FoursquareClientId',
+ 'FoursquareDomain',
+ 'FoursquareAPIURL',
+ 'FoursquareUserMapsURL'
])
]
};
diff --git a/src/cloud-providers/src/index.ts b/src/cloud-providers/src/index.ts
index 5d71085e0..600288bfe 100644
--- a/src/cloud-providers/src/index.ts
+++ b/src/cloud-providers/src/index.ts
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-export {default as Provider, FILE_CONFLICT_MSG} from './provider';
+export {default as Provider, FILE_CONFLICT_MSG, KEPLER_FORMAT} from './provider';
// eslint-disable-next-line prettier/prettier
export type {MapListItem, Thumbnail, ProviderProps, IconProps} from './provider';
export {default as Upload} from './upload';
diff --git a/src/cloud-providers/src/provider.ts b/src/cloud-providers/src/provider.ts
index b72859c9b..895ec5516 100644
--- a/src/cloud-providers/src/provider.ts
+++ b/src/cloud-providers/src/provider.ts
@@ -28,7 +28,7 @@ export type MapListItem = {
description: string;
loadParams: any;
imageUrl?: string;
- lastModification?: Millisecond;
+ updatedAt?: Millisecond;
privateMap?: boolean;
};
@@ -59,7 +59,9 @@ const NAME = 'cloud-provider';
const DISPLAY_NAME = 'Cloud Provider';
const THUMBNAIL = {width: 300, height: 200};
const ICON = Upload;
+export const KEPLER_FORMAT = 'keplergl';
export const FILE_CONFLICT_MSG = 'file_conflict';
+
/**
* The default provider class
* @param {object} props
@@ -84,6 +86,7 @@ export default class Provider {
displayName: string;
icon: ComponentType<IconProps>;
thumbnail: Thumbnail;
+ isNew: boolean = false;
constructor(props: ProviderProps) {
this.name = props.name || NAME;
@@ -133,10 +136,10 @@ export default class Provider {
/**
* This method is called to determine whether user already logged in to this provider
* @public
- * @returns true if a user already logged in
+ * @returns {Promise<string>} return the access token if a user already logged in
*/
- getAccessToken(): boolean {
- return true;
+ getAccessToken(): Promise<string> {
+ return Promise.reject('You must implement getAccessToken');
}
/**
@@ -200,7 +203,7 @@ export default class Provider {
}: {
mapData: MapData;
options: ExportFileOptions;
- }): Promise<any> {
+ }): Promise<MapListItem> {
return Promise.reject('You must implement uploadMap');
}
@@ -216,7 +219,7 @@ export default class Provider {
* title: 'My map',
* description: 'My first kepler map',
* imageUrl: 'http://',
- * lastModification: 1582677787000,
+ * updatedAt: 1582677787000,
* privateMap: false,
* loadParams: {}
* }
@@ -253,10 +256,13 @@ export default class Provider {
* }
*/
async downloadMap(loadParams): Promise<{map: SavedMap; format: string}> {
- // @ts-expect-error
- return;
+ return Promise.reject('You must implement downloadMap');
}
+ /**
+ * @return {string} return the storage location url for the current provider
+ * @public
+ */
getManagementUrl(): string {
throw new Error('You must implement getManagementUrl');
}
diff --git a/src/components/src/common/flex-container.ts b/src/components/src/common/flex-container.ts
index ffcb026f6..89ddf6549 100644
--- a/src/components/src/common/flex-container.ts
+++ b/src/components/src/common/flex-container.ts
@@ -23,12 +23,11 @@ import styled from 'styled-components';
export const FlexContainer = styled.div`
display: flex;
gap: 8px;
+ flex-wrap: wrap;
`;
-export const FlexColContainer = styled.div`
- display: flex;
+export const FlexColContainer = styled(FlexContainer)`
flex-direction: column;
- gap: 8px;
`;
export const FlexContainerGrow = styled(FlexContainer)`
diff --git a/src/components/src/modals/cloud-components/cloud-item.spec.tsx b/src/components/src/modals/cloud-components/cloud-item.spec.tsx
index 1150c177e..8a74657bd 100644
--- a/src/components/src/modals/cloud-components/cloud-item.spec.tsx
+++ b/src/components/src/modals/cloud-components/cloud-item.spec.tsx
@@ -1,6 +1,4 @@
// @ts-nocheck
-
-//colocating test next the file
import React from 'react';
import {fireEvent} from '@testing-library/react';
import {renderWithTheme} from '../../../../../test/helpers/component-jest-utils';
@@ -23,12 +21,16 @@ describe('CloudItem', () => {
});
it('renders PrivacyBadge for private maps', () => {
- const {getByText} = renderWithTheme(<CloudItem vis={{...mockVis, privateMap: true}} onClick={() => {}} />);
+ const {getByText} = renderWithTheme(
+ <CloudItem vis={{...mockVis, privateMap: true}} onClick={() => {}} />
+ );
expect(getByText('Private')).toBeInTheDocument();
});
it('does not render PrivacyBadge for public maps', () => {
- const {queryByText} = renderWithTheme(<CloudItem vis={{...mockVis, privateMap: false}} onClick={() => {}} />);
+ const {queryByText} = renderWithTheme(
+ <CloudItem vis={{...mockVis, privateMap: false}} onClick={() => {}} />
+ );
expect(queryByText('Private')).toBeNull();
});
@@ -38,7 +40,9 @@ describe('CloudItem', () => {
});
it('displays MapIcon when no thumbnail is provided', () => {
- const {getByRole} = renderWithTheme(<CloudItem vis={{...mockVis, thumbnail: null}} onClick={() => {}} />);
+ const {getByRole} = renderWithTheme(
+ <CloudItem vis={{...mockVis, thumbnail: null}} onClick={() => {}} />
+ );
expect(getByRole('map-icon')).toBeInTheDocument();
});
@@ -46,7 +50,9 @@ describe('CloudItem', () => {
const {getByText} = renderWithTheme(<CloudItem vis={mockVis} onClick={() => {}} />);
expect(getByText('Test Title')).toBeInTheDocument();
expect(getByText('Test Description')).toBeInTheDocument();
- expect(getByText(`Last modified ${moment.utc(mockVis.lastModification).fromNow()}`)).toBeInTheDocument();
+ expect(
+ getByText(`Last modified ${moment.utc(mockVis.lastModification).fromNow()}`)
+ ).toBeInTheDocument();
});
it('calls onClick when component is clicked', () => {
@@ -56,4 +62,3 @@ describe('CloudItem', () => {
expect(onClickMock).toHaveBeenCalled();
});
});
-
diff --git a/src/components/src/modals/cloud-components/cloud-item.tsx b/src/components/src/modals/cloud-components/cloud-item.tsx
index e7d57d588..4079572b9 100644
--- a/src/components/src/modals/cloud-components/cloud-item.tsx
+++ b/src/components/src/modals/cloud-components/cloud-item.tsx
@@ -137,11 +137,9 @@ export const CloudItem = ({vis, onClick}) => {
</MapIcon>
)}
<span className="vis_item-title">{vis.title}</span>
- {vis.description?.length && (
- <span className="vis_item-description">{vis.description}</span>
- )}
+ {vis.description?.length && <span className="vis_item-description">{vis.description}</span>}
<span className="vis_item-modification-date">
- Last modified {moment.utc(vis.lastModification).fromNow()}
+ Last modified {moment.utc(vis.updatedAt).fromNow()}
</span>
</StyledVisualizationItem>
);
diff --git a/src/components/src/modals/cloud-components/cloud-maps.spec.tsx b/src/components/src/modals/cloud-components/cloud-maps.spec.tsx
index 8b884bd28..c3a123a36 100644
--- a/src/components/src/modals/cloud-components/cloud-maps.spec.tsx
+++ b/src/components/src/modals/cloud-components/cloud-maps.spec.tsx
@@ -12,7 +12,9 @@ describe('CloudMaps Component', () => {
it('displays error message when there is an error', () => {
const errorMessage = 'Test Error';
- const {getByText} = renderWithTheme(<CloudMaps isLoading={false} maps={[]} error={{ message: errorMessage }} />);
+ const {getByText} = renderWithTheme(
+ <CloudMaps isLoading={false} maps={[]} error={{message: errorMessage}} />
+ );
expect(getByText(`Error while fetching maps: ${errorMessage}`)).toBeInTheDocument();
});
@@ -22,8 +24,14 @@ describe('CloudMaps Component', () => {
});
it('renderWithThemes correct number of CloudItems based on maps prop', () => {
- const mockMaps = [{ id: 1, title: 'map' }, { id: 2, title: 'map' }, { id: 3, title: 'map' }];
- const {getAllByText} = renderWithTheme(<CloudMaps isLoading={false} maps={mockMaps} error={null} />);
+ const mockMaps = [
+ {id: 1, title: 'map'},
+ {id: 2, title: 'map'},
+ {id: 3, title: 'map'}
+ ];
+ const {getAllByText} = renderWithTheme(
+ <CloudMaps isLoading={false} maps={mockMaps} error={null} />
+ );
expect(getAllByText('map')).toHaveLength(mockMaps.length); // Ensure your CloudItem has 'data-testid="cloud-item"'
});
@@ -33,14 +41,25 @@ describe('CloudMaps Component', () => {
});
it('calls onSelectMap when a CloudItem is clicked', () => {
- const mockMaps = [{ id: 1, title: 'map' }, { id: 2, title: 'map' }, { id: 3, title: 'map' }];
+ const mockMaps = [
+ {id: 1, title: 'map'},
+ {id: 2, title: 'map'},
+ {id: 3, title: 'map'}
+ ];
const onSelectMap = jest.fn();
const provider = 'testProvider';
- const {getAllByText} = renderWithTheme(<CloudMaps provider={provider} onSelectMap={onSelectMap} isLoading={false} maps={mockMaps} error={null} />);
+ const {getAllByText} = renderWithTheme(
+ <CloudMaps
+ provider={provider}
+ onSelectMap={onSelectMap}
+ isLoading={false}
+ maps={mockMaps}
+ error={null}
+ />
+ );
const firstItem = getAllByText('map')[0];
fireEvent.click(firstItem);
expect(onSelectMap).toHaveBeenCalledWith(provider, mockMaps[0]);
});
});
-
diff --git a/src/components/src/modals/cloud-components/cloud-maps.tsx b/src/components/src/modals/cloud-components/cloud-maps.tsx
index 9387b778f..c866d497e 100644
--- a/src/components/src/modals/cloud-components/cloud-maps.tsx
+++ b/src/components/src/modals/cloud-components/cloud-maps.tsx
@@ -32,6 +32,11 @@ const StyledSpinner = styled.div`
}
`;
+const StyledFlexContainer = styled(FlexContainer)`
+ justify-content: flex-start;
+ flex-wrap: wrap;
+`;
+
export const CloudMaps = ({provider, onSelectMap, isLoading, maps, error}) => {
if (error) {
return <div>Error while fetching maps: {error.message}</div>;
@@ -46,7 +51,7 @@ export const CloudMaps = ({provider, onSelectMap, isLoading, maps, error}) => {
}
return (
- <FlexContainer>
+ <StyledFlexContainer>
{(maps ?? []).length ? (
maps.map(vis => (
<CloudItem key={vis.id} onClick={() => onSelectMap(provider, vis)} vis={vis} />
@@ -56,6 +61,6 @@ export const CloudMaps = ({provider, onSelectMap, isLoading, maps, error}) => {
<FormattedMessage id={'modal.loadStorageMap.noSavedMaps'} />
</div>
)}
- </FlexContainer>
+ </StyledFlexContainer>
);
};
diff --git a/src/components/src/modals/cloud-tile.tsx b/src/components/src/modals/cloud-tile.tsx
index c435dbf8f..c086792de 100644
--- a/src/components/src/modals/cloud-tile.tsx
+++ b/src/components/src/modals/cloud-tile.tsx
@@ -60,6 +60,7 @@ const StyledTileWrapper = styled.div.attrs({
const StyledBox = styled(CenterVerticalFlexbox)`
margin-right: 12px;
+ position: relative;
`;
const StyledCloudName = styled.div`
@@ -96,6 +97,25 @@ const LogoutButton = ({onClick}: OnClickProps) => (
</Button>
);
+const NewTag = styled.div`
+ width: 37px;
+ height: 19px;
+ display: flex;
+ align-content: center;
+ justify-content: center;
+ border-radius: 8px;
+ padding: 4px 8px;
+ background-color: #EDE9F9;
+ color: #8863F8;
+ position: absolute;
+ left: 35%;
+ top: -8px
+ z-index: 500;
+ font-size: 11px;
+ line-height: 10px;
+;
+`;
+
interface CloudTileProps {
actionName?: string | null;
// cloud provider class
@@ -116,7 +136,7 @@ const CloudTile: React.FC<CloudTileProps> = ({provider, actionName}) => {
const isSelected = provider === currentProvider;
useEffect(() => {
- if (provider.getAccessToken()) {
+ if (provider) {
setError(null);
setIsLoading(true);
setError(null);
@@ -129,6 +149,8 @@ const CloudTile: React.FC<CloudTileProps> = ({provider, actionName}) => {
}, [provider]);
const onLogin = useCallback(async () => {
+ setError(null);
+ setIsLoading(true);
try {
const user = await provider.login();
setUser(user);
@@ -136,6 +158,7 @@ const CloudTile: React.FC<CloudTileProps> = ({provider, actionName}) => {
} catch (error) {
setError(error as Error);
}
+ setIsLoading(false);
}, [provider]);
const onSelect = useCallback(async () => {
@@ -164,6 +187,10 @@ const CloudTile: React.FC<CloudTileProps> = ({provider, actionName}) => {
return (
<StyledBox>
+ {provider.isNew ? (
+ <NewTag>New</NewTag>
+ ) : null}
+ <div></div>
<StyledTileWrapper onClick={onSelect} selected={isSelected}>
<StyledCloudName>{displayName || name}</StyledCloudName>
{provider.icon ? <provider.icon height="64px" /> : null}
diff --git a/src/components/src/modals/load-storage-map.spec.tsx b/src/components/src/modals/load-storage-map.spec.tsx
index 3a272e42a..af715acf2 100644
--- a/src/components/src/modals/load-storage-map.spec.tsx
+++ b/src/components/src/modals/load-storage-map.spec.tsx
@@ -63,7 +63,7 @@ describe('LoadStorageMap', () => {
cloudProviders: []
}));
- const {getByText } = renderWithTheme(<LoadStorageMap {...DEFAULT_PROPS} />);
+ const {getByText} = renderWithTheme(<LoadStorageMap {...DEFAULT_PROPS} />);
expect(DEFAULT_PROVIDER.listMaps).toHaveBeenCalled();
// first show loading icon
@@ -72,7 +72,7 @@ describe('LoadStorageMap', () => {
// show empty maps
await waitFor(() => {
expect(getByText('modal.loadStorageMap.noSavedMaps')).toBeInTheDocument();
- })
+ });
});
test('renders map list because', async () => {
@@ -88,7 +88,7 @@ describe('LoadStorageMap', () => {
cloudProviders: []
}));
- const {getByText } = renderWithTheme(<LoadStorageMap {...DEFAULT_PROPS} />);
+ const {getByText} = renderWithTheme(<LoadStorageMap {...DEFAULT_PROPS} />);
expect(mapProvider.listMaps).toHaveBeenCalled();
// first show loading icon
@@ -99,8 +99,8 @@ describe('LoadStorageMap', () => {
DEFAULT_MAPS.forEach(map => {
expect(getByText(map.title)).toBeInTheDocument();
expect(getByText(map.description)).toBeInTheDocument();
- })
- })
+ });
+ });
});
test('trigger onLoadCLoudMap when clicking on a map', async () => {
@@ -116,7 +116,7 @@ describe('LoadStorageMap', () => {
cloudProviders: []
}));
- const {getByText } = renderWithTheme(<LoadStorageMap {...DEFAULT_PROPS} />);
+ const {getByText} = renderWithTheme(<LoadStorageMap {...DEFAULT_PROPS} />);
expect(mapProvider.listMaps).toHaveBeenCalled();
// first show loading icon
@@ -138,14 +138,14 @@ describe('LoadStorageMap', () => {
icon: jest.fn(),
getManagementUrl: jest.fn().mockImplementation(() => 'provider.url'),
listMaps: jest.fn().mockRejectedValue(new Error('timeout'))
- }
+ };
useCloudListProvider.mockImplementation(() => ({
provider: rejectableProvider,
setProvider: jest.fn(),
cloudProviders: []
}));
- const {getByText } = renderWithTheme(<LoadStorageMap {...DEFAULT_PROPS} />);
+ const {getByText} = renderWithTheme(<LoadStorageMap {...DEFAULT_PROPS} />);
expect(rejectableProvider.listMaps).toHaveBeenCalled();
// first show loading icon
@@ -157,4 +157,3 @@ describe('LoadStorageMap', () => {
});
});
});
-
diff --git a/src/components/src/modals/load-storage-map.tsx b/src/components/src/modals/load-storage-map.tsx
index 46beda8d6..60ed9791d 100644
--- a/src/components/src/modals/load-storage-map.tsx
+++ b/src/components/src/modals/load-storage-map.tsx
@@ -40,12 +40,8 @@ function LoadStorageMapFactory() {
setIsLoading(true);
provider
.listMaps()
- .then(maps => {
- setMaps(maps)
- })
- .catch(error => {
- setError(error)
- })
+ .then(setMaps)
+ .catch(setError)
.finally(() => setIsLoading(false));
} else {
setIsLoading(false);
diff --git a/src/components/src/modals/save-map-modal.spec.tsx b/src/components/src/modals/save-map-modal.spec.tsx
index 1bc606725..ff836d05a 100644
--- a/src/components/src/modals/save-map-modal.spec.tsx
+++ b/src/components/src/modals/save-map-modal.spec.tsx
@@ -1,23 +1,3 @@
-// Copyright (c) 2023 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
// @ts-nocheck
/**
diff --git a/src/components/src/modals/save-map-modal.tsx b/src/components/src/modals/save-map-modal.tsx
index 4c51bf8f5..09b505e08 100644
--- a/src/components/src/modals/save-map-modal.tsx
+++ b/src/components/src/modals/save-map-modal.tsx
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import React, {useMemo} from 'react';
+import React, {useCallback, useMemo} from 'react';
import styled from 'styled-components';
import ImageModalContainer, {ImageModalContainerProps} from './image-modal-container';
import {FlexContainer} from '../common/flex-container';
@@ -207,6 +207,12 @@ function SaveMapModalFactory() {
[provider, mapInfo]
);
+ const confirm = useCallback(() => {
+ if (provider) {
+ onConfirm(provider);
+ }
+ }, [provider]);
+
return (
<ImageModalContainer
provider={provider}
@@ -269,7 +275,7 @@ function SaveMapModalFactory() {
</StyledSaveMapModal>
<ModalFooter
cancel={onCancel}
- confirm={() => provider && onConfirm(provider)}
+ confirm={confirm}
confirmButton={confirmButton}
/>
</ImageModalContainer>
diff --git a/src/components/src/modals/share-map-modal.spec.tsx b/src/components/src/modals/share-map-modal.spec.tsx
index 421c65141..c524761fc 100644
--- a/src/components/src/modals/share-map-modal.spec.tsx
+++ b/src/components/src/modals/share-map-modal.spec.tsx
@@ -20,7 +20,6 @@ jest.mock('../hooks/use-cloud-list-provider', () => ({
const ShareMapUrlModal = ShareMapUrlModalFactory();
-
const DEFAULT_PROPS = {
isProviderLoading: false,
onExport: jest.fn(),
@@ -28,7 +27,7 @@ const DEFAULT_PROPS = {
successInfo: undefined,
onUpdateImageSetting: jest.fn(),
cleanupExportImage: jest.fn()
-}
+};
describe('ShareMapModal', () => {
afterEach(() => {
@@ -125,7 +124,7 @@ describe('ShareMapModal', () => {
<ShareMapUrlModal {...DEFAULT_PROPS} />
</IntlProvider>
</ThemeProvider>
- )
+ );
});
expect(DEFAULT_PROPS.onExport).toHaveBeenCalled();
@@ -133,12 +132,16 @@ describe('ShareMapModal', () => {
it('displays share URL when provided', () => {
const shareUrl = 'http://example.com';
- const { getByText } = renderWithTheme(<ShareMapUrlModal {...DEFAULT_PROPS} successInfo={{ shareUrl }} />);
+ const {getByText} = renderWithTheme(
+ <ShareMapUrlModal {...DEFAULT_PROPS} successInfo={{shareUrl}} />
+ );
expect(getByText('Share Url')).toBeInTheDocument();
});
it('renders errors', () => {
- const { getByText } = renderWithTheme(<ShareMapUrlModal {...DEFAULT_PROPS} providerError={new Error('timeout')} />);
+ const {getByText} = renderWithTheme(
+ <ShareMapUrlModal {...DEFAULT_PROPS} providerError={new Error('timeout')} />
+ );
expect(getByText('modal.statusPanel.error')).toBeInTheDocument();
});
-})
+});
diff --git a/src/components/src/side-panel/panel-header.tsx b/src/components/src/side-panel/panel-header.tsx
index 3cc92b82c..0eae456b7 100644
--- a/src/components/src/side-panel/panel-header.tsx
+++ b/src/components/src/side-panel/panel-header.tsx
@@ -167,7 +167,12 @@ const PanelAction: React.FC<PanelActionProps> = React.memo(({item, showExportDro
}, [item, showExportDropdown]);
return (
- <StyledPanelAction id={`${item.id}-action`} data-tip data-for={`${item.id}-action`} onClick={onClick}>
+ <StyledPanelAction
+ id={`${item.id}-action`}
+ data-tip
+ data-for={`${item.id}-action`}
+ onClick={onClick}
+ >
{item.label ? <p>{item.label}</p> : null}
<a target={item.blank ? '_blank' : ''} href={item.href} rel="noreferrer">
<item.iconComponent height="20px" {...item.iconComponentProps} />
diff --git a/website/webpack.config.js b/website/webpack.config.js
index c45b16535..87aa03ffc 100644
--- a/website/webpack.config.js
+++ b/website/webpack.config.js
@@ -110,7 +110,11 @@ const COMMON_CONFIG = {
DropboxClientId: null,
CartoClientId: null,
GoogleDriveClientId: null,
- MapboxExportToken: null
+ MapboxExportToken: null,
+ FoursquareClientId: null,
+ FoursquareDomain: null,
+ FoursquareAPIURL: null,
+ FoursquareUserMapsURL: null
})
],
@@ -158,6 +162,17 @@ function logInstruction(msg) {
console.log('\x1b[36m%s\x1b[0m', msg);
}
+function validateEnvVariable(variable, instruction) {
+ if (!process.env[variable]) {
+ logError(`Error! ${variable} is not defined`);
+ logInstruction(
+ `Make sure to run "export ${variable}=<token>" before deploy the website`
+ );
+ logInstruction(instruction);
+ throw new Error(`Missing ${variable}`);
+ }
+}
+
module.exports = env => {
env = env || {};
@@ -168,32 +183,13 @@ module.exports = env => {
}
if (env.prod) {
- if (!process.env.MapboxAccessToken) {
- logError('Error! MapboxAccessToken is not defined');
- logInstruction(
- `Make sure to run "export MapboxAccessToken=<token>" before deploy the website`
- );
- logInstruction(
- 'You can get the token at https://www.mapbox.com/help/how-access-tokens-work/'
- );
- throw new Error('Missing Mapbox Access token');
- }
- if (!process.env.DropboxClientId) {
- logError('Error! DropboxClientId is not defined');
- logInstruction(`Make sure to run "export DropboxClientId=<token>" before deploy the website`);
- logInstruction('You can get the token at https://www.dropbox.com/developers');
- throw new Error('Missing Export DropboxClientId Access token');
- }
- if (!process.env.MapboxExportToken) {
- logError('Error! MapboxExportToken is not defined');
- logInstruction(
- `Make sure to run "export MapboxExportToken=<token>" before deploy the website`
- );
- logInstruction(
- 'You can get the token at https://www.mapbox.com/help/how-access-tokens-work/'
- );
- throw new Error('Missing Export Mapbox Access token, used to generate the single map file');
- }
+ validateEnvVariable('MapboxAccessToken', 'You can get the token at https://www.mapbox.com/help/how-access-tokens-work/');
+ validateEnvVariable('DropboxClientId', 'You can get the token at https://www.dropbox.com/developers');
+ validateEnvVariable('MapboxExportToken', 'You can get the token at https://www.mapbox.com/help/how-access-tokens-work/');
+ validateEnvVariable('FoursquareClientId','https://location.foursquare.com/developer');
+ validateEnvVariable('FoursquareDomain','https://location.foursquare.com/developer');
+ validateEnvVariable('FoursquareAPIURL','https://location.foursquare.com/developer');
+ validateEnvVariable('FoursquareUserMapsURL','https://location.foursquare.com/developer');
config = addProdConfig(config);
}