@opengeoweb/store 14.0.1 → 14.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -521,12 +521,12 @@ function _regeneratorRuntime() {
521
521
  })();
522
522
  }
523
523
 
524
- var initialState$6 = {
524
+ var initialState$7 = {
525
525
  byId: {},
526
526
  allIds: []
527
527
  };
528
- var slice$7 = createSlice({
529
- initialState: initialState$6,
528
+ var slice$8 = createSlice({
529
+ initialState: initialState$7,
530
530
  name: 'serviceReducer',
531
531
  reducers: {
532
532
  serviceSetLayers: function serviceSetLayers(draft, action) {
@@ -553,8 +553,8 @@ var slice$7 = createSlice({
553
553
  }
554
554
  }
555
555
  });
556
- var serviceReducer = slice$7.reducer,
557
- serviceActions = slice$7.actions;
556
+ var serviceReducer = slice$8.reducer,
557
+ serviceActions = slice$8.actions;
558
558
 
559
559
  /* *
560
560
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1643,7 +1643,7 @@ var createLayer = function createLayer(_ref) {
1643
1643
  useLatestReferenceTime: useLatestReferenceTime
1644
1644
  });
1645
1645
  };
1646
- var initialState$5 = {
1646
+ var initialState$6 = {
1647
1647
  byId: {},
1648
1648
  allIds: [],
1649
1649
  availableBaseLayers: {
@@ -1651,8 +1651,8 @@ var initialState$5 = {
1651
1651
  allIds: []
1652
1652
  }
1653
1653
  };
1654
- var slice$6 = createSlice({
1655
- initialState: initialState$5,
1654
+ var slice$7 = createSlice({
1655
+ initialState: initialState$6,
1656
1656
  name: 'layerReducer',
1657
1657
  reducers: {
1658
1658
  addLayer: function addLayer(draft, action) {
@@ -2249,8 +2249,8 @@ var slice$6 = createSlice({
2249
2249
  });
2250
2250
  }
2251
2251
  });
2252
- var layerReducer = slice$6.reducer,
2253
- layerActions = slice$6.actions;
2252
+ var layerReducer = slice$7.reducer,
2253
+ layerActions = slice$7.actions;
2254
2254
 
2255
2255
  var moveToTop = function moveToTop(list, element) {
2256
2256
  var filteredList = list.filter(function (item) {
@@ -2276,13 +2276,13 @@ var createUIDialogElement = function createUIDialogElement(_ref) {
2276
2276
  sourcePanelId: sourcePanelId
2277
2277
  };
2278
2278
  };
2279
- var initialState$4 = {
2279
+ var initialState$5 = {
2280
2280
  order: [],
2281
2281
  dialogs: {},
2282
2282
  activeWindowId: undefined
2283
2283
  };
2284
- var slice$5 = createSlice({
2285
- initialState: initialState$4,
2284
+ var slice$6 = createSlice({
2285
+ initialState: initialState$5,
2286
2286
  name: 'uiReducer',
2287
2287
  reducers: {
2288
2288
  registerDialog: function registerDialog(draft, action) {
@@ -2374,8 +2374,8 @@ var slice$5 = createSlice({
2374
2374
  }
2375
2375
  }
2376
2376
  });
2377
- var uiReducer = slice$5.reducer,
2378
- uiActions = slice$5.actions;
2377
+ var uiReducer = slice$6.reducer,
2378
+ uiActions = slice$6.actions;
2379
2379
 
2380
2380
  /**
2381
2381
  * Checks if the layer id is already taken in one of the maps.
@@ -2419,12 +2419,12 @@ var createLayersWithIds = function createLayersWithIds(state, layers) {
2419
2419
  }
2420
2420
  });
2421
2421
  };
2422
- var initialState$3 = {
2422
+ var initialState$4 = {
2423
2423
  byId: {},
2424
2424
  allIds: []
2425
2425
  };
2426
- var slice$4 = createSlice({
2427
- initialState: initialState$3,
2426
+ var slice$5 = createSlice({
2427
+ initialState: initialState$4,
2428
2428
  name: 'mapReducer',
2429
2429
  reducers: {
2430
2430
  registerMap: function registerMap(draft, action) {
@@ -3045,11 +3045,11 @@ var slice$4 = createSlice({
3045
3045
  });
3046
3046
  }
3047
3047
  });
3048
- var mapActions = _objectSpread2(_objectSpread2({}, slice$4.actions), {}, {
3048
+ var mapActions = _objectSpread2(_objectSpread2({}, slice$5.actions), {}, {
3049
3049
  setMapPreset: setMapPreset,
3050
3050
  mapChangeDimension: mapChangeDimension
3051
3051
  });
3052
- var mapReducer = slice$4.reducer;
3052
+ var mapReducer = slice$5.reducer;
3053
3053
 
3054
3054
  var layerStore = function layerStore(store) {
3055
3055
  return store === null || store === void 0 ? void 0 : store.layers;
@@ -3615,7 +3615,7 @@ var selectors$6 = /*#__PURE__*/Object.freeze({
3615
3615
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
3616
3616
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
3617
3617
  * */
3618
- var useAppSelector = useSelector;
3618
+ var useAppSelector$1 = useSelector;
3619
3619
  var getUiStore = function getUiStore(store) {
3620
3620
  if (store && store.ui) {
3621
3621
  return store.ui;
@@ -3778,7 +3778,7 @@ var selectors$5 = /*#__PURE__*/Object.freeze({
3778
3778
  getUiDialogsByActiveMapId: getUiDialogsByActiveMapId,
3779
3779
  getUiStore: getUiStore,
3780
3780
  getisDialogOpen: getisDialogOpen,
3781
- useAppSelector: useAppSelector
3781
+ useAppSelector: useAppSelector$1
3782
3782
  });
3783
3783
 
3784
3784
  /* *
@@ -3876,7 +3876,7 @@ var useSetupDialog = function useSetupDialog(dialogType) {
3876
3876
  };
3877
3877
  // eslint-disable-next-line react-hooks/exhaustive-deps
3878
3878
  }, []);
3879
- var uiIsOrderedOnTop = useAppSelector(function (store) {
3879
+ var uiIsOrderedOnTop = useAppSelector$1(function (store) {
3880
3880
  return getDialogIsOrderedOnTop(store, dialogType);
3881
3881
  });
3882
3882
  var setDialogOrder = useCallback(function () {
@@ -3886,19 +3886,19 @@ var useSetupDialog = function useSetupDialog(dialogType) {
3886
3886
  }));
3887
3887
  }
3888
3888
  }, [dialogType, dispatch, uiIsOrderedOnTop]);
3889
- var dialogOrder = useAppSelector(function (store) {
3889
+ var dialogOrder = useAppSelector$1(function (store) {
3890
3890
  return getDialogOrder(store, dialogType);
3891
3891
  });
3892
- var uiSource = useAppSelector(function (store) {
3892
+ var uiSource = useAppSelector$1(function (store) {
3893
3893
  return getDialogSource(store, dialogType);
3894
3894
  });
3895
- var isDialogOpen = useAppSelector(function (store) {
3895
+ var isDialogOpen = useAppSelector$1(function (store) {
3896
3896
  return getisDialogOpen(store, dialogType);
3897
3897
  });
3898
- var uiIsLoading = useAppSelector(function (store) {
3898
+ var uiIsLoading = useAppSelector$1(function (store) {
3899
3899
  return getDialogIsLoading(store, dialogType);
3900
3900
  });
3901
- var uiError = useAppSelector(function (store) {
3901
+ var uiError = useAppSelector$1(function (store) {
3902
3902
  return getDialogError(store, dialogType);
3903
3903
  });
3904
3904
  return {
@@ -3983,7 +3983,7 @@ var removeInPlace = function removeInPlace(inDraftArray, condition) {
3983
3983
  inDraftArray.length = index;
3984
3984
  };
3985
3985
 
3986
- var initialState$2 = {
3986
+ var initialState$3 = {
3987
3987
  sources: {
3988
3988
  byId: {},
3989
3989
  allIds: []
@@ -4012,8 +4012,8 @@ var initialState$2 = {
4012
4012
  },
4013
4013
  isTimeScrollingEnabled: false
4014
4014
  };
4015
- var slice$3 = createSlice({
4016
- initialState: initialState$2,
4015
+ var slice$4 = createSlice({
4016
+ initialState: initialState$3,
4017
4017
  name: 'synchronizationGroupsReducer',
4018
4018
  reducers: {
4019
4019
  /** Sets the links map.
@@ -4195,7 +4195,7 @@ var slice$3 = createSlice({
4195
4195
  });
4196
4196
  },
4197
4197
  syncGroupClear: function syncGroupClear() {
4198
- return initialState$2;
4198
+ return initialState$3;
4199
4199
  },
4200
4200
  syncGroupSetViewState: function syncGroupSetViewState(draft, action) {
4201
4201
  var viewState = action.payload.viewState;
@@ -4257,7 +4257,7 @@ var setBboxOrTimeSync = function setBboxOrTimeSync(draft, action) {
4257
4257
  });
4258
4258
  }
4259
4259
  };
4260
- var _slice$actions = slice$3.actions,
4260
+ var _slice$actions = slice$4.actions,
4261
4261
  syncGroupAddGroup = _slice$actions.syncGroupAddGroup;
4262
4262
  _slice$actions.syncGroupAddSource;
4263
4263
  var syncGroupAddTarget = _slice$actions.syncGroupAddTarget;
@@ -4267,8 +4267,8 @@ var _slice$actions = slice$3.actions,
4267
4267
  _slice$actions.syncGroupRemoveSource;
4268
4268
  _slice$actions.syncGroupRemoveTarget;
4269
4269
  _slice$actions.syncGroupSetViewState;
4270
- var syncGroupsReducer = slice$3.reducer,
4271
- syncGroupsActions = slice$3.actions;
4270
+ var syncGroupsReducer = slice$4.reducer,
4271
+ syncGroupsActions = slice$4.actions;
4272
4272
 
4273
4273
  var syncGroupStore = function syncGroupStore(store) {
4274
4274
  return store.syncGroups || null;
@@ -4928,7 +4928,7 @@ var initLoadingIndicatorStateForId = function initLoadingIndicatorStateForId(dra
4928
4928
  });
4929
4929
  }
4930
4930
  };
4931
- var slice$2 = createSlice({
4931
+ var slice$3 = createSlice({
4932
4932
  initialState: loadingIndicatorAdapter.getInitialState(),
4933
4933
  name: 'loadingIndicatorReducer',
4934
4934
  reducers: {
@@ -4971,8 +4971,8 @@ var slice$2 = createSlice({
4971
4971
  });
4972
4972
  }
4973
4973
  });
4974
- var loadingIndicatorActions = slice$2.actions,
4975
- loadingIndicatorReducer = slice$2.reducer;
4974
+ var loadingIndicatorActions = slice$3.actions,
4975
+ loadingIndicatorReducer = slice$3.reducer;
4976
4976
 
4977
4977
  /* *
4978
4978
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -5031,7 +5031,7 @@ var selectors$2 = /*#__PURE__*/Object.freeze({
5031
5031
  });
5032
5032
 
5033
5033
  var genericActions = _objectSpread2(_objectSpread2({}, syncGroupsActions), {}, {
5034
- initialSyncState: initialState$2,
5034
+ initialSyncState: initialState$3,
5035
5035
  setTime: setTime,
5036
5036
  setBbox: setBbox
5037
5037
  });
@@ -7906,16 +7906,17 @@ serviceListener.startListening({
7906
7906
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
7907
7907
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
7908
7908
  * */
7909
- var initialState$1 = {};
7910
- var slice$1 = createSlice({
7911
- initialState: initialState$1,
7909
+ var initialState$2 = {};
7910
+ var slice$2 = createSlice({
7911
+ initialState: initialState$2,
7912
7912
  name: 'router',
7913
7913
  reducers: {
7914
- navigateToUrl: function navigateToUrl(_draft, _action) {}
7914
+ navigateToUrl: function navigateToUrl(_draft, _action) {},
7915
+ navigateBackOrForward: function navigateBackOrForward(_draft, _action) {}
7915
7916
  }
7916
7917
  });
7917
- var routerReducer = slice$1.reducer,
7918
- routerActions = slice$1.actions;
7918
+ var routerReducer = slice$2.reducer,
7919
+ routerActions = slice$2.actions;
7919
7920
 
7920
7921
  /* *
7921
7922
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -7983,9 +7984,9 @@ var getDrawToolByLayerId = function getDrawToolByLayerId(draft, layerId) {
7983
7984
  });
7984
7985
  return (drawTool === null || drawTool === void 0 ? void 0 : drawTool.drawToolId) || undefined;
7985
7986
  };
7986
- var initialState = drawAdapter.getInitialState();
7987
- var slice = createSlice({
7988
- initialState: initialState,
7987
+ var initialState$1 = drawAdapter.getInitialState();
7988
+ var slice$1 = createSlice({
7989
+ initialState: initialState$1,
7989
7990
  name: 'draw',
7990
7991
  reducers: {
7991
7992
  registerDrawTool: function registerDrawTool(draft, action) {
@@ -8124,8 +8125,8 @@ var slice = createSlice({
8124
8125
  // });
8125
8126
  }
8126
8127
  });
8127
- var drawingToolReducer = slice.reducer,
8128
- drawingToolActions = slice.actions;
8128
+ var drawingToolReducer = slice$1.reducer,
8129
+ drawingToolActions = slice$1.actions;
8129
8130
 
8130
8131
  /* *
8131
8132
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -8533,6 +8534,25 @@ metronomeListener.startListening({
8533
8534
  }()
8534
8535
  });
8535
8536
 
8537
+ /* *
8538
+ * Licensed under the Apache License, Version 2.0 (the "License");
8539
+ * you may not use this file except in compliance with the License.
8540
+ * You may obtain a copy of the License at
8541
+ *
8542
+ * http://www.apache.org/licenses/LICENSE-2.0
8543
+ *
8544
+ * Unless required by applicable law or agreed to in writing, software
8545
+ * distributed under the License is distributed on an "AS IS" BASIS,
8546
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8547
+ * See the License for the specific language governing permissions and
8548
+ * limitations under the License.
8549
+ *
8550
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8551
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
8552
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
8553
+ * */
8554
+ var commonListener = createListenerMiddleware();
8555
+
8536
8556
  /* *
8537
8557
  * Licensed under the Apache License, Version 2.0 (the "License");
8538
8558
  * you may not use this file except in compliance with the License.
@@ -8719,7 +8739,7 @@ var mockStateMapWithLayer = function mockStateMapWithLayer(layer, mapId) {
8719
8739
  dimensions: layer.dimensions,
8720
8740
  status: layer.status
8721
8741
  }),
8722
- syncGroups: _objectSpread2(_objectSpread2({}, initialState$2), {}, {
8742
+ syncGroups: _objectSpread2(_objectSpread2({}, initialState$3), {}, {
8723
8743
  viewState: {
8724
8744
  timeslider: {
8725
8745
  groups: [{
@@ -8742,7 +8762,7 @@ var mockStateMapWithLayer = function mockStateMapWithLayer(layer, mapId) {
8742
8762
  };
8743
8763
  var mockLinkedState = function mockLinkedState() {
8744
8764
  return {
8745
- syncGroups: _objectSpread2(_objectSpread2({}, initialState$2), {}, {
8765
+ syncGroups: _objectSpread2(_objectSpread2({}, initialState$3), {}, {
8746
8766
  viewState: {
8747
8767
  timeslider: {
8748
8768
  groups: [{
@@ -8855,7 +8875,7 @@ var mockStateMapWithMultipleLayers = function mockStateMapWithMultipleLayers(lay
8855
8875
  allIds: ['serviceid_1']
8856
8876
  },
8857
8877
  layers: createMultipleLayersState(layers, mapId),
8858
- syncGroups: _objectSpread2(_objectSpread2({}, initialState$2), {}, {
8878
+ syncGroups: _objectSpread2(_objectSpread2({}, initialState$3), {}, {
8859
8879
  viewState: {
8860
8880
  timeslider: {
8861
8881
  groups: [{
@@ -8992,6 +9012,116 @@ var constants = /*#__PURE__*/Object.freeze({
8992
9012
  supportedComponentTypesForLinking: supportedComponentTypesForLinking
8993
9013
  });
8994
9014
 
9015
+ /* *
9016
+ * Licensed under the Apache License, Version 2.0 (the "License");
9017
+ * you may not use this file except in compliance with the License.
9018
+ * You may obtain a copy of the License at
9019
+ *
9020
+ * http://www.apache.org/licenses/LICENSE-2.0
9021
+ *
9022
+ * Unless required by applicable law or agreed to in writing, software
9023
+ * distributed under the License is distributed on an "AS IS" BASIS,
9024
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9025
+ * See the License for the specific language governing permissions and
9026
+ * limitations under the License.
9027
+ *
9028
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
9029
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
9030
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
9031
+ * */
9032
+ var initialState = {
9033
+ isLoggedIn: false,
9034
+ credentials: undefined
9035
+ };
9036
+ var slice = createSlice({
9037
+ initialState: initialState,
9038
+ name: 'auth',
9039
+ reducers: {
9040
+ setCredentials: function setCredentials(draft, action) {
9041
+ draft.credentials = action.payload.credentials;
9042
+ },
9043
+ login: function login(draft, action) {
9044
+ draft.isLoggedIn = action.payload.isLoggedIn;
9045
+ },
9046
+ logout: function logout(draft) {
9047
+ draft.isLoggedIn = false;
9048
+ draft.credentials = undefined;
9049
+ }
9050
+ }
9051
+ });
9052
+ var authReducer = slice.reducer,
9053
+ authActions = slice.actions;
9054
+
9055
+ /* *
9056
+ * Licensed under the Apache License, Version 2.0 (the "License");
9057
+ * you may not use this file except in compliance with the License.
9058
+ * You may obtain a copy of the License at
9059
+ *
9060
+ * http://www.apache.org/licenses/LICENSE-2.0
9061
+ *
9062
+ * Unless required by applicable law or agreed to in writing, software
9063
+ * distributed under the License is distributed on an "AS IS" BASIS,
9064
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9065
+ * See the License for the specific language governing permissions and
9066
+ * limitations under the License.
9067
+ *
9068
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
9069
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
9070
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
9071
+ * */
9072
+ // store/auth/selectors.ts
9073
+ var useAppSelector = useSelector;
9074
+ var getAuthStore = function getAuthStore(store) {
9075
+ if (store !== null && store !== void 0 && store.common) {
9076
+ return store.common.auth;
9077
+ }
9078
+ return null;
9079
+ };
9080
+ /**
9081
+ * Gets whether the user is logged in
9082
+ *
9083
+ * @param {object} store store object from which the auth state will be extracted
9084
+ * @returns {boolean} true if user is logged in
9085
+ */
9086
+ var getIsLoggedIn = createSelector(getAuthStore, function (auth) {
9087
+ var _auth$isLoggedIn;
9088
+ return (_auth$isLoggedIn = auth === null || auth === void 0 ? void 0 : auth.isLoggedIn) !== null && _auth$isLoggedIn !== void 0 ? _auth$isLoggedIn : false;
9089
+ }, selectorMemoizationOptions);
9090
+ /**
9091
+ * Gets the current auth credentials
9092
+ *
9093
+ * @param {object} store store object from which the auth state will be extracted
9094
+ * @returns {Credentials | undefined} the auth credentials or undefined
9095
+ */
9096
+ var getCredentials = createSelector(getAuthStore, function (auth) {
9097
+ return auth === null || auth === void 0 ? void 0 : auth.credentials;
9098
+ }, selectorMemoizationOptions);
9099
+ /**
9100
+ * Gets the current role
9101
+ *
9102
+ * @param {object} store store object from which the auth state will be extracted
9103
+ * @returns {Role[] | undefined} the current role
9104
+ */
9105
+ var getCurrentRoles = createSelector(getAuthStore, function (auth) {
9106
+ var _auth$credentials;
9107
+ return auth === null || auth === void 0 || (_auth$credentials = auth.credentials) === null || _auth$credentials === void 0 ? void 0 : _auth$credentials.roles;
9108
+ }, selectorMemoizationOptions);
9109
+
9110
+ var authSelectors = /*#__PURE__*/Object.freeze({
9111
+ __proto__: null,
9112
+ getAuthStore: getAuthStore,
9113
+ getCredentials: getCredentials,
9114
+ getCurrentRoles: getCurrentRoles,
9115
+ getIsLoggedIn: getIsLoggedIn,
9116
+ useAppSelector: useAppSelector
9117
+ });
9118
+
9119
+ var commonActions = _objectSpread2({}, authActions);
9120
+ var commonSelectors = _objectSpread2({}, authSelectors);
9121
+ var commonReducers = combineReducers({
9122
+ auth: authReducer
9123
+ });
9124
+
8995
9125
  var storeReducerMap = {
8996
9126
  webmap: mapReducer,
8997
9127
  services: serviceReducer,
@@ -9000,9 +9130,10 @@ var storeReducerMap = {
9000
9130
  loadingIndicator: loadingIndicatorReducer,
9001
9131
  ui: uiReducer,
9002
9132
  drawingtools: drawingToolReducer,
9003
- router: routerReducer
9133
+ router: routerReducer,
9134
+ common: commonReducers
9004
9135
  };
9005
- var storeMiddlewares = [mapListener.middleware, serviceListener.middleware, layersListener.middleware, metronomeListener.middleware, syncGroupsListener.middleware, genericListener.middleware, drawingToolListener.middleware, routerListener.middleware, openlayersListener.middleware];
9136
+ var storeMiddlewares = [mapListener.middleware, serviceListener.middleware, layersListener.middleware, metronomeListener.middleware, syncGroupsListener.middleware, genericListener.middleware, drawingToolListener.middleware, routerListener.middleware, openlayersListener.middleware, commonListener.middleware];
9006
9137
  var storeRootReducer = combineReducers(storeReducerMap);
9007
9138
  var createMockStore = function createMockStore(mockState) {
9008
9139
  return configureStore({
@@ -9057,4 +9188,4 @@ var configureOpenGeoWebStore = function configureOpenGeoWebStore() {
9057
9188
  });
9058
9189
  };
9059
9190
 
9060
- export { IS_LEGEND_OPEN_BY_DEFAULT, SECONDS_IN_DAY, SECONDS_IN_HOUR, configureOpenGeoWebStore, createMockStore, createViewObjectForNewMap, drawingToolActions, drawingToolListener, drawingToolReducer, selectors as drawingToolSelectors, filterLayers$1 as filterLayers, genericActions, genericListener, selectors$3 as genericSelectors, types as genericTypes, getSingularDrawtoolDrawLayerId, getUserAddedServices, getViewObjectForMapId, getViewObjectForSyncGroup, initialState$2 as initialState, layerActions, layerReducer, selectors$6 as layerSelectors, types$3 as layerTypes, utils$1 as layerUtils, layersListener, constants as linkComponentTypesConstants, loadingIndicatorActions, constants$1 as loadingIndicatorConstants, loadingIndicatorReducer, selectors$2 as loadingIndicatorSelectors, mapActions, enums as mapEnums, mapListener, mapReducer, selectors$1 as mapSelectors, types$4 as mapTypes, mapUtils, metronomeListener, openlayersListener, routerActions, routerListener, routerReducer, utils as routerUtils, selectorMemoizationOptions, serviceActions, serviceListener, serviceReducer, selectors$7 as serviceSelectors, types$5 as serviceTypes, setUserAddedServices, storeMiddlewares, storeReducerMap, storeTestSettings, storeTestUtils, utils$3 as storeUtils, constants$2 as syncConstants, syncGroupsActions, syncGroupsListener, syncGroupsReducer, selector as syncGroupsSelector, selectors$4 as syncGroupsSelectors, types$1 as syncGroupsTypes, types$1 as types, uiActions, uiReducer, selectors$5 as uiSelectors, types$2 as uiTypes, unifyReducerMaps, useSetupDialog, useUpdateSharedData };
9191
+ export { IS_LEGEND_OPEN_BY_DEFAULT, SECONDS_IN_DAY, SECONDS_IN_HOUR, commonActions, commonListener, commonReducers, commonSelectors, configureOpenGeoWebStore, createMockStore, createViewObjectForNewMap, drawingToolActions, drawingToolListener, drawingToolReducer, selectors as drawingToolSelectors, filterLayers$1 as filterLayers, genericActions, genericListener, selectors$3 as genericSelectors, types as genericTypes, getSingularDrawtoolDrawLayerId, getUserAddedServices, getViewObjectForMapId, getViewObjectForSyncGroup, initialState$3 as initialState, layerActions, layerReducer, selectors$6 as layerSelectors, types$3 as layerTypes, utils$1 as layerUtils, layersListener, constants as linkComponentTypesConstants, loadingIndicatorActions, constants$1 as loadingIndicatorConstants, loadingIndicatorReducer, selectors$2 as loadingIndicatorSelectors, mapActions, enums as mapEnums, mapListener, mapReducer, selectors$1 as mapSelectors, types$4 as mapTypes, mapUtils, metronomeListener, openlayersListener, routerActions, routerListener, routerReducer, utils as routerUtils, selectorMemoizationOptions, serviceActions, serviceListener, serviceReducer, selectors$7 as serviceSelectors, types$5 as serviceTypes, setUserAddedServices, storeMiddlewares, storeReducerMap, storeTestSettings, storeTestUtils, utils$3 as storeUtils, constants$2 as syncConstants, syncGroupsActions, syncGroupsListener, syncGroupsReducer, selector as syncGroupsSelector, selectors$4 as syncGroupsSelectors, types$1 as syncGroupsTypes, types$1 as types, uiActions, uiReducer, selectors$5 as uiSelectors, types$2 as uiTypes, unifyReducerMaps, useSetupDialog, useUpdateSharedData };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/store",
3
- "version": "14.0.1",
3
+ "version": "14.1.0",
4
4
  "description": "GeoWeb Store library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,15 +8,15 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/shared": "14.0.1",
11
+ "@opengeoweb/shared": "14.1.0",
12
12
  "react-redux": "^9.2.0",
13
13
  "@reduxjs/toolkit": "^2.6.1",
14
- "@opengeoweb/webmap-react": "14.0.1",
15
- "@opengeoweb/webmap": "14.0.1",
14
+ "@opengeoweb/webmap-react": "14.1.0",
15
+ "@opengeoweb/webmap": "14.1.0",
16
16
  "immer": "^10.0.3",
17
17
  "lodash": "^4.17.21",
18
- "@opengeoweb/metronome": "14.0.1",
19
- "@opengeoweb/time-slider": "14.0.1",
18
+ "@opengeoweb/metronome": "14.1.0",
19
+ "@opengeoweb/time-slider": "14.1.0",
20
20
  "react-router-dom": "^6.23.1",
21
21
  "ol": "^10.4.0",
22
22
  "@turf/turf": "^7.2.0",
@@ -0,0 +1,3 @@
1
+ export { authReducer, authActions } from './reducer';
2
+ export * as authSelectors from './selectors';
3
+ export type * as authTypes from './types';
@@ -0,0 +1,14 @@
1
+ import type { PayloadAction, Draft } from '@reduxjs/toolkit';
2
+ import type { AuthStore, LoginPayload, SetAuthPayload } from './types';
3
+ export declare const initialState: AuthStore;
4
+ export declare const slice: import("@reduxjs/toolkit").Slice<AuthStore, {
5
+ setCredentials: (draft: Draft<AuthStore>, action: PayloadAction<SetAuthPayload>) => void;
6
+ login: (draft: Draft<AuthStore>, action: PayloadAction<LoginPayload>) => void;
7
+ logout: (draft: Draft<AuthStore>) => void;
8
+ }, "auth", "auth", import("@reduxjs/toolkit").SliceSelectors<AuthStore>>;
9
+ export declare const authReducer: import("redux").Reducer<AuthStore>, authActions: import("@reduxjs/toolkit").CaseReducerActions<{
10
+ setCredentials: (draft: Draft<AuthStore>, action: PayloadAction<SetAuthPayload>) => void;
11
+ login: (draft: Draft<AuthStore>, action: PayloadAction<LoginPayload>) => void;
12
+ logout: (draft: Draft<AuthStore>) => void;
13
+ }, "auth">;
14
+ export type AuthActions = ReturnType<typeof authActions.setCredentials> | ReturnType<typeof authActions.login> | ReturnType<typeof authActions.logout>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,87 @@
1
+ import type { TypedUseSelectorHook } from 'react-redux';
2
+ import type { AuthStore } from './types';
3
+ import type { CoreAppStore } from '../../types';
4
+ import type { CommonModuleState } from '../types';
5
+ export declare const useAppSelector: TypedUseSelectorHook<CommonModuleState>;
6
+ export declare const getAuthStore: (store: CoreAppStore) => AuthStore;
7
+ /**
8
+ * Gets whether the user is logged in
9
+ *
10
+ * @param {object} store store object from which the auth state will be extracted
11
+ * @returns {boolean} true if user is logged in
12
+ */
13
+ export declare const getIsLoggedIn: ((state: CoreAppStore) => boolean) & {
14
+ clearCache: () => void;
15
+ resultsCount: () => number;
16
+ resetResultsCount: () => void;
17
+ } & {
18
+ resultFunc: (resultFuncArgs_0: AuthStore) => boolean;
19
+ memoizedResultFunc: ((resultFuncArgs_0: AuthStore) => boolean) & {
20
+ clearCache: () => void;
21
+ resultsCount: () => number;
22
+ resetResultsCount: () => void;
23
+ };
24
+ lastResult: () => boolean;
25
+ dependencies: [(store: CoreAppStore) => AuthStore];
26
+ recomputations: () => number;
27
+ resetRecomputations: () => void;
28
+ dependencyRecomputations: () => number;
29
+ resetDependencyRecomputations: () => void;
30
+ } & {
31
+ memoize: typeof import("reselect").weakMapMemoize;
32
+ argsMemoize: typeof import("reselect").weakMapMemoize;
33
+ };
34
+ /**
35
+ * Gets the current auth credentials
36
+ *
37
+ * @param {object} store store object from which the auth state will be extracted
38
+ * @returns {Credentials | undefined} the auth credentials or undefined
39
+ */
40
+ export declare const getCredentials: ((state: CoreAppStore) => import("./types").Credentials | undefined) & {
41
+ clearCache: () => void;
42
+ resultsCount: () => number;
43
+ resetResultsCount: () => void;
44
+ } & {
45
+ resultFunc: (resultFuncArgs_0: AuthStore) => import("./types").Credentials | undefined;
46
+ memoizedResultFunc: ((resultFuncArgs_0: AuthStore) => import("./types").Credentials | undefined) & {
47
+ clearCache: () => void;
48
+ resultsCount: () => number;
49
+ resetResultsCount: () => void;
50
+ };
51
+ lastResult: () => import("./types").Credentials | undefined;
52
+ dependencies: [(store: CoreAppStore) => AuthStore];
53
+ recomputations: () => number;
54
+ resetRecomputations: () => void;
55
+ dependencyRecomputations: () => number;
56
+ resetDependencyRecomputations: () => void;
57
+ } & {
58
+ memoize: typeof import("reselect").weakMapMemoize;
59
+ argsMemoize: typeof import("reselect").weakMapMemoize;
60
+ };
61
+ /**
62
+ * Gets the current role
63
+ *
64
+ * @param {object} store store object from which the auth state will be extracted
65
+ * @returns {Role[] | undefined} the current role
66
+ */
67
+ export declare const getCurrentRoles: ((state: CoreAppStore) => import("./types").Role[] | undefined) & {
68
+ clearCache: () => void;
69
+ resultsCount: () => number;
70
+ resetResultsCount: () => void;
71
+ } & {
72
+ resultFunc: (resultFuncArgs_0: AuthStore) => import("./types").Role[] | undefined;
73
+ memoizedResultFunc: ((resultFuncArgs_0: AuthStore) => import("./types").Role[] | undefined) & {
74
+ clearCache: () => void;
75
+ resultsCount: () => number;
76
+ resetResultsCount: () => void;
77
+ };
78
+ lastResult: () => import("./types").Role[] | undefined;
79
+ dependencies: [(store: CoreAppStore) => AuthStore];
80
+ recomputations: () => number;
81
+ resetRecomputations: () => void;
82
+ dependencyRecomputations: () => number;
83
+ resetDependencyRecomputations: () => void;
84
+ } & {
85
+ memoize: typeof import("reselect").weakMapMemoize;
86
+ argsMemoize: typeof import("reselect").weakMapMemoize;
87
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ export interface Role {
2
+ name: string;
3
+ title: string;
4
+ }
5
+ export interface Credentials {
6
+ username: string;
7
+ roles?: Role[];
8
+ token: string;
9
+ refresh_token: string;
10
+ expires_at?: number;
11
+ has_connection_issue?: boolean;
12
+ }
13
+ export interface AuthStore {
14
+ isLoggedIn: boolean;
15
+ credentials?: Credentials;
16
+ }
17
+ export interface SetAuthPayload {
18
+ credentials: Credentials;
19
+ }
20
+ export interface LoginPayload {
21
+ isLoggedIn: boolean;
22
+ }
@@ -0,0 +1,81 @@
1
+ import type { AuthActions } from './auth/reducer';
2
+ export type CommonActions = AuthActions;
3
+ export declare const commonActions: {
4
+ setCredentials: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./auth/types").SetAuthPayload, "auth/setCredentials">;
5
+ login: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./auth/types").LoginPayload, "auth/login">;
6
+ logout: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"auth/logout">;
7
+ };
8
+ export declare const commonSelectors: {
9
+ useAppSelector: import("react-redux").TypedUseSelectorHook<import("./types").CommonModuleState>;
10
+ getAuthStore: (store: import("..").CoreAppStore) => import("./auth/types").AuthStore;
11
+ getIsLoggedIn: ((state: import("..").CoreAppStore) => boolean) & {
12
+ clearCache: () => void;
13
+ resultsCount: () => number;
14
+ resetResultsCount: () => void;
15
+ } & {
16
+ resultFunc: (resultFuncArgs_0: import("./auth/types").AuthStore) => boolean;
17
+ memoizedResultFunc: ((resultFuncArgs_0: import("./auth/types").AuthStore) => boolean) & {
18
+ clearCache: () => void;
19
+ resultsCount: () => number;
20
+ resetResultsCount: () => void;
21
+ };
22
+ lastResult: () => boolean;
23
+ dependencies: [(store: import("..").CoreAppStore) => import("./auth/types").AuthStore];
24
+ recomputations: () => number;
25
+ resetRecomputations: () => void;
26
+ dependencyRecomputations: () => number;
27
+ resetDependencyRecomputations: () => void;
28
+ } & {
29
+ memoize: typeof import("reselect").weakMapMemoize;
30
+ argsMemoize: typeof import("reselect").weakMapMemoize;
31
+ };
32
+ getCredentials: ((state: import("..").CoreAppStore) => import("./auth/types").Credentials | undefined) & {
33
+ clearCache: () => void;
34
+ resultsCount: () => number;
35
+ resetResultsCount: () => void;
36
+ } & {
37
+ resultFunc: (resultFuncArgs_0: import("./auth/types").AuthStore) => import("./auth/types").Credentials | undefined;
38
+ memoizedResultFunc: ((resultFuncArgs_0: import("./auth/types").AuthStore) => import("./auth/types").Credentials | undefined) & {
39
+ clearCache: () => void;
40
+ resultsCount: () => number;
41
+ resetResultsCount: () => void;
42
+ };
43
+ lastResult: () => import("./auth/types").Credentials | undefined;
44
+ dependencies: [(store: import("..").CoreAppStore) => import("./auth/types").AuthStore];
45
+ recomputations: () => number;
46
+ resetRecomputations: () => void;
47
+ dependencyRecomputations: () => number;
48
+ resetDependencyRecomputations: () => void;
49
+ } & {
50
+ memoize: typeof import("reselect").weakMapMemoize;
51
+ argsMemoize: typeof import("reselect").weakMapMemoize;
52
+ };
53
+ getCurrentRoles: ((state: import("..").CoreAppStore) => import("./auth/types").Role[] | undefined) & {
54
+ clearCache: () => void;
55
+ resultsCount: () => number;
56
+ resetResultsCount: () => void;
57
+ } & {
58
+ resultFunc: (resultFuncArgs_0: import("./auth/types").AuthStore) => import("./auth/types").Role[] | undefined;
59
+ memoizedResultFunc: ((resultFuncArgs_0: import("./auth/types").AuthStore) => import("./auth/types").Role[] | undefined) & {
60
+ clearCache: () => void;
61
+ resultsCount: () => number;
62
+ resetResultsCount: () => void;
63
+ };
64
+ lastResult: () => import("./auth/types").Role[] | undefined;
65
+ dependencies: [(store: import("..").CoreAppStore) => import("./auth/types").AuthStore];
66
+ recomputations: () => number;
67
+ resetRecomputations: () => void;
68
+ dependencyRecomputations: () => number;
69
+ resetDependencyRecomputations: () => void;
70
+ } & {
71
+ memoize: typeof import("reselect").weakMapMemoize;
72
+ argsMemoize: typeof import("reselect").weakMapMemoize;
73
+ };
74
+ };
75
+ export declare const commonReducers: import("redux").Reducer<{
76
+ auth: import("./auth/types").AuthStore;
77
+ }, import("redux").UnknownAction, Partial<{
78
+ auth: import("./auth/types").AuthStore | undefined;
79
+ }>>;
80
+ export type * as commonTypes from './auth/types';
81
+ export type * from './types';
@@ -0,0 +1,2 @@
1
+ import type { CommonModuleState } from '.';
2
+ export declare const commonListener: import("@reduxjs/toolkit").ListenerMiddlewareInstance<CommonModuleState, import("redux-thunk").ThunkDispatch<CommonModuleState, unknown, import("redux").UnknownAction>, unknown>;
@@ -0,0 +1,6 @@
1
+ import type { AuthStore } from './auth/types';
2
+ export interface CommonModuleState {
3
+ common?: {
4
+ auth: AuthStore;
5
+ };
6
+ }
@@ -9,12 +9,14 @@ export { routerListener } from './router/listener';
9
9
  export { drawingToolListener } from './drawingTool/listener';
10
10
  export { layersListener } from './map/layer/listeners';
11
11
  export { metronomeListener } from './map/map/metronomeListener';
12
+ export { commonListener } from './common/listener';
12
13
  export { unifyReducerMaps, type ReducerMap } from './unifyReducerMaps';
13
14
  export * from './router';
14
15
  export * from './drawingTool';
15
- export * from './types';
16
+ export type * from './types';
16
17
  export * as storeTestUtils from './map/storeTestUtils';
17
18
  export * from './generic/linking';
18
19
  export * as storeUtils from './utils';
19
20
  export * from './utils';
20
21
  export * from './store';
22
+ export * from './common';
@@ -1,8 +1,9 @@
1
1
  import { Draft } from 'immer';
2
2
  import { PayloadAction } from '@reduxjs/toolkit';
3
- import { NavigateToUrlPayload } from './types';
3
+ import { NavigateBackOrForwardPayload, NavigateToUrlPayload } from './types';
4
4
  export declare const initialState: {};
5
5
  export declare const routerReducer: import("redux").Reducer<{}>, routerActions: import("@reduxjs/toolkit").CaseReducerActions<{
6
6
  navigateToUrl: (_draft: Draft<unknown>, _action: PayloadAction<NavigateToUrlPayload>) => void;
7
+ navigateBackOrForward: (_draft: Draft<unknown>, _action: PayloadAction<NavigateBackOrForwardPayload>) => void;
7
8
  }, "router">;
8
9
  export type RouterActions = ReturnType<typeof routerActions.navigateToUrl>;
@@ -4,3 +4,6 @@ export interface RouterModuleStore {
4
4
  export interface NavigateToUrlPayload {
5
5
  url: string;
6
6
  }
7
+ export interface NavigateBackOrForwardPayload {
8
+ workspaceId: string;
9
+ }
@@ -1,10 +1,11 @@
1
- import { DevToolsEnhancerOptions, ListenerMiddleware, Store, StoreEnhancer } from '@reduxjs/toolkit';
2
- import { WebMapStateModuleState } from './map';
3
- import { SynchronizationGroupModuleState } from './generic/syncGroups/types';
4
- import { LoadingIndicatorModuleState } from './generic/loadingIndicator/types';
5
- import { UIModuleState } from './ui/types';
6
- import { DrawtoolModuleStore } from './drawingTool/reducer';
7
- import { ReducerMap } from './unifyReducerMaps';
1
+ import type { DevToolsEnhancerOptions, ListenerMiddleware, Store, StoreEnhancer } from '@reduxjs/toolkit';
2
+ import type { CommonModuleState } from './common';
3
+ import type { DrawtoolModuleStore } from './drawingTool/reducer';
4
+ import type { LoadingIndicatorModuleState } from './generic/loadingIndicator/types';
5
+ import type { SynchronizationGroupModuleState } from './generic/syncGroups/types';
6
+ import type { WebMapStateModuleState } from './map';
7
+ import type { UIModuleState } from './ui/types';
8
+ import type { ReducerMap } from './unifyReducerMaps';
8
9
  export declare const storeReducerMap: {
9
10
  webmap: import("redux").Reducer<import("./map/types").WebMapState>;
10
11
  services: import("redux").Reducer<import("./map/types").ServiceState>;
@@ -14,9 +15,14 @@ export declare const storeReducerMap: {
14
15
  ui: import("redux").Reducer<import("./ui/types").UIStoreType>;
15
16
  drawingtools: import("redux").Reducer<import("./drawingTool/reducer").DrawingToolState>;
16
17
  router: import("redux").Reducer<{}>;
18
+ common: import("redux").Reducer<{
19
+ auth: import("./common/auth/types").AuthStore;
20
+ }, import("redux").UnknownAction, Partial<{
21
+ auth: import("./common/auth/types").AuthStore | undefined;
22
+ }>>;
17
23
  };
18
24
  export declare const storeMiddlewares: (ListenerMiddleware<import("./types").CoreAppStore, import("redux-thunk").ThunkDispatch<import("./types").CoreAppStore, unknown, import("redux").UnknownAction>, unknown> | ListenerMiddleware<import("./router/types").RouterModuleStore, import("redux-thunk").ThunkDispatch<import("./router/types").RouterModuleStore, unknown, import("redux").UnknownAction>, unknown>)[];
19
- export declare const createMockStore: (mockState?: WebMapStateModuleState | SynchronizationGroupModuleState | LoadingIndicatorModuleState | UIModuleState | DrawtoolModuleStore) => Store;
25
+ export declare const createMockStore: (mockState?: WebMapStateModuleState | SynchronizationGroupModuleState | LoadingIndicatorModuleState | UIModuleState | CommonModuleState | DrawtoolModuleStore) => Store;
20
26
  export { getViewObjectForSyncGroup, getViewObjectForMapId, createViewObjectForNewMap, } from './mapStore/openlayers/syncGroupViewStore';
21
27
  /**
22
28
  * This creates an OpenGeoWeb redux store for redux connected components
@@ -1,7 +1,7 @@
1
- import type { WebMapStateModuleState } from './map/types';
2
- import type { SynchronizationGroupModuleState } from './generic/syncGroups/types';
3
- import type { uiTypes } from '.';
1
+ import type { CommonModuleState, uiTypes } from '.';
4
2
  import type { DrawtoolModuleStore } from './drawingTool';
5
3
  import type { LoadingIndicatorModuleState } from './generic/loadingIndicator/types';
6
- export interface CoreAppStore extends SynchronizationGroupModuleState, LoadingIndicatorModuleState, uiTypes.UIModuleState, WebMapStateModuleState, DrawtoolModuleStore {
4
+ import type { SynchronizationGroupModuleState } from './generic/syncGroups/types';
5
+ import type { WebMapStateModuleState } from './map/types';
6
+ export interface CoreAppStore extends SynchronizationGroupModuleState, LoadingIndicatorModuleState, uiTypes.UIModuleState, WebMapStateModuleState, CommonModuleState, DrawtoolModuleStore {
7
7
  }
@@ -1,6 +1,5 @@
1
- import { Source } from '@opengeoweb/shared';
1
+ import type { Source } from '@opengeoweb/shared';
2
2
  type LegendDialogType = string;
3
- type GetFeatureInfoDialogType = string;
4
3
  export declare enum DialogTypes {
5
4
  LayerInfo = "layerInfo",
6
5
  SyncGroups = "syncGroups",
@@ -26,7 +25,7 @@ export declare enum DialogTypes {
26
25
  SoundingsLocations = "soundingsLocations",
27
26
  TimeseriesLocations = "timeseriesLocations"
28
27
  }
29
- export type DialogType = DialogTypes | LegendDialogType | GetFeatureInfoDialogType;
28
+ export type DialogType = DialogTypes | LegendDialogType;
30
29
  export type { Source };
31
30
  export interface UIType {
32
31
  type: DialogType;