Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Feat] CARTO provider for cloud storage (#985)
Shan Hecbba40e3d646
diff --git a/examples/demo-app/package.json b/examples/demo-app/package.jsonindex 95a870456..78f59b2aa 100644--- a/examples/demo-app/package.json+++ b/examples/demo-app/package.json@@ -8,7 +8,7 @@"start-local-https": "webpack-dev-server --mode development --https --env.es6 --progress --hot --open"},"dependencies": {- "@carto/toolkit": "0.0.1-rc.13",+ "@carto/toolkit": "0.0.1-rc.16","d3-request": "^1.0.6","dropbox": "^4.0.12","global": "^4.3.0",diff --git a/examples/demo-app/src/cloud-providers/carto/carto-icon.js b/examples/demo-app/src/cloud-providers/carto/carto-icon.jsnew file mode 100644index 000000000..6bda1eade--- /dev/null+++ b/examples/demo-app/src/cloud-providers/carto/carto-icon.js@@ -0,0 +1,65 @@+// Copyright (c) 2020 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.++import React, {Component} from 'react';+import {Icons} from 'kepler.gl/components';+import PropTypes from 'prop-types';++class CartoIcon extends Component {+ static propTypes = {+ /** Set the height of the icon, ex. '16px' */+ height: PropTypes.string,+ colors: PropTypes.arrayOf(PropTypes.string)+ };++ static defaultProps = {+ height: '100%',+ viewBox: '0 0 92 36',+ predefinedClassName: 'data-ex-icons-carto'+ };++ render() {+ return (+ <Icons.IconWrapper {...this.props}>+ <g id="Page-1" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">+ <g+ id="Logo-Scale-Negative"+ transform="translate(-162.000000, -282.000000)"+ fill="#2e3c43"+ >+ <g id="logo_carto_n_36" transform="translate(162.000000, 282.000000)">+ <path+ d="M74,36 C83.9411255,36 92,27.9411255 92,18 C92,8.0588745 83.9411255,0 74,0 C64.0588745,0 56,8.0588745 56,18 C56,27.9411255 64.0588745,36 74,36 Z"+ id="halo"+ fillOpacity="0.200000018"+ />+ <path+ d="M6.25280899,23.981602 C8.76747566,23.981602 10.220757,22.882802 11.2984713,21.390402 L8.9144367,19.684802 C8.22861851,20.521202 7.52647133,21.078802 6.33445401,21.078802 C4.73421159,21.078802 3.60751029,19.734002 3.60751029,18.012002 L3.60751029,17.979202 C3.60751029,16.306402 4.73421159,14.928802 6.33445401,14.928802 C7.4284973,14.928802 8.1796315,15.470002 8.83279168,16.273602 L11.2168263,14.420402 C10.204428,13.026402 8.70215964,12.042402 6.36711202,12.042402 C2.9053631,12.042402 0.358038428,14.666402 0.358038428,18.012002 L0.358038428,18.044802 C0.358038428,21.472402 2.98700813,23.981602 6.25280899,23.981602 L6.25280899,23.981602 Z M16.732047,23.752002 L20.0468349,23.752002 L20.8632851,21.685602 L25.2884453,21.685602 L26.1048955,23.752002 L29.5013284,23.752002 L24.6352851,12.190002 L21.5817613,12.190002 L16.732047,23.752002 Z M21.7940384,19.209202 L23.0840297,15.962002 L24.357692,19.209202 L21.7940384,19.209202 Z M35.6697093,23.752002 L38.8375361,23.752002 L38.8375361,20.275202 L40.2418305,20.275202 L42.5442201,23.752002 L46.1855881,23.752002 L43.4586443,19.750402 C44.8792677,19.143602 45.810021,17.979202 45.810021,16.208002 L45.810021,16.175202 C45.810021,15.043602 45.4671119,14.174402 44.7976227,13.502002 C44.0301595,12.731202 42.8218132,12.272002 41.0746097,12.272002 L35.6697093,12.272002 L35.6697093,23.752002 Z M38.8375361,17.782402 L38.8375361,15.010802 L40.9276487,15.010802 C41.9727049,15.010802 42.6421941,15.470002 42.6421941,16.388402 L42.6421941,16.421202 C42.6421941,17.257602 42.005363,17.782402 40.9439777,17.782402 L38.8375361,17.782402 Z M55.2605317,23.752002 L58.4283585,23.752002 L58.4283585,15.060002 L61.8574495,15.060002 L61.8574495,12.272002 L51.8477698,12.272002 L51.8477698,15.060002 L55.2605317,15.060002 L55.2605317,23.752002 Z M74,24 C77.3137085,24 80,21.3137085 80,18 C80,14.6862915 77.3137085,12 74,12 C70.6862915,12 68,14.6862915 68,18 C68,21.3137085 70.6862915,24 74,24 Z"+ id="logotype"+ />+ </g>+ </g>+ </g>+ </Icons.IconWrapper>+ );+ }+}++export default CartoIcon;diff --git a/examples/demo-app/src/cloud-providers/carto/carto-provider.js b/examples/demo-app/src/cloud-providers/carto/carto-provider.jsnew file mode 100644index 000000000..53884526f--- /dev/null+++ b/examples/demo-app/src/cloud-providers/carto/carto-provider.js@@ -0,0 +1,402 @@+// Copyright (c) 2020 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.++import {OAuthApp} from '@carto/toolkit';+import Console from 'global/console';+import CartoIcon from './carto-icon';+import {formatCsv} from 'processors/data-processor';+import {Provider} from 'kepler.gl/cloud-providers';++const NAME = 'carto';+const DISPLAY_NAME = 'CARTO';+const NAMESPACE = 'keplergl';+const DOMAIN = 'carto.com';+const PRIVATE_STORAGE_ENABLED = true;+const SHARING_ENABLED = true;++export default class CartoProvider extends Provider {+ constructor(clientId) {+ super({name: NAME, displayName: DISPLAY_NAME, icon: CartoIcon});++ this.clientId = clientId;+ this.thumbnail = {width: 300, height: 200};+ this.currentMap = null;++ this._folderLink = `https://{user}.${DOMAIN}/dashboard/maps/external`;++ // Initialize CARTO API+ this._carto = new OAuthApp(+ {+ authorization: `https://${DOMAIN}/oauth2`,+ scopes: 'schemas:c'+ },+ {+ serverUrlTemplate: `https://{user}.${DOMAIN}/`,+ namespace: NAMESPACE+ }+ );++ this._carto.setClientID(clientId);+ }++ /**+ * The CARTO toolkit library takes care of the login process.+ */+ login(onCloudLoginSuccess) {+ try {+ this._carto.login().then(() => {+ onCloudLoginSuccess && onCloudLoginSuccess(this.name);+ });+ } catch (error) {+ this._manageErrors(error);+ }+ }++ logout(onCloudLogoutSuccess) {+ try {+ this._carto.oauth.clear();+ this._carto.oauth._carto.sync();+ onCloudLogoutSuccess();+ } catch (error) {+ this._manageErrors(error);+ }+ }++ isEnabled() {+ return this.clientId !== null;+ }++ hasPrivateStorage() {+ return PRIVATE_STORAGE_ENABLED;+ }++ hasSharingUrl() {+ return SHARING_ENABLED;+ }++ async uploadMap({mapData = {}, options = {}}) {+ try {+ const {isPublic = true, overwrite = true} = options;+ const {map: {config, datasets, info} = {}, thumbnail} = mapData;++ const cartoDatasets = datasets.map(this._convertDataset);++ const cs = await this._carto.getCustomStorage();++ const {title, description} = info;+ const name = title;++ const thumbnailBase64 =+ mapData && thumbnail ? await this._blobToBase64(mapData.thumbnail) : null;++ let result;+ if (overwrite) {+ result = await cs.updateVisualization(+ {+ id: this.currentMap.id,+ name,+ description,+ thumbnail: thumbnailBase64,+ config: JSON.stringify(config),+ isPrivate: this.currentMap.isPrivate+ },+ cartoDatasets+ );+ } else {+ // TODO: Ask for changing current shared map generation because of being too oriented to file based clouds+ // Check public name generation and replace+ const regex = /(?:^keplergl_)([a-z0-9]+)(?:.json$)/;+ const capturedName = name.match(regex);+ const visName = capturedName ? `sharedmap_${capturedName[1]}` : name;++ result = await cs.createVisualization(+ {+ name: visName,+ description,+ thumbnail: thumbnailBase64,+ config: JSON.stringify(config),+ isPrivate: !isPublic+ },+ cartoDatasets,+ true+ );+ }++ if (result) {+ this.currentMap = result;+ }++ return {+ shareUrl: this._getMapPermalinkFromParams(+ {+ mapId: result.id,+ owner: this._carto.username,+ privateMap: !isPublic+ },+ true+ ),+ folderLink: this._folderLink.replace('{user}', this._carto.username)+ };+ } catch (error) {+ this._manageErrors(error);+ }+ }++ /**+ * Returns the access token. If it has expired returns null. The toolkit library loads it+ * from localStorage automatically+ */+ getAccessToken() {+ let accessToken = null;+ try {+ accessToken = this._carto.oauth.expired ? null : this._carto.oauth.token;+ } catch (error) {+ this._manageErrors(error, false);+ }++ return accessToken;+ }++ getUserName() {+ let username = null;+ try {+ username = this._carto.oauth.expired ? null : this._carto.username;+ } catch (error) {+ this._manageErrors(error, false);+ }++ return username;+ }++ /**+ * The CARTO cloud provider polls the created window internally to parse the URL+ * @param {*} location+ */+ getAccessTokenFromLocation(location) {+ return;+ }++ async downloadMap(queryParams) {+ try {+ const {owner: username, mapId, privateMap} = queryParams;++ if (!username || !mapId) {+ return;+ }++ let visualization;++ if (privateMap.trim().toLowerCase() === 'true') {+ await this._carto.login();+ const currentUsername = this.getUserName();+ if (currentUsername && currentUsername === username) {+ const cs = await this._carto.getCustomStorage();+ visualization = await cs.getVisualization(mapId);+ }+ } else {+ visualization = await this._carto.PublicStorageReader.getVisualization(username, mapId);+ }++ if (!visualization) {+ throw new Error(`Can't find map with ID: ${mapId}`);+ }++ // These are the options required for the action. For now, all datasets that come from CARTO are CSV+ const datasets = visualization.datasets.map(dataset => {+ const datasetId = dataset.name;++ return {+ info: {+ id: datasetId,+ label: datasetId,+ description: dataset.description,+ dataUrl: '',+ configUrl: '',+ panelDisabled: true+ },+ data: dataset.file+ };+ });++ // const datasets = visualization.datasets.map(dataset => dataset.file);++ this.currentMap = visualization.vis;++ return {+ map: {+ datasets,+ config: visualization.vis.config,+ info: {title: visualization.vis.name, description: visualization.vis.description}+ },+ format: 'csv'+ };+ } catch (error) {+ this._manageErrors(error);+ }+ }++ async listMaps() {+ // TODO: Implement pagination using {type='all', pageOffset=0, pageSize=-1}+ try {+ await this._carto.login();+ const username = this.getUserName();+ const cs = await this._carto.getCustomStorage();++ const visualizations = await cs.getVisualizations();+ let formattedVis = [];++ // Format visualization object+ for (const vis of visualizations) {+ formattedVis.push({+ id: vis.id,+ title: vis.name,+ description: vis.description,+ privateMap: vis.isPrivate,+ thumbnail: vis.thumbnail === 'undefined' ? null : vis.thumbnail,+ lastModification: new Date(Date.parse(vis.lastModified)),+ loadParams: {+ owner: username,+ mapId: vis.id,+ privateMap: vis.isPrivate.toString()+ }+ });+ }++ formattedVis = formattedVis.sort((a, b) => b.lastModification - a.lastModification);++ return formattedVis;+ } catch (error) {+ this._manageErrors(error);+ }+ }++ getShareUrl(fullUrl = false) {+ return this.getMapUrl(fullUrl);+ }++ getMapUrl(fullUrl = true) {+ if (this.currentMap) {+ return this._getMapPermalinkFromParams(+ {+ mapId: this.currentMap.id,+ owner: this.getUserName(),+ privateMap: this.currentMap.isPrivate+ },+ fullUrl+ );+ }+ }++ getManagementUrl() {+ return this._folderLink.replace('{user}', this._carto.username);+ }++ getCurrentVisualization() {+ return this.currentMap+ ? {title: this.currentMap.name, description: this.currentMap.description}+ : null;+ }++ // PRIVATE++ _getMapPermalinkFromParams({mapId, owner, privateMap}, fullURL = true) {+ const mapLink = this._composeURL({mapId, owner, privateMap});+ return fullURL+ ? `${window.location.protocol}//${window.location.host}/${mapLink}`+ : `/${mapLink}`;+ }++ _convertDataset({data: dataset}) {+ const {allData, fields, id} = dataset;+ const columns = fields.map(field => ({+ name: field.name,+ type: field.type+ }));++ const file = formatCsv(allData, fields);++ return {+ name: id,+ columns,+ file+ };+ }++ // eslint-disable-next-line complexity+ _manageErrors(error, throwException = true) {+ let message;+ if (error && error.message) {+ message = error.message;++ switch (error.message) {+ case 'No client ID has been specified':+ Console.error('No ClientID set for CARTO provider');+ break;+ case 'Cannot set the client ID more than once':+ Console.error('CARTO provider already initialized');+ break;+ case (error.message.match(/relation "[a-zA-Z0-9_]+" does not exist/) || {}).input:+ Console.error('CARTO custom storage is not properly initialized');+ message = 'Custom storage is not properly initialized';+ break;+ case (+ error.message.match(/Failed to copy to keplergl_[a-zA-Z0-9_]+: Too many retries/) || {}+ ).input:+ Console.error('CARTO Rate limit exceeded');+ message =+ "Failed to upload. You've exceeded the number of datasets allowed with your plan. Consider upgrading your plan.";+ break;+ case (error.message.match(/[a-zA-Z0-9_\s:]+: DB Quota exceeded/) || {}).input:+ Console.error('CARTO DB Quota exceeded');+ message =+ "Failed to upload. You've exceeded your account's disk storage limit. Consider upgrading your plan.";+ break;+ default:+ Console.error(`CARTO provider: ${message}`);+ }+ } else {+ message = 'General error in CARTO provider';+ Console.error(message);+ }++ // Use 'CARTO' as error code in order to show provider in notifications+ if (throwException) {+ throw new Error(message);+ }+ }++ _composeURL({mapId, owner, privateMap}) {+ return `demo/map/carto?mapId=${mapId}&owner=${owner}&privateMap=${privateMap}`;+ }++ _blobToBase64(blob) {+ return new Promise((resolve, reject) => {+ const reader = new FileReader();+ reader.onloadend = () => {+ if (!reader.error) {+ resolve(reader.result);+ } else {+ reject(reader.error);+ }+ };+ reader.readAsDataURL(blob);+ });+ }+}diff --git a/examples/demo-app/src/cloud-providers/dropbox/dropbox-provider.js b/examples/demo-app/src/cloud-providers/dropbox/dropbox-provider.jsindex 9b02fa23c..cd99cbb57 100644--- a/examples/demo-app/src/cloud-providers/dropbox/dropbox-provider.js+++ b/examples/demo-app/src/cloud-providers/dropbox/dropbox-provider.js@@ -263,6 +263,10 @@ export default class DropboxProvider extends Provider {: `/${mapLink}`;}+ getManagementUrl() {+ return this._folderLink;+ }+/*** Provides the current dropbox auth token. If stored in localStorage is set onto dropbox handler and returned* @returns {any}diff --git a/examples/demo-app/src/cloud-providers/index.js b/examples/demo-app/src/cloud-providers/index.jsindex c765388af..203a312e3 100644--- a/examples/demo-app/src/cloud-providers/index.js+++ b/examples/demo-app/src/cloud-providers/index.js@@ -21,13 +21,17 @@import {AUTH_TOKENS} from '../constants/default-settings';import DropboxProvider from './dropbox/dropbox-provider';+import CartoProvider from './carto/carto-provider';-const {DROPBOX_CLIENT_ID} = AUTH_TOKENS;+const {DROPBOX_CLIENT_ID, CARTO_CLIENT_ID} = AUTH_TOKENS;const DROPBOX_CLIENT_NAME = 'Kepler.gl%20(managed%20by%20Uber%20Technologies%2C%20Inc.)';export const DEFAULT_CLOUD_PROVIDER = 'dropbox';-export const CLOUD_PROVIDERS = [new DropboxProvider(DROPBOX_CLIENT_ID, DROPBOX_CLIENT_NAME)];+export const CLOUD_PROVIDERS = [+ new DropboxProvider(DROPBOX_CLIENT_ID, DROPBOX_CLIENT_NAME),+ new CartoProvider(CARTO_CLIENT_ID)+];export function getCloudProvider(providerName) {const cloudProvider = CLOUD_PROVIDERS.find(provider => provider.name === providerName);diff --git a/examples/demo-app/src/components/map-control/map-control.js b/examples/demo-app/src/components/map-control/map-control.jsindex 4efca16af..039b82738 100644--- a/examples/demo-app/src/components/map-control/map-control.js+++ b/examples/demo-app/src/components/map-control/map-control.js@@ -124,8 +124,10 @@ const LinkRenderer = props => {// to https://github.com/uber-web/kepler.gl-data/blob/master/movement_pittsburgh/config.jsonfunction getURL(url) {return url- .replace('https://raw.githubusercontent.com', 'https://github.com')- .replace('master', 'blob/master');+ ? url+ .replace('https://raw.githubusercontent.com', 'https://github.com')+ .replace('master', 'blob/master')+ : url;}function SampleMapPanel(props) {diff --git a/examples/demo-app/src/reducers/index.js b/examples/demo-app/src/reducers/index.jsindex 27400dc43..c26394325 100644--- a/examples/demo-app/src/reducers/index.js+++ b/examples/demo-app/src/reducers/index.js@@ -135,7 +135,7 @@ export const loadRemoteResourceSuccess = (state, action) => {app: {...state.app,currentSample: action.options,- isMapLoading: false // we turn of the spinner+ isMapLoading: false // we turn off the spinner},keplerGl: {...state.keplerGl, // in case you keep multiple instancesdiff --git a/examples/demo-app/webpack.config.js b/examples/demo-app/webpack.config.jsindex 5d0a4beda..f52717194 100644--- a/examples/demo-app/webpack.config.js+++ b/examples/demo-app/webpack.config.js@@ -67,7 +67,12 @@ const CONFIG = {// Optional: Enables reading mapbox and dropbox client token from environment variableplugins: [- new webpack.EnvironmentPlugin(['MapboxAccessToken', 'DropboxClientId', 'MapboxExportToken'])+ new webpack.EnvironmentPlugin([+ 'MapboxAccessToken',+ 'DropboxClientId',+ 'MapboxExportToken',+ 'CartoClientId'+ ])]};diff --git a/src/components/modals/load-storage-map.js b/src/components/modals/load-storage-map.jsindex 51482bf97..403ec88db 100644--- a/src/components/modals/load-storage-map.js+++ b/src/components/modals/load-storage-map.js@@ -44,9 +44,17 @@ const StyledVisualizationSection = styled.div`align-items: stretch;`;-const StyledBackBtn = styled.a`+const StyledStorageHeader = styled.div`+ display: flex;+ flex-direction: row;+ justify-content: space-between;+ align-items: center;+ margin-bottom: 16px;font-size: 12px;line-height: 14px;+`;++const StyledBackBtn = styled.a`margin-bottom: 16px;color: #3a414c;cursor: pointer;@@ -282,12 +290,25 @@ function LoadStorageMapFactory() {)}{!isProviderLoading && visualizations && (<StyledVisualizationSection>- <StyledBackBtn>- <Button link onClick={() => onSetCloudProvider(null)}>- <ArrowLeft height="14px" />- Back- </Button>- </StyledBackBtn>+ <StyledStorageHeader>+ <StyledBackBtn>+ <Button link onClick={() => onSetCloudProvider(null)}>+ <ArrowLeft height="14px" />+ Back+ </Button>+ </StyledBackBtn>+ {provider.getManagementUrl && (+ <a+ key={1}+ href={provider.getManagementUrl()}+ target="_blank"+ rel="noopener noreferrer"+ style={{textDecoration: 'underline'}}+ >+ Go to your Kepler.gl {provider.displayName} page+ </a>+ )}+ </StyledStorageHeader><StyledProviderVisSection><span className="title"><span>{currentProvider}</span> Storage / Mapsdiff --git a/src/components/modals/save-map-modal.js b/src/components/modals/save-map-modal.jsindex 8a45d1d20..5f9db0054 100644--- a/src/components/modals/save-map-modal.js+++ b/src/components/modals/save-map-modal.js@@ -23,7 +23,7 @@ import PropTypes from 'prop-types';import styled from 'styled-components';import CloudTile from './cloud-tile';import ImageModalContainer from './image-modal-container';-import {UploadAnimation} from './status-panel';+import StatusPanel, {UploadAnimation} from './status-panel';import {MAP_THUMBNAIL_DIMENSION, MAP_INFO_CHARACTER} from 'constants/default-settings';@@ -156,6 +156,7 @@ function SaveMapModalFactory() {cloudProviders,isProviderLoading,currentProvider,+ providerError,onSetCloudProvider,onUpdateImageSetting} = this.props;@@ -192,6 +193,22 @@ function SaveMapModalFactory() {))}</div></StyledExportSection>+ {provider && provider.getManagementUrl && (+ <StyledExportSection style={{margin: '2px 0'}}>+ <div className="description" />+ <div className="selection">+ <a+ key={1}+ href={provider.getManagementUrl()}+ target="_blank"+ rel="noopener noreferrer"+ style={{textDecoration: 'underline'}}+ >+ Go to your Kepler.gl {provider.displayName} page+ </a>+ </div>+ </StyledExportSection>+ )}<StyledExportSection><div className="description image-preview-panel"><ImagePreview@@ -212,6 +229,13 @@ function SaveMapModalFactory() {/>)}</StyledExportSection>+ {providerError ? (+ <StatusPanel+ isLoading={false}+ error={providerError}+ providerIcon={provider && provider.icon}+ />+ ) : null}</StyledModalContent></StyledSaveMapModal></ImageModalContainer>diff --git a/src/components/modals/share-map-modal.js b/src/components/modals/share-map-modal.jsindex 69abcae9a..ca38fa8fa 100644--- a/src/components/modals/share-map-modal.js+++ b/src/components/modals/share-map-modal.js@@ -167,7 +167,7 @@ export default function ShareMapUrlModalFactory() {</div><div className="selection"><SharingUrl key={0} url={shareUrl} />- {folderLink && (+ {provider && folderLink && (<akey={1}href={folderLink}@@ -175,7 +175,7 @@ export default function ShareMapUrlModalFactory() {rel="noopener noreferrer"style={{textDecoration: 'underline'}}>- Go to your Kepler.gl {currentProvider} page+ Go to your Kepler.gl {provider.displayName} page</a>)}</div>diff --git a/src/components/notification-panel.js b/src/components/notification-panel.jsindex 833f33383..a63b485c9 100644--- a/src/components/notification-panel.js+++ b/src/components/notification-panel.js@@ -31,7 +31,7 @@ const NotificationPanelContent = styled.div`flex-direction: column;align-items: flex-end;padding: 4px;- overflow-y: scroll;+ overflow-y: auto;overflow-x: hidden;position: absolute;top: 1em;diff --git a/src/components/side-panel.js b/src/components/side-panel.jsindex 55bc326dc..f4a51ef30 100644--- a/src/components/side-panel.js+++ b/src/components/side-panel.js@@ -117,15 +117,6 @@ export default function SidePanelFactory(availableProviders: {}};- static defaultProps = {- panels: SIDEBAR_PANELS,- uiState: {},- visStateActions: {},- mapStyleActions: {},- uiStateActions: {},- availableProviders: {}- };-/* component private functions */_onOpenOrClose = () => {this.props.uiStateActions.toggleSidePanel(diff --git a/src/reducers/map-state-updaters.js b/src/reducers/map-state-updaters.jsindex fd366f12d..517fbbb88 100644--- a/src/reducers/map-state-updaters.js+++ b/src/reducers/map-state-updaters.js@@ -165,7 +165,7 @@ export const receiveMapConfigUpdater = (state,{payload: {config = {}, options = {}, bounds = null}}) => {- const {mapState} = config;+ const {mapState} = config || {};// merged received mapstate with previous statelet mergedState = {...state, ...mapState};diff --git a/src/reducers/map-style-updaters.js b/src/reducers/map-style-updaters.jsindex 335d14b60..4d39a2d1a 100644--- a/src/reducers/map-style-updaters.js+++ b/src/reducers/map-style-updaters.js@@ -354,7 +354,7 @@ export const requestMapStylesUpdater = (state, {payload: mapStyles}) => {* @returns {Object} nextState or `react-pam` tasks to load map style object*/export const receiveMapConfigUpdater = (state, {payload: {config = {}}}) => {- const {mapStyle} = config;+ const {mapStyle} = config || {};if (!mapStyle) {return state;diff --git a/website/webpack.config.js b/website/webpack.config.jsindex ae5ceb052..edecdbe72 100644--- a/website/webpack.config.js+++ b/website/webpack.config.js@@ -138,6 +138,7 @@ const COMMON_CONFIG = {new webpack.EnvironmentPlugin({MapboxAccessToken: undefined,DropboxClientId: null,+ CartoClientId: null,GoogleDriveClientId: null,MapboxExportToken: null,UNFOLDED_API_URL: null,@@ -211,9 +212,7 @@ module.exports = env => {}if (!process.env.DropboxClientId) {logError('Error! DropboxClientId is not defined');- logInstruction(- `Make sure to run "export MapboxExportToken=<token>" before deploy the website`- );+ 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');}