Skip to content

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

[fix] disable Share Map for FSQ provider (#2808)

Igor Dykhtab4dfa2fcedc2
diff --git a/README.md b/README.md
index dd31ef5c9..05a7ca156 100644
--- a/README.md
+++ b/README.md
@@ -54,29 +54,29 @@ Kepler.gl is also a React component that uses [Redux](https://redux.js.org/) to
Use Node 18.18.2 or above, older node versions have not been supported/ tested.
For best results, use [nvm](https://github.com/creationix/nvm) `nvm install`.
-## Install kepler.gl
+## Install kepler.gl modules
-Install node (`> 18.18.2`), yarn, and project dependencies
+Kepler.gl consists of different modules. Each module can be added to the project like this:
```sh
-npm install --save kepler.gl
+npm install --save @kepler.gl/components
// or
-yarn add kepler.gl
+yarn add @kepler.gl/components
```
kepler.gl is built upon [mapbox][mapbox]. You will need a [Mapbox Access Token][mapbox-token] to use it.
If you don't use a module bundler, it's also fine. Kepler.gl npm package includes precompiled production UMD builds in the [umd folder](https://unpkg.com/kepler.gl/umd).
-You can add the script tag to your html file as it follows:
+You can add the script tag to your html file as it follows (latest version of Kepler.gl):
```html
<script src="https://unpkg.com/kepler.gl/umd/keplergl.min.js" />
```
-or if you would like, you can load a specific version
+or if you would like, you can load a specific version:
```html
-<script src="https://unpkg.com/[email protected]/umd/keplergl.min.js" />
+<script src="https://unpkg.com/[email protected]/umd/keplergl.min.js" />
```
## Develop kepler.gl
diff --git a/examples/demo-app/src/cloud-providers/foursquare/foursquare-provider.js b/examples/demo-app/src/cloud-providers/foursquare/foursquare-provider.js
index a2cb4bdc0..1493b9e69 100644
--- a/examples/demo-app/src/cloud-providers/foursquare/foursquare-provider.js
+++ b/examples/demo-app/src/cloud-providers/foursquare/foursquare-provider.js
@@ -12,6 +12,7 @@ const STORAGE_MESSAGE = 'modal.loadStorageMap.foursquareStorageMessage';
const APP_NAME = 'Kepler.gl';
const FOURSQUARE_PRIVATE_STORAGE_ENABLED = true;
+const FOURSQUARE_SHARING_ENABLED = false;
const FOURSQUARE_AUTH_AUDIENCE = 'https://foursquare.com/api/';
const FOURSQUARE_AUTH_SCOPE = 'openid profile email';
@@ -87,6 +88,10 @@ export default class FoursquareProvider extends Provider {
return FOURSQUARE_PRIVATE_STORAGE_ENABLED;
}
+ hasSharingUrl() {
+ return FOURSQUARE_SHARING_ENABLED;
+ }
+
async getUser() {
return this._auth0.getUser();
}
@@ -128,9 +133,9 @@ export default class FoursquareProvider extends Provider {
}
);
- const createMap = await mapResponse.json();
+ const createdMap = await mapResponse.json();
- await fetch(`${this.apiURL}/v1/maps/${createMap.id}/thumbnail`, {
+ await fetch(`${this.apiURL}/v1/maps/${createdMap.id}/thumbnail`, {
method: 'PUT',
headers: {
...headers,
diff --git a/src/components/src/modals/share-map-modal.tsx b/src/components/src/modals/share-map-modal.tsx
index d83eed3bb..6ac71889f 100644
--- a/src/components/src/modals/share-map-modal.tsx
+++ b/src/components/src/modals/share-map-modal.tsx
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {useEffect, useState} from 'react';
+import React, {useEffect, useState, useMemo} from 'react';
import styled, {ThemeProvider} from 'styled-components';
import {CopyToClipboard} from 'react-copy-to-clipboard';
import {themeLT} from '@kepler.gl/styles';
@@ -82,6 +82,11 @@ const StyledInnerDiv = styled.div`
const UNDERLINE_TEXT_DECORATION_STYLE = {textDecoration: 'underline'};
const ShareMapHeader = ({cloudProviders}) => {
+ const shareableCloudProviders = useMemo(
+ () => cloudProviders.filter(cp => cp.hasSharingUrl()),
+ [cloudProviders]
+ );
+
return (
<StyledExportSection>
<div className="description">
@@ -89,7 +94,7 @@ const ShareMapHeader = ({cloudProviders}) => {
<FormattedMessage id={'modal.shareMap.title'} />
</div>
</div>
- <ProviderSelect cloudProviders={cloudProviders} />
+ <ProviderSelect cloudProviders={shareableCloudProviders} />
</StyledExportSection>
);
};