Skip to content

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

[Chore]: Technical: Isolate actions (#1948)

dariaterekhovaae8ea93d4061d1
diff --git a/package.json b/package.json
index a4c0199ca..3b0e07ef8 100644
--- a/package.json
+++ b/package.json
@@ -26,7 +26,8 @@
"./src/layers",
"./src/cloud-providers",
"./src/processors",
- "./src/tasks"
+ "./src/tasks",
+ "./src/actions"
],
"repository": {
"type": "git",
diff --git a/src/actions/babel.config.js b/src/actions/babel.config.js
new file mode 100644
index 000000000..0672a8d63
--- /dev/null
+++ b/src/actions/babel.config.js
@@ -0,0 +1,64 @@
+// Copyright (c) 2022 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.
+
+const KeplerPackage = require('./package');
+
+const PRESETS = ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'];
+const PLUGINS = [
+ ['@babel/plugin-transform-typescript', {isTSX: true, allowDeclareFields: true}],
+ '@babel/plugin-transform-modules-commonjs',
+ '@babel/plugin-proposal-optional-chaining',
+ [
+ '@babel/transform-runtime',
+ {
+ regenerator: true
+ }
+ ],
+ [
+ 'search-and-replace',
+ {
+ rules: [
+ {
+ search: '__PACKAGE_VERSION__',
+ replace: KeplerPackage.version
+ }
+ ]
+ }
+ ]
+];
+const ENV = {
+ test: {
+ plugins: ['istanbul']
+ },
+ debug: {
+ sourceMaps: 'inline',
+ retainLines: true
+ }
+};
+
+module.exports = function babel(api) {
+ api.cache(true);
+
+ return {
+ presets: PRESETS,
+ plugins: PLUGINS,
+ env: ENV
+ };
+};
diff --git a/src/actions/package.json b/src/actions/package.json
new file mode 100644
index 000000000..1d1ed2ce1
--- /dev/null
+++ b/src/actions/package.json
@@ -0,0 +1,47 @@
+{
+ "name": "@kepler.gl/actions",
+ "author": "Shan He <[email protected]>",
+ "version": "2.5.5",
+ "description": "kepler.gl constants used by kepler.gl components, actions and reducers",
+ "license": "MIT",
+ "main": "dist/index.js",
+ "types": "dist/index.d.ts",
+ "keywords": [
+ "babel",
+ "es6",
+ "react",
+ "webgl",
+ "visualization",
+ "deck.gl"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/keplergl/kepler.gl.git"
+ },
+ "scripts": {
+ "build": "rm -fr dist && babel src --out-dir dist --source-maps inline --extensions '.ts,.tsx,.js,.jsx' --ignore '**/*.d.ts'",
+ "build:umd": "webpack --config ./webpack/umd.js --progress --env.prod",
+ "build:types": "tsc --project ./tsconfig.production.json",
+ "prepublish": "uber-licence && yarn build && yarn build:types",
+ "stab": "mkdir -p dist && touch dist/index.js"
+ },
+ "files": [
+ "dist",
+ "umd"
+ ],
+ "nyc": {
+ "sourceMap": false,
+ "instrument": false
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "maintainers": [
+ "Shan He <[email protected]>",
+ "Giuseppe Macri <[email protected]>"
+ ],
+ "volta": {
+ "node": "12.22.0",
+ "yarn": "1.22.17"
+ }
+}
diff --git a/src/actions/action-types.ts b/src/actions/src/action-types.ts
similarity index 100%
rename from src/actions/action-types.ts
rename to src/actions/src/action-types.ts
diff --git a/src/actions/action-wrapper.ts b/src/actions/src/action-wrapper.ts
similarity index 100%
rename from src/actions/action-wrapper.ts
rename to src/actions/src/action-wrapper.ts
diff --git a/src/actions/actions.ts b/src/actions/src/actions.ts
similarity index 100%
rename from src/actions/actions.ts
rename to src/actions/src/actions.ts
diff --git a/src/actions/identity-actions.ts b/src/actions/src/identity-actions.ts
similarity index 100%
rename from src/actions/identity-actions.ts
rename to src/actions/src/identity-actions.ts
diff --git a/src/actions/index.ts b/src/actions/src/index.ts
similarity index 79%
rename from src/actions/index.ts
rename to src/actions/src/index.ts
index a37ce695c..6469346ea 100644
--- a/src/actions/index.ts
+++ b/src/actions/src/index.ts
@@ -22,6 +22,7 @@
export * from './actions';
// kepler.gl actions accessible outside component
+export * from './action-wrapper';
export * from './vis-state-actions';
export * from './ui-state-actions';
export * from './map-state-actions';
@@ -29,6 +30,13 @@ export * from './map-style-actions';
export * from './identity-actions';
export * from './provider-actions';
+/* eslint-disable prettier/prettier */
+export * as VisStateActions from './vis-state-actions';
+export * as MapStateActions from './map-state-actions';
+export * as MapStyleActions from './map-style-actions';
+export * as UIStateActions from './ui-state-actions';
+export * as ProviderActions from './provider-actions';
+
// Dispatch
export {
_actionFor,
@@ -41,3 +49,4 @@ export {
export {ACTION_PREFIX} from './action-types';
export {default as ActionTypes} from './action-types';
+export {ActionTypes as ProviderActionTypes} from './provider-actions';
diff --git a/src/actions/map-state-actions.ts b/src/actions/src/map-state-actions.ts
similarity index 100%
rename from src/actions/map-state-actions.ts
rename to src/actions/src/map-state-actions.ts
diff --git a/src/actions/map-style-actions.ts b/src/actions/src/map-style-actions.ts
similarity index 100%
rename from src/actions/map-style-actions.ts
rename to src/actions/src/map-style-actions.ts
diff --git a/src/actions/provider-actions.ts b/src/actions/src/provider-actions.ts
similarity index 91%
rename from src/actions/provider-actions.ts
rename to src/actions/src/provider-actions.ts
index b6691c0b6..3271fd120 100644
--- a/src/actions/provider-actions.ts
+++ b/src/actions/src/provider-actions.ts
@@ -20,7 +20,7 @@
import {createAction} from '@reduxjs/toolkit';
import {ACTION_PREFIX} from './action-types';
-import {SavedMap} from 'schemas';
+import {ExportFileOptions, ExportFileToCloudPayload, OnErrorCallBack, OnSuccessCallBack} from '@kepler.gl/types';
import {MapListItem, Provider} from 'cloud-providers';
// eslint-disable-next-line prettier/prettier
@@ -40,30 +40,6 @@ export const ActionTypes = assignType({
GET_SAVED_MAPS_ERROR: `${ACTION_PREFIX}GET_SAVED_MAPS_ERROR`
});
-/** EXPORT_FILE_TO_CLOUD */
-export type MapData = {
- map: SavedMap;
- thumbnail: Blob | null;
-};
-export type ExportFileOptions = {
- isPublic?: boolean;
- overwrite?: boolean;
-};
-export type OnErrorCallBack = (error: Error) => any;
-export type OnSuccessCallBack = (p: {
- response: any;
- provider: Provider;
- options: ExportFileOptions;
-}) => any;
-
-export type ExportFileToCloudPayload = {
- mapData: MapData;
- provider: Provider;
- options: ExportFileOptions;
- onSuccess?: OnSuccessCallBack;
- onError?: OnErrorCallBack;
- closeModal?: boolean;
-};
/**
* Call provider to upload file to cloud
* @param mapData
diff --git a/src/actions/ui-state-actions.ts b/src/actions/src/ui-state-actions.ts
similarity index 100%
rename from src/actions/ui-state-actions.ts
rename to src/actions/src/ui-state-actions.ts
diff --git a/src/actions/vis-state-actions.ts b/src/actions/src/vis-state-actions.ts
similarity index 99%
rename from src/actions/vis-state-actions.ts
rename to src/actions/src/vis-state-actions.ts
index 2611dbe92..688b9f11f 100644
--- a/src/actions/vis-state-actions.ts
+++ b/src/actions/src/vis-state-actions.ts
@@ -1175,6 +1175,7 @@ type FileContent = {
};
export type NextFileBatchUpdaterAction = {
payload: {
+ /* eslint-disable no-undef */
gen: AsyncGenerator<FileContent>;
fileName: string;
progress?: any;
diff --git a/src/actions/tsconfig.production.json b/src/actions/tsconfig.production.json
new file mode 100644
index 000000000..177b41700
--- /dev/null
+++ b/src/actions/tsconfig.production.json
@@ -0,0 +1,33 @@
+{
+ "compilerOptions": {
+ "target": "es2020",
+ "allowJs": false,
+ "checkJs": false,
+ "jsx": "react",
+ "module": "esnext",
+ "moduleResolution": "node",
+ "declaration":true,
+ "emitDeclarationOnly":true,
+ "noImplicitAny": false,
+ "noImplicitReturns": true,
+ "noImplicitThis": true,
+ "noUnusedLocals": false, //TODO needs to be removed once all isolations are ready
+ "outDir": "dist",
+ "sourceMap": true,
+ "strictNullChecks": true,
+ "suppressImplicitAnyIndexErrors": false,
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
+ "skipLibCheck": true,
+ "strict": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "baseUrl": "../../src", //TODO change once all dependencies are isolated
+ "paths": {
+ "@kepler.gl/actions": ["actions/src"] //TODO change once all dependencies are isolated
+ }
+ },
+ "include": [
+ "src"
+ ]
+}
diff --git a/src/cloud-providers/src/provider.ts b/src/cloud-providers/src/provider.ts
index c95719329..add52ccbd 100644
--- a/src/cloud-providers/src/provider.ts
+++ b/src/cloud-providers/src/provider.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {Upload} from 'components/common/icons';
-import {MapData, ExportFileOptions} from 'actions/provider-actions';
+import {MapData, ExportFileOptions} from '@kepler.gl/types';
import {ComponentType} from 'react';
export type Millisecond = number;
diff --git a/src/components/container.tsx b/src/components/container.tsx
index 973a999ad..8c0981ee2 100644
--- a/src/components/container.tsx
+++ b/src/components/container.tsx
@@ -24,9 +24,8 @@ import memoize from 'lodash.memoize';
import {console as Console} from 'global/window';
import {injector, provideRecipesToInjector, flattenDeps} from './injector';
import KeplerGlFactory from './kepler-gl';
-import {forwardTo} from 'actions/action-wrapper';
-import {registerEntry, deleteEntry, renameEntry} from 'actions/identity-actions';
+import {registerEntry, deleteEntry, renameEntry, forwardTo} from '@kepler.gl/actions';
import {notNullorUndefined} from '@kepler.gl/utils';
import {KeplerGlState} from 'reducers/core';
diff --git a/src/components/filters/types.ts b/src/components/filters/types.ts
index c453d83b0..7e36e6dba 100644
--- a/src/components/filters/types.ts
+++ b/src/components/filters/types.ts
@@ -14,7 +14,7 @@ import {
setFilterPlot,
toggleFilterAnimation,
updateFilterAnimationSpeed
-} from 'actions';
+} from '@kepler.gl/actions';
import {Datasets} from 'reducers/table-utils/kepler-table';
export type PolygonFilterProps = {
diff --git a/src/components/kepler-gl.tsx b/src/components/kepler-gl.tsx
index a33c781a9..d83081c6e 100644
--- a/src/components/kepler-gl.tsx
+++ b/src/components/kepler-gl.tsx
@@ -27,13 +27,15 @@ import {connect as keplerGlConnect} from 'connect/keplergl-connect';
import {IntlProvider} from 'react-intl';
import {messages} from '@kepler.gl/localization';
import {RootContext, FeatureFlagsContextProvider, FeatureFlags} from 'components/context';
-import {OnErrorCallBack, OnSuccessCallBack} from 'actions/provider-actions';
+import {OnErrorCallBack, OnSuccessCallBack} from '@kepler.gl/types';
-import * as VisStateActions from 'actions/vis-state-actions';
-import * as MapStateActions from 'actions/map-state-actions';
-import * as MapStyleActions from 'actions/map-style-actions';
-import * as UIStateActions from 'actions/ui-state-actions';
-import * as ProviderActions from 'actions/provider-actions';
+import {
+ MapStateActions,
+ MapStyleActions,
+ ProviderActions,
+ UIStateActions,
+ VisStateActions
+} from '@kepler.gl/actions';
type KeplerGlActions = {
visStateActions: typeof VisStateActions;
diff --git a/src/components/map-container.tsx b/src/components/map-container.tsx
index 3208d4d03..e923a038c 100644
--- a/src/components/map-container.tsx
+++ b/src/components/map-container.tsx
@@ -26,9 +26,7 @@ import {createSelector} from 'reselect';
import WebMercatorViewport from 'viewport-mercator-project';
import mapboxgl from 'mapbox-gl';
-import * as VisStateActions from 'actions/vis-state-actions';
-import * as MapStateActions from 'actions/map-state-actions';
-import * as UIStateActions from 'actions/ui-state-actions';
+import {VisStateActions, MapStateActions, UIStateActions} from '@kepler.gl/actions';
// components
import MapPopoverFactory from 'components/map/map-popover';
diff --git a/src/components/modal-container.tsx b/src/components/modal-container.tsx
index b94a90fee..d2bb9e5fd 100644
--- a/src/components/modal-container.tsx
+++ b/src/components/modal-container.tsx
@@ -61,13 +61,15 @@ import {
import {getFileFormatNames, getFileExtensions} from 'reducers/vis-state-selectors';
import {MapStyle} from 'reducers';
-import {MapState, UiState, OnSuccessCallBack, OnErrorCallBack} from '@kepler.gl/types';
+import {MapState, UiState, OnErrorCallBack, OnSuccessCallBack} from '@kepler.gl/types';
import {ProviderState} from 'reducers/provider-state-updaters';
-import * as VisStateActions from 'actions/vis-state-actions';
-import * as UIStateActions from 'actions/ui-state-actions';
-import * as MapStyleActions from 'actions/map-style-actions';
-import * as ProviderActions from 'actions/provider-actions';
+import {
+ VisStateActions,
+ UIStateActions,
+ MapStyleActions,
+ ProviderActions
+} from '@kepler.gl/actions';
import {ModalDialogProps} from './common/modal';
import {Provider} from 'cloud-providers';
import {findDOMNode} from 'react-dom';
diff --git a/src/components/modals/export-map-modal/export-html-map.tsx b/src/components/modals/export-map-modal/export-html-map.tsx
index 4a3a0e47a..59a88954e 100644
--- a/src/components/modals/export-map-modal/export-html-map.tsx
+++ b/src/components/modals/export-map-modal/export-html-map.tsx
@@ -31,7 +31,7 @@ import {injectIntl} from 'react-intl';
import {FormattedMessage} from '@kepler.gl/localization';
import {IntlShape} from 'react-intl';
-import {setUserMapboxAccessToken, setExportHTMLMapMode, ActionHandler} from 'actions';
+import {setUserMapboxAccessToken, setExportHTMLMapMode, ActionHandler} from '@kepler.gl/actions';
const ExportMapStyledExportSection = styled(StyledExportSection)`
.disclaimer {
diff --git a/src/components/modals/export-map-modal/export-map-modal.tsx b/src/components/modals/export-map-modal/export-map-modal.tsx
index ac51365b8..447dd5f48 100644
--- a/src/components/modals/export-map-modal/export-map-modal.tsx
+++ b/src/components/modals/export-map-modal/export-map-modal.tsx
@@ -27,7 +27,7 @@ import {StyledExportMapSection} from './components';
import ExportHtmlMapFactory from './export-html-map';
import ExportJsonMapFactory from './export-json-map';
import {FormattedMessage} from '@kepler.gl/localization';
-import {ActionHandler, setExportHTMLMapMode, setUserMapboxAccessToken} from 'actions';
+import {ActionHandler, setExportHTMLMapMode, setUserMapboxAccessToken} from '@kepler.gl/actions';
interface ExportMapModalFactoryProps {
options?: {format: string};
diff --git a/src/components/modals/image-modal-container.tsx b/src/components/modals/image-modal-container.tsx
index 78c6f3502..396e7616a 100644
--- a/src/components/modals/image-modal-container.tsx
+++ b/src/components/modals/image-modal-container.tsx
@@ -22,7 +22,7 @@ import React, {useEffect} from 'react';
import get from 'lodash.get';
import {MAP_THUMBNAIL_DIMENSION, EXPORT_IMG_RATIOS} from '@kepler.gl/constants';
-import {SetExportImageSettingUpdaterAction} from 'actions';
+import {SetExportImageSettingUpdaterAction} from '@kepler.gl/actions';
import {Provider} from '@kepler.gl/cloud-providers';
/** @typedef {import('./image-modal-container').ImageModalContainerProps} ImageModalContainerProps */
diff --git a/src/components/modals/provider-modal-container.tsx b/src/components/modals/provider-modal-container.tsx
index bbfcbf016..0a2ef12fe 100644
--- a/src/components/modals/provider-modal-container.tsx
+++ b/src/components/modals/provider-modal-container.tsx
@@ -20,7 +20,7 @@
import React, {Component} from 'react';
import {Provider} from 'cloud-providers';
-import {SetCloudProviderPayload} from 'actions';
+import {SetCloudProviderPayload} from '@kepler.gl/actions';
export type ProviderModalContainerProps = {
cloudProviders?: Provider[];
diff --git a/src/components/notification-panel.tsx b/src/components/notification-panel.tsx
index c6819e146..f15aaa04e 100644
--- a/src/components/notification-panel.tsx
+++ b/src/components/notification-panel.tsx
@@ -24,7 +24,7 @@ import styled from 'styled-components';
import NotificationItemFactory from './notification-panel/notification-item';
import {DEFAULT_NOTIFICATION_TOPICS} from '@kepler.gl/constants';
import {Notifications} from '@kepler.gl/types';
-import {removeNotification} from 'actions/ui-state-actions';
+import {removeNotification} from '@kepler.gl/actions';
const NotificationPanelContent = styled.div`
background: transparent;
diff --git a/src/components/notification-panel/notification-item.tsx b/src/components/notification-panel/notification-item.tsx
index ebb6f8c92..96445ad6d 100644
--- a/src/components/notification-panel/notification-item.tsx
+++ b/src/components/notification-panel/notification-item.tsx
@@ -22,7 +22,7 @@ import React, {Component} from 'react';
import styled from 'styled-components';
import {Delete, Info, Warning, Checkmark} from 'components/common/icons';
import ReactMarkdown from 'react-markdown';
-import {ActionHandler, removeNotification as removeNotificationActions} from 'actions';
+import {ActionHandler, removeNotification as removeNotificationActions} from '@kepler.gl/actions';
interface NotificationItemContentProps {
type: string;
diff --git a/src/components/plot-container.tsx b/src/components/plot-container.tsx
index 4ee4843d1..5e7200dab 100644
--- a/src/components/plot-container.tsx
+++ b/src/components/plot-container.tsx
@@ -37,7 +37,11 @@ import MapsLayoutFactory from './maps-layout';
import {GEOCODER_LAYER_ID, ExportImage} from '@kepler.gl/constants';
import {SplitMap} from '@kepler.gl/types';
-import {setExportImageDataUri, setExportImageError, setExportImageSetting} from 'actions';
+import {
+ setExportImageDataUri,
+ setExportImageError,
+ setExportImageSetting
+} from '@kepler.gl/actions';
import {mapFieldsSelector} from './kepler-gl';
const CLASS_FILTER = ['mapboxgl-control-container', 'attrition-link', 'attrition-logo'];
diff --git a/src/components/side-panel/common/types.ts b/src/components/side-panel/common/types.ts
index 62773b24e..06368f3a5 100644
--- a/src/components/side-panel/common/types.ts
+++ b/src/components/side-panel/common/types.ts
@@ -1,7 +1,7 @@
import React, {MouseEvent} from 'react';
-import {openDeleteModal} from 'actions/ui-state-actions';
-import * as VisStateActions from 'actions/vis-state-actions';
-import {ActionHandler} from 'actions';
+import {openDeleteModal} from '@kepler.gl/actions';
+import {VisStateActions} from '@kepler.gl/actions';
+import {ActionHandler} from '@kepler.gl/actions';
import KeplerTable, {Datasets} from 'reducers/table-utils/kepler-table';
export type DatasetInfoProps = {
diff --git a/src/components/side-panel/filter-manager.tsx b/src/components/side-panel/filter-manager.tsx
index e09420dda..f6dc18750 100644
--- a/src/components/side-panel/filter-manager.tsx
+++ b/src/components/side-panel/filter-manager.tsx
@@ -26,8 +26,7 @@ import SourceDataCatalogFactory from './common/source-data-catalog';
import FilterPanelFactory from './filter-panel/filter-panel';
import {Filter} from '@kepler.gl/types';
import {Layer} from '@kepler.gl/layers';
-import * as VisStateActions from 'actions/vis-state-actions';
-import {ActionHandler} from 'actions';
+import {VisStateActions, ActionHandler} from '@kepler.gl/actions';
import {Datasets} from 'reducers/table-utils/kepler-table';
type FilterManagerProps = {
diff --git a/src/components/side-panel/interaction-manager.tsx b/src/components/side-panel/interaction-manager.tsx
index e6e788509..ba0847dc0 100644
--- a/src/components/side-panel/interaction-manager.tsx
+++ b/src/components/side-panel/interaction-manager.tsx
@@ -21,7 +21,7 @@
import React from 'react';
import {InteractionConfig} from '@kepler.gl/types';
import InteractionPanelFactory from './interaction-panel/interaction-panel';
-import * as VisStateActions from 'actions/vis-state-actions';
+import {VisStateActions} from '@kepler.gl/actions';
import {Datasets} from 'reducers/table-utils/kepler-table';
type InteractionManagerProps = {
diff --git a/src/components/side-panel/layer-manager.tsx b/src/components/side-panel/layer-manager.tsx
index fab65c100..ba59342d6 100644
--- a/src/components/side-panel/layer-manager.tsx
+++ b/src/components/side-panel/layer-manager.tsx
@@ -36,11 +36,9 @@ import {PanelLabel, SidePanelDivider, SidePanelSection} from 'components/common/
import {LAYER_BLENDINGS} from '@kepler.gl/constants';
import {Layer, LayerClassesType} from '@kepler.gl/layers';
-import * as UiStateActions from 'actions/ui-state-actions';
-import * as VisStateActions from 'actions/vis-state-actions';
+import {UIStateActions, VisStateActions, ActionHandler} from '@kepler.gl/actions';
import {SidePanelItem} from 'components/types';
import {LayerPanelListView} from '@kepler.gl/types';
-import {ActionHandler} from 'actions';
import {Datasets} from 'reducers/table-utils/kepler-table';
type LayerBlendingSelectorProps = {
@@ -54,10 +52,10 @@ type LayerManagerProps = {
layerOrder: number[];
layerClasses: LayerClassesType;
layerBlending: string;
- uiStateActions: typeof UiStateActions;
+ uiStateActions: typeof UIStateActions;
visStateActions: typeof VisStateActions;
showAddDataModal: () => void;
- removeDataset: ActionHandler<typeof UiStateActions.openDeleteModal>;
+ removeDataset: ActionHandler<typeof UIStateActions.openDeleteModal>;
showDatasetTable: ActionHandler<typeof VisStateActions.showDatasetTable>;
updateTableColor: ActionHandler<typeof VisStateActions.updateTableColor>;
layerPanelListView: LayerPanelListView;
diff --git a/src/components/side-panel/layer-panel/dataset-layer-group.tsx b/src/components/side-panel/layer-panel/dataset-layer-group.tsx
index 373f6f958..4ee251e73 100644
--- a/src/components/side-panel/layer-panel/dataset-layer-group.tsx
+++ b/src/components/side-panel/layer-panel/dataset-layer-group.tsx
@@ -22,9 +22,7 @@ import React, {useMemo} from 'react';
import DatasetLayerSectionFactory from './dataset-layer-section';
import {Layer, LayerClassesType} from '@kepler.gl/layers';
-import * as UiStateActions from 'actions/ui-state-actions';
-import * as VisStateActions from 'actions/vis-state-actions';
-import {ActionHandler} from 'actions';
+import {UIStateActions, VisStateActions, ActionHandler} from '@kepler.gl/actions';
import {Datasets} from 'reducers/table-utils/kepler-table';
type DatasetLayerGroupProps = {
@@ -33,10 +31,10 @@ type DatasetLayerGroupProps = {
layerOrder: number[];
layerClasses: LayerClassesType;
showDeleteDataset: boolean;
- removeDataset: ActionHandler<typeof UiStateActions.openDeleteModal>;
+ removeDataset: ActionHandler<typeof UIStateActions.openDeleteModal>;
showDatasetTable: ActionHandler<typeof VisStateActions.showDatasetTable>;
updateTableColor: ActionHandler<typeof VisStateActions.updateTableColor>;
- uiStateActions: typeof UiStateActions;
+ uiStateActions: typeof UIStateActions;
visStateActions: typeof VisStateActions;
};
diff --git a/src/components/side-panel/layer-panel/dataset-layer-section.tsx b/src/components/side-panel/layer-panel/dataset-layer-section.tsx
index 75d608be7..3bd17cb7e 100644
--- a/src/components/side-panel/layer-panel/dataset-layer-section.tsx
+++ b/src/components/side-panel/layer-panel/dataset-layer-section.tsx
@@ -24,9 +24,7 @@ import styled from 'styled-components';
import SourceDataCatalogFactory from '../common/source-data-catalog';
import LayerListFactory from './layer-list';
import {Layer, LayerClassesType} from '@kepler.gl/layers';
-import * as UiStateActions from 'actions/ui-state-actions';
-import * as VisStateActions from 'actions/vis-state-actions';
-import {ActionHandler} from 'actions';
+import {UIStateActions, ActionHandler, VisStateActions} from '@kepler.gl/actions';
import KeplerTable from 'reducers/table-utils/kepler-table';
type DatasetLayerSectionProps = {
@@ -37,8 +35,8 @@ type DatasetLayerSectionProps = {
showDeleteDataset: boolean;
showDatasetTable: ActionHandler<typeof VisStateActions.showDatasetTable>;
updateTableColor: ActionHandler<typeof VisStateActions.updateTableColor>;
- removeDataset: ActionHandler<typeof UiStateActions.openDeleteModal>;
- uiStateActions: typeof UiStateActions;
+ removeDataset: ActionHandler<typeof UIStateActions.openDeleteModal>;
+ uiStateActions: typeof UIStateActions;
visStateActions: typeof VisStateActions;
};
diff --git a/src/components/side-panel/layer-panel/dataset-section.tsx b/src/components/side-panel/layer-panel/dataset-section.tsx
index 9f297b455..4b9ebf86b 100644
--- a/src/components/side-panel/layer-panel/dataset-section.tsx
+++ b/src/components/side-panel/layer-panel/dataset-section.tsx
@@ -25,9 +25,7 @@ import {Add} from 'components/common/icons';
import {Button} from 'components/common/styled-components';
import SourceDataCatalogFactory from '../common/source-data-catalog';
-import * as UiStateActions from 'actions/ui-state-actions';
-import * as VisStateActions from 'actions/vis-state-actions';
-import {ActionHandler} from 'actions';
+import {UIStateActions, VisStateActions, ActionHandler} from '@kepler.gl/actions';
import {Datasets} from 'reducers/table-utils/kepler-table';
type AddDataButtonProps = {
@@ -42,7 +40,7 @@ type DatasetSectionProps = {
showDeleteDataset: boolean;
showDatasetTable: ActionHandler<typeof VisStateActions.showDatasetTable>;
updateTableColor: ActionHandler<typeof VisStateActions.updateTableColor>;
- removeDataset: ActionHandler<typeof UiStateActions.openDeleteModal>;
+ removeDataset: ActionHandler<typeof UIStateActions.openDeleteModal>;
showAddDataModal: () => void;
};
diff --git a/src/components/side-panel/layer-panel/layer-configurator.tsx b/src/components/side-panel/layer-panel/layer-configurator.tsx
index 02892c53c..23d2b24ae 100644
--- a/src/components/side-panel/layer-panel/layer-configurator.tsx
+++ b/src/components/side-panel/layer-panel/layer-configurator.tsx
@@ -50,8 +50,7 @@ import {
} from '@kepler.gl/layers';
import {NestedPartial, RGBColor, LayerVisConfig, ColorUI, Field} from '@kepler.gl/types';
-import {toggleModal} from 'actions/ui-state-actions';
-import {ActionHandler} from 'actions';
+import {toggleModal, ActionHandler} from '@kepler.gl/actions';
import {Datasets} from 'reducers/table-utils/kepler-table';
type LayerConfiguratorProps = {
diff --git a/src/components/side-panel/layer-panel/layer-list.tsx b/src/components/side-panel/layer-panel/layer-list.tsx
index 0c3683d9f..f2cce489e 100644
--- a/src/components/side-panel/layer-panel/layer-list.tsx
+++ b/src/components/side-panel/layer-panel/layer-list.tsx
@@ -24,10 +24,9 @@ import classnames from 'classnames';
import {SortableContainer, SortableElement} from 'react-sortable-hoc';
import LayerPanelFactory from './layer-panel';
import {Layer, LayerClassesType} from '@kepler.gl/layers';
-import * as UiStateActions from 'actions/ui-state-actions';
-import * as VisStateActions from 'actions/vis-state-actions';
import {Datasets} from 'reducers/table-utils/kepler-table';
import {arrayMove} from '@kepler.gl/utils';
+import {UIStateActions, VisStateActions} from '@kepler.gl/actions';
type LayerListProps = {
datasets: Datasets;
@@ -35,7 +34,7 @@ type LayerListProps = {
layerOrder: number[];
layerClasses: LayerClassesType;
isSortable?: boolean;
- uiStateActions: typeof UiStateActions;
+ uiStateActions: typeof UIStateActions;
visStateActions: typeof VisStateActions;
};
diff --git a/src/components/side-panel/layer-panel/layer-panel.tsx b/src/components/side-panel/layer-panel/layer-panel.tsx
index c767ad065..9830d72bf 100644
--- a/src/components/side-panel/layer-panel/layer-panel.tsx
+++ b/src/components/side-panel/layer-panel/layer-panel.tsx
@@ -31,9 +31,7 @@ import LayerConfiguratorFactory from './layer-configurator';
import LayerPanelHeaderFactory from './layer-panel-header';
import {NestedPartial, LayerVisConfig, ColorUI} from '@kepler.gl/types';
import {Layer, LayerBaseConfig} from '@kepler.gl/layers';
-import {toggleModal} from 'actions/ui-state-actions';
-import * as VisStateActions from 'actions/vis-state-actions';
-import {ActionHandler} from 'actions';
+import {toggleModal, VisStateActions, ActionHandler} from '@kepler.gl/actions';
import {Datasets} from 'reducers/table-utils/kepler-table';
type LayerPanelProps = {
diff --git a/src/components/side-panel/map-manager.tsx b/src/components/side-panel/map-manager.tsx
index bf702c4e2..b02b18306 100644
--- a/src/components/side-panel/map-manager.tsx
+++ b/src/components/side-panel/map-manager.tsx
@@ -30,7 +30,7 @@ import {createSelector} from 'reselect';
import {injectIntl, WrappedComponentProps} from 'react-intl';
import {FormattedMessage} from '@kepler.gl/localization';
import {MapStyle} from 'reducers';
-import * as MapStyleActions from 'actions/map-style-actions';
+import {MapStyleActions} from '@kepler.gl/actions';
type MapManagerProps = {
mapStyle: MapStyle;
diff --git a/src/components/side-panel/panel-toggle.tsx b/src/components/side-panel/panel-toggle.tsx
index 79768ec78..d046909f6 100644
--- a/src/components/side-panel/panel-toggle.tsx
+++ b/src/components/side-panel/panel-toggle.tsx
@@ -21,8 +21,7 @@
import React, {useCallback} from 'react';
import styled from 'styled-components';
import PanelTabFactory, {PanelItem} from './panel-tab';
-import {toggleSidePanel} from 'actions/ui-state-actions';
-import {ActionHandler} from 'actions';
+import {toggleSidePanel, ActionHandler} from '@kepler.gl/actions';
type PanelToggleProps = {
panels: PanelItem[];
diff --git a/src/components/types.ts b/src/components/types.ts
index 77cc92512..61f71c99c 100644
--- a/src/components/types.ts
+++ b/src/components/types.ts
@@ -3,10 +3,12 @@ import {MapStyle} from 'reducers';
import {Layer, LayerClassesType} from '@kepler.gl/layers';
import {Filter, InteractionConfig, UiState} from '@kepler.gl/types';
-import * as MapStyleActions from 'actions/map-style-actions';
-import * as VisStateActions from 'actions/vis-state-actions';
-import * as MapStateActions from 'actions/map-state-actions';
-import * as UIStateActions from 'actions/ui-state-actions';
+import {
+ MapStyleActions,
+ VisStateActions,
+ MapStateActions,
+ UIStateActions
+} from '@kepler.gl/actions';
import {Datasets} from 'reducers/table-utils/kepler-table';
export type SidePanelItem = {
diff --git a/src/reducers/combined-updaters.ts b/src/reducers/combined-updaters.ts
index 8ab86c427..c5b63b6fc 100644
--- a/src/reducers/combined-updaters.ts
+++ b/src/reducers/combined-updaters.ts
@@ -33,7 +33,7 @@ import {payload_, apply_, with_, if_, compose_, merge_, pick_} from './composer-
import {MapState, UiState, AddDataToMapPayload, ParsedConfig} from '@kepler.gl/types';
import {MapStyle} from './map-style-updaters';
import {ProviderState} from './provider-state-updaters';
-import {loadFilesSuccessUpdaterAction} from 'actions/vis-state-actions';
+import {loadFilesSuccessUpdaterAction} from '@kepler.gl/actions';
import {VisState} from 'schemas';
import {Layer} from '@kepler.gl/layers';
import {isPlainObject} from '@kepler.gl/utils';
diff --git a/src/reducers/composers.ts b/src/reducers/composers.ts
index cb7a9f73e..6eec3c4f9 100644
--- a/src/reducers/composers.ts
+++ b/src/reducers/composers.ts
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {ActionTypes} from 'actions';
+import {ActionTypes} from '@kepler.gl/actions';
import * as combinedUpdaters from './combined-updaters';
/**
diff --git a/src/reducers/map-state-updaters.ts b/src/reducers/map-state-updaters.ts
index 04cf40daf..2f0563041 100644
--- a/src/reducers/map-state-updaters.ts
+++ b/src/reducers/map-state-updaters.ts
@@ -19,23 +19,8 @@
// THE SOFTWARE.
import {getCenterAndZoomFromBounds} from '@kepler.gl/utils';
-import * as MapStateActions from 'actions/map-state-actions';
-import {ReceiveMapConfigPayload} from '../actions/actions';
-import {ActionTypes} from 'actions';
-
-export type MapState = {
- pitch: number;
- bearing: number;
- latitude: number;
- longitude: number;
- zoom: number;
- dragRotate: boolean;
- width: number;
- height: number;
- isSplit: boolean;
- initialState?: any;
- scale?: number;
-};
+import {MapStateActions, ReceiveMapConfigPayload, ActionTypes} from '@kepler.gl/actions';
+import {MapState} from '@kepler.gl/types';
/**
* Updaters for `mapState` reducer. Can be used in your root reducer to directly modify kepler.gl's state.
diff --git a/src/reducers/map-state.ts b/src/reducers/map-state.ts
index 42943ca5f..9490cd768 100644
--- a/src/reducers/map-state.ts
+++ b/src/reducers/map-state.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {handleActions} from 'redux-actions';
-import {ActionTypes} from 'actions';
+import {ActionTypes} from '@kepler.gl/actions';
import * as mapStateUpdaters from './map-state-updaters';
/**
diff --git a/src/reducers/map-style-updaters.ts b/src/reducers/map-style-updaters.ts
index de4678f00..47d223186 100644
--- a/src/reducers/map-style-updaters.ts
+++ b/src/reducers/map-style-updaters.ts
@@ -38,14 +38,18 @@ import {
DEFAULT_LAYER_GROUPS,
DEFAULT_MAPBOX_API_URL
} from '@kepler.gl/constants';
-import {ActionTypes} from 'actions';
import {LOAD_MAP_STYLE_TASK} from '@kepler.gl/tasks';
-import {loadMapStyles, loadMapStyleErr} from 'actions/map-style-actions';
import {rgb} from 'd3-color';
import {RGBColor, LayerGroup, MapStyles, InputStyle, VisibleLayerGroups} from '@kepler.gl/types';
-import {ReceiveMapConfigPayload, KeplerGlInitPayload} from '../actions/actions';
-import * as MapStyleActions from '../actions/map-style-actions';
+import {
+ ActionTypes,
+ ReceiveMapConfigPayload,
+ KeplerGlInitPayload,
+ MapStyleActions,
+ loadMapStyles,
+ loadMapStyleErr
+} from '@kepler.gl/actions';
export type MapboxStyleUrl = string;
diff --git a/src/reducers/map-style.ts b/src/reducers/map-style.ts
index 96ad5e36a..7e4804245 100644
--- a/src/reducers/map-style.ts
+++ b/src/reducers/map-style.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {handleActions} from 'redux-actions';
-import {ActionTypes} from 'actions';
+import {ActionTypes} from '@kepler.gl/actions';
import * as mapStyleUpdaters from './map-style-updaters';
/**
diff --git a/src/reducers/provider-state-updaters.ts b/src/reducers/provider-state-updaters.ts
index 26842f749..f6ea088b3 100644
--- a/src/reducers/provider-state-updaters.ts
+++ b/src/reducers/provider-state-updaters.ts
@@ -36,21 +36,24 @@ import {
getSavedMapsSuccess,
getSavedMapsError,
loadCloudMapError,
- resetProviderStatus
-} from '../actions/provider-actions';
-import {removeNotification, toggleModal, addNotification} from '../actions/ui-state-actions';
-import {addDataToMap} from '../actions/actions';
+ resetProviderStatus,
+ removeNotification,
+ toggleModal,
+ addNotification,
+ addDataToMap,
+ ProviderActions
+} from '@kepler.gl/actions';
import {
DEFAULT_NOTIFICATION_TYPES,
DEFAULT_NOTIFICATION_TOPICS,
DATASET_FORMATS,
OVERWRITE_MAP_ID
} from '@kepler.gl/constants';
+import {ExportFileToCloudPayload} from '@kepler.gl/types';
import {FILE_CONFLICT_MSG} from '../cloud-providers';
import {DATASET_HANDLERS} from '@kepler.gl/processors';
-import * as ProviderActions from '../actions/provider-actions';
import {MapListItem} from '../cloud-providers';
type ActionPayload<P> = {
@@ -128,7 +131,7 @@ function createGlobalNotificationTasks({
*/
export const exportFileToCloudUpdater = (
state: ProviderState,
- action: ActionPayload<ProviderActions.ExportFileToCloudPayload>
+ action: ActionPayload<ExportFileToCloudPayload>
): ProviderState => {
const {mapData, provider, options = {}, onSuccess, onError, closeModal} = action.payload;
diff --git a/src/reducers/provider-state.ts b/src/reducers/provider-state.ts
index c63a631e2..dab82cb9b 100644
--- a/src/reducers/provider-state.ts
+++ b/src/reducers/provider-state.ts
@@ -20,7 +20,7 @@
import {handleActions} from 'redux-actions';
import * as providerStateUpdaters from './provider-state-updaters';
-import {ActionTypes} from 'actions/provider-actions';
+import {ProviderActionTypes as ActionTypes} from '@kepler.gl/actions';
/**
* Important: Do not rename `actionHandler` or the assignment pattern of property value.
diff --git a/src/reducers/root.ts b/src/reducers/root.ts
index 17e677c06..a34e368a0 100644
--- a/src/reducers/root.ts
+++ b/src/reducers/root.ts
@@ -18,12 +18,10 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+import {ActionTypes, keplerGlInit, _actionFor, _updateProperty} from '@kepler.gl/actions';
import {handleActions} from 'redux-actions';
-import {_actionFor, _updateProperty} from '../actions/action-wrapper';
-import {keplerGlInit} from '../actions/actions';
import {coreReducerFactory} from './core';
-import {ActionTypes} from 'actions';
// INITIAL_STATE
const initialCoreState = {};
diff --git a/src/reducers/ui-state-updaters.ts b/src/reducers/ui-state-updaters.ts
index 3c0d1ce49..ec095fb76 100644
--- a/src/reducers/ui-state-updaters.ts
+++ b/src/reducers/ui-state-updaters.ts
@@ -36,7 +36,6 @@ import {LOCALE_CODES} from '@kepler.gl/localization';
import {createNotification, errorNotification, calculateExportImageSize} from '@kepler.gl/utils';
import {payload_, apply_, compose_} from './composer-helpers';
-import * as UiStateActions from 'actions/ui-state-actions';
import {KeplerGlInitPayload, LoadFilesErrUpdaterAction} from '../actions';
import {
ExportData,
@@ -47,6 +46,7 @@ import {
MapControls,
UiState
} from '@kepler.gl/types';
+import {UIStateActions} from '@kepler.gl/actions';
export const DEFAULT_ACTIVE_SIDE_PANEL = 'layer';
export const DEFAULT_MODAL = ADD_DATA_ID;
@@ -289,7 +289,7 @@ export const initUiStateUpdater = (
*/
export const toggleSidePanelUpdater = (
state: UiState,
- {payload: id}: UiStateActions.ToggleSidePanelUpdaterAction
+ {payload: id}: UIStateActions.ToggleSidePanelUpdaterAction
): UiState => {
return id === state.activeSidePanel
? state
@@ -316,7 +316,7 @@ export const toggleSidePanelUpdater = (
*/
export const toggleModalUpdater = (
state: UiState,
- {payload: id}: UiStateActions.ToggleModalUpdaterAction
+ {payload: id}: UIStateActions.ToggleModalUpdaterAction
): UiState => ({
...state,
currentModal: id
@@ -329,7 +329,7 @@ export const toggleModalUpdater = (
*/
export const showExportDropdownUpdater = (
state: UiState,
- {payload: id}: UiStateActions.ShowExportDropdownUpdaterAction
+ {payload: id}: UIStateActions.ShowExportDropdownUpdaterAction
): UiState => ({
...state,
visibleDropdown: id
@@ -356,7 +356,7 @@ export const hideExportDropdownUpdater = (state: UiState): UiState => ({
*/
export const toggleMapControlUpdater = (
state: UiState,
- {payload: {panelId, index = 0}}: UiStateActions.ToggleMapControlUpdaterAction
+ {payload: {panelId, index = 0}}: UIStateActions.ToggleMapControlUpdaterAction
): UiState => ({
...state,
mapControls: {
@@ -386,7 +386,7 @@ export const toggleMapControlUpdater = (
*/
export const setMapControlVisibilityUpdater = (
state: UiState,
- {payload: {panelId, show}}: UiStateActions.setMapControlVisibilityUpdaterAction
+ {payload: {panelId, show}}: UIStateActions.setMapControlVisibilityUpdaterAction
): UiState => {
if (!state.mapControls?.[panelId]) {
return state;
@@ -415,7 +415,7 @@ export const setMapControlVisibilityUpdater = (
*/
export const openDeleteModalUpdater = (
state: UiState,
- {payload: datasetKeyToRemove}: UiStateActions.OpenDeleteModalUpdaterAction
+ {payload: datasetKeyToRemove}: UIStateActions.OpenDeleteModalUpdaterAction
): UiState => ({
...state,
currentModal: DELETE_DATA_ID,
@@ -431,7 +431,7 @@ export const openDeleteModalUpdater = (
*/
export const setExportImageSettingUpdater = (
state: UiState,
- {payload: newSetting}: UiStateActions.SetExportImageSettingUpdaterAction
+ {payload: newSetting}: UIStateActions.SetExportImageSettingUpdaterAction
): UiState => {
const updated = {...state.exportImage, ...newSetting};
const imageSize = calculateExportImageSize(updated) || state.exportImage.imageSize;
@@ -459,7 +459,7 @@ export const setExportImageSettingUpdater = (
*/
export const setExportImageDataUriUpdater = (
state: UiState,
- {payload: dataUri}: UiStateActions.SetExportImageDataUriUpdaterAction
+ {payload: dataUri}: UIStateActions.SetExportImageDataUriUpdaterAction
): UiState => ({
...state,
exportImage: {
@@ -475,7 +475,7 @@ export const setExportImageDataUriUpdater = (
*/
export const setExportImageErrorUpdater = (
state: UiState,
- {payload: error}: UiStateActions.SetExportImageErrorUpdaterAction
+ {payload: error}: UIStateActions.SetExportImageErrorUpdaterAction
): UiState => ({
...state,
exportImage: {
@@ -536,7 +536,7 @@ export const startExportingImageUpdater = (
*/
export const setExportSelectedDatasetUpdater = (
state: UiState,
- {payload: dataset}: UiStateActions.SetExportSelectedDatasetUpdaterAction
+ {payload: dataset}: UIStateActions.SetExportSelectedDatasetUpdaterAction
): UiState => ({
...state,
exportData: {
@@ -556,7 +556,7 @@ export const setExportSelectedDatasetUpdater = (
*/
export const setExportDataTypeUpdater = (
state: UiState,
- {payload: dataType}: UiStateActions.SetExportDataTypeUpdaterAction
+ {payload: dataType}: UIStateActions.SetExportDataTypeUpdaterAction
): UiState => ({
...state,
exportData: {
@@ -576,7 +576,7 @@ export const setExportDataTypeUpdater = (
*/
export const setExportFilteredUpdater = (
state: UiState,
- {payload: filtered}: UiStateActions.SetExportFilteredUpdaterAction
+ {payload: filtered}: UIStateActions.SetExportFilteredUpdaterAction
): UiState => ({
...state,
exportData: {
@@ -613,7 +613,7 @@ export const setExportDataUpdater = (state: UiState): UiState => ({
*/
export const setUserMapboxAccessTokenUpdater = (
state: UiState,
- {payload: userMapboxToken}: UiStateActions.SetUserMapboxAccessTokenUpdaterAction
+ {payload: userMapboxToken}: UIStateActions.SetUserMapboxAccessTokenUpdaterAction
): UiState => ({
...state,
exportMap: {
@@ -634,7 +634,7 @@ export const setUserMapboxAccessTokenUpdater = (
*/
export const setExportMapFormatUpdater = (
state: UiState,
- {payload: format}: UiStateActions.SetExportMapFormatUpdaterAction
+ {payload: format}: UIStateActions.SetExportMapFormatUpdaterAction
): UiState => ({
...state,
exportMap: {
@@ -653,7 +653,7 @@ export const setExportMapFormatUpdater = (
*/
export const setExportMapHTMLModeUpdater = (
state: UiState,
- {payload: mode}: UiStateActions.SetExportHTMLMapModeUpdaterAction
+ {payload: mode}: UIStateActions.SetExportHTMLMapModeUpdaterAction
): UiState => ({
...state,
exportMap: {
@@ -677,7 +677,7 @@ export const setExportMapHTMLModeUpdater = (
*/
export const addNotificationUpdater = (
state: UiState,
- {payload}: UiStateActions.AddNotificationUpdaterAction
+ {payload}: UIStateActions.AddNotificationUpdaterAction
): UiState => {
let notifications;
@@ -706,7 +706,7 @@ export const addNotificationUpdater = (
*/
export const removeNotificationUpdater = (
state: UiState,
- {payload: id}: UiStateActions.RemoveNotificationUpdaterAction
+ {payload: id}: UIStateActions.RemoveNotificationUpdaterAction
): UiState => ({
...state,
notifications: state.notifications.filter(n => n.id !== id)
@@ -810,7 +810,7 @@ export const showDatasetTableUpdater = (state: UiState): UiState =>
*/
export const setLocaleUpdater = (
state: UiState,
- {payload: {locale}}: UiStateActions.SetLocaleUpdaterAction
+ {payload: {locale}}: UIStateActions.SetLocaleUpdaterAction
): UiState => ({
...state,
locale
@@ -827,7 +827,7 @@ export const setLocaleUpdater = (
*/
export const toggleLayerPanelListViewUpdater = (
state: UiState,
- {payload: listView}: UiStateActions.ToggleLayerPanelListViewAction
+ {payload: listView}: UIStateActions.ToggleLayerPanelListViewAction
): UiState => {
// @ts-expect-error
return listView === state.layerPanelListView
diff --git a/src/reducers/ui-state.ts b/src/reducers/ui-state.ts
index 357ff2384..181396f58 100644
--- a/src/reducers/ui-state.ts
+++ b/src/reducers/ui-state.ts
@@ -19,7 +19,7 @@
// THE SOFTWARE.
import {handleActions} from 'redux-actions';
-import {ActionTypes} from 'actions';
+import {ActionTypes} from '@kepler.gl/actions';
import * as uiStateUpdaters from './ui-state-updaters';
/**
diff --git a/src/reducers/vis-state-updaters.ts b/src/reducers/vis-state-updaters.ts
index e45df7d27..095859adb 100644
--- a/src/reducers/vis-state-updaters.ts
+++ b/src/reducers/vis-state-updaters.ts
@@ -33,8 +33,14 @@ import {
loadFilesSuccess,
loadFileStepSuccess,
loadNextFile,
- nextFileBatch
-} from 'actions/vis-state-actions';
+ nextFileBatch,
+ ReceiveMapConfigPayload,
+ VisStateActions,
+ MapStateActions,
+ processFileContent,
+ ActionTypes
+} from '@kepler.gl/actions';
+
// Utils
import {
set,
@@ -65,16 +71,11 @@ import {
DEFAULT_TEXT_LABEL,
COMPARE_TYPES
} from '@kepler.gl/constants';
-import {ActionTypes} from 'actions';
import {pick_, merge_, swap_} from './composer-helpers';
-import {processFileContent} from 'actions/vis-state-actions';
import KeplerGLSchema, {VisState} from 'schemas';
import {Filter, InteractionConfig, AnimationConfig, Editor} from '@kepler.gl/types';
-import {ReceiveMapConfigPayload} from '../actions/actions';
-import * as VisStateActions from 'actions/vis-state-actions';
-import * as MapStateActions from 'actions/map-state-actions';
import {Loader} from '@loaders.gl/loader-utils';
import {Messages, Crosshairs, CursorClick, Pin} from 'components/common/icons/index';
diff --git a/src/reducers/vis-state.ts b/src/reducers/vis-state.ts
index a1ac2ae59..df036ebdf 100644
--- a/src/reducers/vis-state.ts
+++ b/src/reducers/vis-state.ts
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-import {ActionTypes} from 'actions';
+import {ActionTypes} from '@kepler.gl/actions';
import {handleActions} from 'redux-actions';
import * as visStateUpdaters from './vis-state-updaters';
diff --git a/test/browser/components/bottom-widget-test.js b/test/browser/components/bottom-widget-test.js
index 98218152c..8cceb7888 100644
--- a/test/browser/components/bottom-widget-test.js
+++ b/test/browser/components/bottom-widget-test.js
@@ -23,7 +23,7 @@ import test from 'tape';
import {IntlWrapper, mountWithTheme} from 'test/helpers/component-utils';
import {BottomWidgetFactory, TimeWidgetFactory, AnimationControlFactory} from 'components';
import {appInjector} from 'components/container';
-import * as VisStateActions from 'actions/vis-state-actions';
+import {VisStateActions} from '@kepler.gl/actions';
const BottomWidget = appInjector.get(BottomWidgetFactory);
const TimeWidget = appInjector.get(TimeWidgetFactory);
diff --git a/test/browser/components/common/animation-control-test.js b/test/browser/components/common/animation-control-test.js
index 4f1df0cc1..7df3345d3 100644
--- a/test/browser/components/common/animation-control-test.js
+++ b/test/browser/components/common/animation-control-test.js
@@ -22,7 +22,7 @@ import React from 'react';
import test from 'tape';
import sinon from 'sinon';
import moment from 'moment';
-import {setLayerAnimationTimeConfig} from 'actions/vis-state-actions';
+import {setLayerAnimationTimeConfig} from '@kepler.gl/actions';
import {mountWithTheme} from 'test/helpers/component-utils';
import {
diff --git a/test/browser/components/container-test.js b/test/browser/components/container-test.js
index d6157cedd..802e6ce14 100644
--- a/test/browser/components/container-test.js
+++ b/test/browser/components/container-test.js
@@ -29,7 +29,7 @@ import sinon from 'sinon';
import {console as Console} from 'global/window';
import rootReducer from 'reducers/root';
import coreReducer from 'reducers/core';
-import {keplerGlInit} from 'actions/actions';
+import {keplerGlInit} from '@kepler.gl/actions';
import Container, {ERROR_MSG} from 'components/container';
import {DEFAULT_MAPBOX_API_URL} from '@kepler.gl/constants';
diff --git a/test/browser/components/filters/time-widget-test.js b/test/browser/components/filters/time-widget-test.js
index 49f8790b1..67cdfcec6 100644
--- a/test/browser/components/filters/time-widget-test.js
+++ b/test/browser/components/filters/time-widget-test.js
@@ -25,7 +25,7 @@ import sinon from 'sinon';
import moment from 'moment';
import {IntlWrapper, mountWithTheme, mockHTMLElementClientSize} from 'test/helpers/component-utils';
-import {setFilterAnimationTimeConfig} from 'actions/vis-state-actions';
+import {setFilterAnimationTimeConfig} from '@kepler.gl/actions';
import reducer from 'reducers/vis-state';
import {
diff --git a/test/browser/components/injector-test.js b/test/browser/components/injector-test.js
index af2509bb4..c2433c406 100644
--- a/test/browser/components/injector-test.js
+++ b/test/browser/components/injector-test.js
@@ -29,7 +29,7 @@ import {console as Console} from 'global/window';
import {withState, injectComponents, PanelHeaderFactory} from 'components';
import coreReducer from 'reducers/core';
-import {keplerGlInit} from 'actions/actions';
+import {keplerGlInit} from '@kepler.gl/actions';
import {visStateLens, uiStateLens, mapStateLens, mapStyleLens} from 'reducers';
const mockStore = configureStore();
diff --git a/test/browser/components/kepler-gl-test.js b/test/browser/components/kepler-gl-test.js
index 25bcebc9f..48b40d503 100644
--- a/test/browser/components/kepler-gl-test.js
+++ b/test/browser/components/kepler-gl-test.js
@@ -27,7 +27,7 @@ import configureStore from 'redux-mock-store';
import {Provider} from 'react-redux';
import coreReducer from 'reducers/core';
-import {keplerGlInit} from 'actions/actions';
+import {keplerGlInit, ActionTypes} from '@kepler.gl/actions';
import {
appInjector,
KeplerGlFactory,
@@ -39,7 +39,6 @@ import {
GeocoderPanelFactory
} from 'components';
import NotificationPanelFactory from 'components/notification-panel';
-import {ActionTypes} from 'actions';
import {DEFAULT_MAP_STYLES, EXPORT_IMAGE_ID} from 'constants';
import {GEOCODER_DATASET_NAME} from '@kepler.gl/constants';
// mock state
diff --git a/test/browser/components/map/map-control-test.js b/test/browser/components/map/map-control-test.js
index 0fc406164..3908edb49 100644
--- a/test/browser/components/map/map-control-test.js
+++ b/test/browser/components/map/map-control-test.js
@@ -47,7 +47,7 @@ import {
import {Cube3d, Split, Legend, DrawPolygon, Layers, Delete} from 'components/common/icons';
import {LOCALE_CODES, LOCALES} from '@kepler.gl/localization';
-import {toggleMapControl} from 'actions';
+import {toggleMapControl} from '@kepler.gl/actions';
import {keplerGlReducerCore} from 'reducers';
const MapControl = appInjector.get(MapControlFactory);
diff --git a/test/browser/components/modals/data-table-modal-test.js b/test/browser/components/modals/data-table-modal-test.js
index 47f2c06a9..a7dffaebc 100644
--- a/test/browser/components/modals/data-table-modal-test.js
+++ b/test/browser/components/modals/data-table-modal-test.js
@@ -25,7 +25,7 @@ import sinon from 'sinon';
import flatten from 'lodash.flattendeep';
import {mountWithTheme} from 'test/helpers/component-utils';
import CloneDeep from 'lodash.clonedeep';
-import * as VisStateActions from 'actions/vis-state-actions';
+import {VisStateActions} from '@kepler.gl/actions';
import visStateReducer from 'reducers/vis-state';
import FieldTokenFactory from 'components/common/field-token';
diff --git a/test/browser/components/side-panel/filter-manager-test.js b/test/browser/components/side-panel/filter-manager-test.js
index d98e07db1..8519a7b33 100644
--- a/test/browser/components/side-panel/filter-manager-test.js
+++ b/test/browser/components/side-panel/filter-manager-test.js
@@ -35,7 +35,7 @@ import NewFilterPanelFactory from 'components/side-panel/filter-panel/filter-pan
import {appInjector} from 'components/container';
import {mountWithTheme, IntlWrapper} from 'test/helpers/component-utils';
import keplerGlReducer from 'reducers/core';
-import * as VisStateActions from 'actions/vis-state-actions';
+import {VisStateActions} from '@kepler.gl/actions';
import {testFields, testAllData} from 'test/fixtures/test-csv-data';
import {ALL_FIELD_TYPES} from '@kepler.gl/constants';
import {assertDatasetIsTable} from '../../../helpers/comparison-utils';
diff --git a/test/browser/components/side-panel/layer-list-test.js b/test/browser/components/side-panel/layer-list-test.js
index 8d4356f21..b3b69f565 100644
--- a/test/browser/components/side-panel/layer-list-test.js
+++ b/test/browser/components/side-panel/layer-list-test.js
@@ -23,8 +23,7 @@ import test from 'tape';
import {StateWMultiH3Layers} from 'test/helpers/mock-state';
-import * as VisStateActions from 'actions/vis-state-actions';
-import * as UIStateActions from 'actions/ui-state-actions';
+import {VisStateActions, UIStateActions} from '@kepler.gl/actions';
import {appInjector} from 'components/container';
import {IntlWrapper, mountWithTheme} from 'test/helpers/component-utils';
diff --git a/test/browser/components/side-panel/layer-manager-test.js b/test/browser/components/side-panel/layer-manager-test.js
index f0e664e54..84c4f699e 100644
--- a/test/browser/components/side-panel/layer-manager-test.js
+++ b/test/browser/components/side-panel/layer-manager-test.js
@@ -34,8 +34,7 @@ import {
import {appInjector} from 'components/container';
import {mountWithTheme, IntlWrapper} from 'test/helpers/component-utils';
-import * as VisStateActions from 'actions/vis-state-actions';
-import * as UIStateActions from 'actions/ui-state-actions';
+import {VisStateActions, UIStateActions} from '@kepler.gl/actions';
import {StateWMultiH3Layers} from 'test/helpers/mock-state';
diff --git a/test/browser/components/side-panel/side-panel-test.js b/test/browser/components/side-panel/side-panel-test.js
index 389514d14..fc7accfd1 100644
--- a/test/browser/components/side-panel/side-panel-test.js
+++ b/test/browser/components/side-panel/side-panel-test.js
@@ -33,9 +33,7 @@ import CustomPanelsFactory from 'components/side-panel/custom-panel';
import ToolbarItem from 'components/common/toolbar-item';
-import * as VisStateActions from 'actions/vis-state-actions';
-import * as MapStyleActions from 'actions/map-style-actions';
-import * as UIStateActions from 'actions/ui-state-actions';
+import {VisStateActions, MapStyleActions, UIStateActions} from '@kepler.gl/actions';
import {appInjector} from 'components/container';
import {IntlWrapper, mountWithTheme} from 'test/helpers/component-utils';
diff --git a/test/browser/reducers/index.js b/test/browser/reducers/index.js
index e42393dc1..fbe630be5 100644
--- a/test/browser/reducers/index.js
+++ b/test/browser/reducers/index.js
@@ -22,7 +22,7 @@ import reducer from 'reducers/vis-state';
import CloneDeep from 'lodash.clonedeep';
import test from 'tape-catch';
import {StateWFiles, testCsvDataId, testGeoJsonDataId} from 'test/helpers/mock-state';
-import * as VisStateActions from 'actions/vis-state-actions';
+import {VisStateActions} from '@kepler.gl/actions';
test('#visStateReducer -> COPY_TABLE_COLUMN', t => {
const initialState = CloneDeep(StateWFiles.visState);
diff --git a/test/helpers/layer-utils.js b/test/helpers/layer-utils.js
index 462be2e2c..a54aae638 100644
--- a/test/helpers/layer-utils.js
+++ b/test/helpers/layer-utils.js
@@ -28,8 +28,7 @@ import cloneDeep from 'lodash.clonedeep';
import {INITIAL_MAP_STATE} from 'reducers/map-state-updaters';
import {INITIAL_VIS_STATE} from 'reducers/vis-state-updaters';
-import * as VisStateActions from 'actions/vis-state-actions';
-import {addDataToMap} from 'actions/actions';
+import {VisStateActions, addDataToMap} from '@kepler.gl/actions';
import {colorMaker, layerColors, LayerClasses} from '@kepler.gl/layers';
import {getGpuFilterProps, renderDeckGlLayer} from 'reducers';
diff --git a/test/helpers/mock-state.js b/test/helpers/mock-state.js
index 39eab5e50..3eb5a7523 100644
--- a/test/helpers/mock-state.js
+++ b/test/helpers/mock-state.js
@@ -25,7 +25,6 @@ import {drainTasksForTesting} from 'react-palm/tasks';
import {getInitialInputStyle} from 'reducers/map-style-updaters';
import keplerGlReducer from 'reducers/core';
-import {addDataToMap} from 'actions/actions';
import {
VizColorPalette,
COMPARE_TYPES,
@@ -36,11 +35,14 @@ import {
DEFAULT_LAYER_LABEL
} from '@kepler.gl/constants';
import {DEFAULT_KEPLER_GL_PROPS} from 'components';
-import * as VisStateActions from 'actions/vis-state-actions';
-import * as MapStateActions from 'actions/map-state-actions';
-import * as MapStyleActions from 'actions/map-style-actions';
-import * as UIStateActions from 'actions/ui-state-actions';
-import * as ProviderActions from 'actions/provider-actions';
+import {
+ addDataToMap,
+ VisStateActions,
+ MapStateActions,
+ MapStyleActions,
+ UIStateActions,
+ ProviderActions
+} from '@kepler.gl/actions';
// fixtures
import {dataId as csvDataId, testFields, testAllData} from 'test/fixtures/test-csv-data';
diff --git a/test/node/reducers/composer-state-test.js b/test/node/reducers/composer-state-test.js
index 12d2623b8..17213b976 100644
--- a/test/node/reducers/composer-state-test.js
+++ b/test/node/reducers/composer-state-test.js
@@ -23,8 +23,8 @@
import test from 'tape';
import keplerGlReducer from 'reducers';
import {addDataToMapUpdater} from 'reducers/combined-updaters';
-import {registerEntry} from 'actions/identity-actions';
import {processCsvData} from '@kepler.gl/processors';
+import {registerEntry} from '@kepler.gl/actions';
import testCsvData, {sampleConfig} from 'test/fixtures/test-csv-data';
import testHexIdData, {
diff --git a/test/node/reducers/map-state-test.js b/test/node/reducers/map-state-test.js
index 590756e0e..85bad3a00 100644
--- a/test/node/reducers/map-state-test.js
+++ b/test/node/reducers/map-state-test.js
@@ -20,9 +20,13 @@
import test from 'tape';
-import {updateMap, togglePerspective, fitBounds, toggleSplitMap} from 'actions/map-state-actions';
-
-import {receiveMapConfig} from 'actions/actions';
+import {
+ updateMap,
+ togglePerspective,
+ fitBounds,
+ toggleSplitMap,
+ receiveMapConfig
+} from '@kepler.gl/actions';
import reducer, {mapStateReducerFactory} from 'reducers/map-state';
import {INITIAL_MAP_STATE} from 'reducers/map-state-updaters';
diff --git a/test/node/reducers/map-style-test.js b/test/node/reducers/map-style-test.js
index 0ab762c13..0124c057e 100644
--- a/test/node/reducers/map-style-test.js
+++ b/test/node/reducers/map-style-test.js
@@ -27,7 +27,7 @@ import {
loadMapStylesUpdater,
getInitialInputStyle
} from 'reducers/map-style-updaters';
-import {keplerGlInit, receiveMapConfig} from 'actions/actions';
+import {keplerGlInit, receiveMapConfig} from '@kepler.gl/actions';
import SchemaManager from 'schemas';
import {DEFAULT_MAP_STYLES, DEFAULT_MAPBOX_API_URL} from '@kepler.gl/constants';
diff --git a/test/node/reducers/provider-state-test.js b/test/node/reducers/provider-state-test.js
index 6074ad8df..51e3c92c4 100644
--- a/test/node/reducers/provider-state-test.js
+++ b/test/node/reducers/provider-state-test.js
@@ -22,9 +22,13 @@ import test from 'tape';
import {drainTasksForTesting, succeedTaskInTest, errorTaskInTest} from 'react-palm/tasks';
import sinon from 'sinon';
import {default as Console} from 'global/console';
-import {ActionTypes} from 'actions';
-import {exportFileToCloud, resetProviderStatus, setCloudProvider} from 'actions/provider-actions';
+import {
+ ActionTypes,
+ exportFileToCloud,
+ resetProviderStatus,
+ setCloudProvider
+} from '@kepler.gl/actions';
import reducer, {providerStateReducerFactory} from 'reducers/provider-state';
import {INITIAL_PROVIDER_STATE} from 'reducers/provider-state-updaters';
import MockProvider from 'test/helpers/mock-provider';
diff --git a/test/node/reducers/root-test.js b/test/node/reducers/root-test.js
index cb4813962..f7a634d1c 100644
--- a/test/node/reducers/root-test.js
+++ b/test/node/reducers/root-test.js
@@ -26,7 +26,7 @@ import {
receiveMapConfig,
toggleSplitMap,
toggleMapControl
-} from 'actions';
+} from '@kepler.gl/actions';
import {createAction, handleActions} from 'redux-actions';
test('keplerGlReducer.initialState', t => {
diff --git a/test/node/reducers/ui-state-test.js b/test/node/reducers/ui-state-test.js
index 059c52f32..89d405f20 100644
--- a/test/node/reducers/ui-state-test.js
+++ b/test/node/reducers/ui-state-test.js
@@ -32,10 +32,11 @@ import {
setExportFiltered,
startExportingImage,
addNotification,
- removeNotification
-} from 'actions/ui-state-actions';
-import {loadFiles, loadFilesErr} from 'actions/vis-state-actions';
-import {keplerGlInit} from 'actions/actions';
+ removeNotification,
+ loadFiles,
+ loadFilesErr,
+ keplerGlInit
+} from '@kepler.gl/actions';
import reducer, {uiStateReducerFactory} from 'reducers/ui-state';
import {INITIAL_UI_STATE} from 'reducers/ui-state-updaters';
import {
diff --git a/test/node/reducers/vis-state-merger-test.js b/test/node/reducers/vis-state-merger-test.js
index 6dba80ec4..b89225720 100644
--- a/test/node/reducers/vis-state-merger-test.js
+++ b/test/node/reducers/vis-state-merger-test.js
@@ -33,9 +33,8 @@ import {
import SchemaManager from 'schemas';
import visStateReducer from 'reducers/vis-state';
import coreReducer from 'reducers/core';
-import {updateVisData} from 'actions/vis-state-actions';
-import {receiveMapConfig, addDataToMap} from 'actions/actions';
import {processKeplerglJSON} from '@kepler.gl/processors';
+import {updateVisData, receiveMapConfig, addDataToMap} from '@kepler.gl/actions';
import {defaultInteractionConfig} from 'reducers/vis-state-updaters';
import {createDataContainer} from 'reducers/table-utils';
diff --git a/test/node/reducers/vis-state-test.js b/test/node/reducers/vis-state-test.js
index be3edf7db..ce13de909 100644
--- a/test/node/reducers/vis-state-test.js
+++ b/test/node/reducers/vis-state-test.js
@@ -26,8 +26,7 @@ import {console as Console} from 'global/window';
import {drainTasksForTesting, succeedTaskInTest, errorTaskInTest} from 'react-palm/tasks';
import CloneDeep from 'lodash.clonedeep';
-import * as VisStateActions from 'actions/vis-state-actions';
-import * as MapStateActions from 'actions/map-state-actions';
+import {VisStateActions, MapStateActions} from '@kepler.gl/actions';
import reducer from 'reducers/vis-state';
import {INITIAL_VIS_STATE, DEFAULT_ANIMATION_CONFIG} from 'reducers/vis-state-updaters';
diff --git a/test/node/schemas/vis-state-schema-test.js b/test/node/schemas/vis-state-schema-test.js
index 39c6850c8..3bfd318f6 100644
--- a/test/node/schemas/vis-state-schema-test.js
+++ b/test/node/schemas/vis-state-schema-test.js
@@ -38,7 +38,7 @@ import {
testGeoJsonDataId
} from 'test/helpers/mock-state';
import keplerGlReducer from 'reducers/core';
-import * as VisStateActions from 'actions/vis-state-actions';
+import {VisStateActions} from '@kepler.gl/actions';
test('#visStateSchema -> v1 -> save layers', t => {
const initialState = cloneDeep(StateWFilesFiltersLayerColor);
diff --git a/test/node/utils/export-utils-test.js b/test/node/utils/export-utils-test.js
index e4ce67daf..28ace719c 100644
--- a/test/node/utils/export-utils-test.js
+++ b/test/node/utils/export-utils-test.js
@@ -20,7 +20,7 @@
import test from 'tape';
-import {registerEntry} from 'actions/identity-actions';
+import {registerEntry} from '@kepler.gl/actions';
import keplerGlReducer from 'reducers';
import {
getMapJSON,