@opengeoweb/store 9.6.0 → 9.8.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
@@ -3,8 +3,8 @@ import { webmapUtils, LayerType, webmapTestSettings, WMLayer, handleMomentISOStr
3
3
  import { createAction, createSlice, createSelector, createEntityAdapter, current as current$1 } from '@reduxjs/toolkit';
4
4
  import { getGeoJson, moveFeature, createInterSections, defaultLayers, getFeatureCollection, emptyGeoJSON, defaultIntersectionStyleProperties } from '@opengeoweb/webmap-react';
5
5
  export { defaultLayers } from '@opengeoweb/webmap-react';
6
- import moment from 'moment';
7
- import { differenceInMinutes, getUnixTime, parseISO, isValid, fromUnixTime } from 'date-fns';
6
+ import { differenceInMinutes, isValid, fromUnixTime } from 'date-fns';
7
+ import { dateUtils, withEggs } from '@opengeoweb/shared';
8
8
  import { isEqual, compact } from 'lodash';
9
9
  import { createStore as createStore$1 } from '@redux-eggs/redux-toolkit';
10
10
  import { getSagaExtension } from '@redux-eggs/saga-extension';
@@ -12,7 +12,6 @@ import { takeEvery, takeLatest, put, select, call, all, delay } from 'redux-saga
12
12
  import React, { useCallback, useEffect } from 'react';
13
13
  import { Provider, useDispatch, useSelector } from 'react-redux';
14
14
  import { ThemeWrapper, lightTheme } from '@opengeoweb/theme';
15
- import { withEggs } from '@opengeoweb/shared';
16
15
 
17
16
  function _iterableToArrayLimit(r, l) {
18
17
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
@@ -557,15 +556,19 @@ var constants$1 = /*#__PURE__*/Object.freeze({
557
556
  IS_LEGEND_OPEN_BY_DEFAULT: IS_LEGEND_OPEN_BY_DEFAULT
558
557
  });
559
558
 
560
- var dateFormat = 'YYYY-MM-DDTHH:mm:ss[Z]';
559
+ var dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z";
561
560
  var createMap = function createMap(_ref) {
562
561
  var id = _ref.id,
563
562
  _ref$isAnimating = _ref.isAnimating,
564
563
  isAnimating = _ref$isAnimating === void 0 ? false : _ref$isAnimating,
565
564
  _ref$animationStartTi = _ref.animationStartTime,
566
- animationStartTime = _ref$animationStartTi === void 0 ? moment.utc(moment().unix() * 1000).subtract(5, 'h').format(dateFormat) : _ref$animationStartTi,
565
+ animationStartTime = _ref$animationStartTi === void 0 ? dateUtils.dateToString(dateUtils.sub(dateUtils.fromUnix(dateUtils.unix(dateUtils.utc())), {
566
+ hours: 5
567
+ }), dateFormat) : _ref$animationStartTi,
567
568
  _ref$animationEndTime = _ref.animationEndTime,
568
- animationEndTime = _ref$animationEndTime === void 0 ? moment.utc(moment().unix() * 1000).subtract(10, 'm').format(dateFormat) : _ref$animationEndTime,
569
+ animationEndTime = _ref$animationEndTime === void 0 ? dateUtils.dateToString(dateUtils.sub(dateUtils.fromUnix(dateUtils.unix(dateUtils.utc())), {
570
+ minutes: 10
571
+ }), dateFormat) : _ref$animationEndTime,
569
572
  _ref$isAutoUpdating = _ref.isAutoUpdating,
570
573
  isAutoUpdating = _ref$isAutoUpdating === void 0 ? false : _ref$isAutoUpdating,
571
574
  _ref$isEndTimeOverrid = _ref.isEndTimeOverriding,
@@ -600,7 +603,7 @@ var createMap = function createMap(_ref) {
600
603
  _ref$timeSliderWidth = _ref.timeSliderWidth,
601
604
  timeSliderWidth = _ref$timeSliderWidth === void 0 ? 440 : _ref$timeSliderWidth,
602
605
  _ref$timeSliderCenter = _ref.timeSliderCenterTime,
603
- timeSliderCenterTime = _ref$timeSliderCenter === void 0 ? moment.utc().unix() : _ref$timeSliderCenter,
606
+ timeSliderCenterTime = _ref$timeSliderCenter === void 0 ? dateUtils.unix(dateUtils.utc()) : _ref$timeSliderCenter,
604
607
  _ref$timeSliderSecond = _ref.timeSliderSecondsPerPx,
605
608
  timeSliderSecondsPerPx = _ref$timeSliderSecond === void 0 ? defaultSecondsPerPx : _ref$timeSliderSecond,
606
609
  _ref$isTimestepAuto = _ref.isTimestepAuto,
@@ -2718,7 +2721,12 @@ var slice$5 = createSlice({
2718
2721
  return;
2719
2722
  }
2720
2723
  draft.byId[mapId].dockedLayerManagerSize = dockedLayerManagerSize;
2721
- }
2724
+ },
2725
+ setMapPresetError: function setMapPresetError(
2726
+ // eslint-disable-next-line no-unused-vars
2727
+ draft,
2728
+ // eslint-disable-next-line no-unused-vars
2729
+ action) {}
2722
2730
  },
2723
2731
  extraReducers: function extraReducers(builder) {
2724
2732
  builder.addCase(layerActions.addLayer, function (draft, action) {
@@ -4061,13 +4069,13 @@ var getMapDimension = createSelector([getMapById, function (_store, mapId) {
4061
4069
  var getSelectedTime = createSelector(function (store, mapId) {
4062
4070
  return getMapDimension(store, mapId, 'time');
4063
4071
  }, function (timeDimension) {
4064
- var now = getUnixTime(new Date());
4065
- if (!timeDimension) {
4072
+ var now = dateUtils.unix(new Date());
4073
+ if (!timeDimension || !timeDimension.currentValue) {
4066
4074
  return now;
4067
4075
  }
4068
- var timeSliderTime = parseISO(timeDimension.currentValue);
4069
- if (isValid(timeSliderTime)) {
4070
- return getUnixTime(timeSliderTime);
4076
+ var timeSliderTime = dateUtils.parseISO(timeDimension.currentValue);
4077
+ if (dateUtils.isValid(timeSliderTime)) {
4078
+ return dateUtils.unix(timeSliderTime);
4071
4079
  }
4072
4080
  return now;
4073
4081
  }, selectorMemoizationOptions);
@@ -4081,8 +4089,8 @@ var getDataLimitsFromLayers = createSelector(getMapLayers, function (layers) {
4081
4089
  return dimension.name === 'time';
4082
4090
  });
4083
4091
  if ((dimension === null || dimension === void 0 ? void 0 : dimension.minValue) && dimension.maxValue) {
4084
- var lastValue = getUnixTime(new Date(dimension.maxValue));
4085
- var firstValue = getUnixTime(new Date(dimension.minValue));
4092
+ var lastValue = dateUtils.unix(new Date(dimension.maxValue));
4093
+ var firstValue = dateUtils.unix(new Date(dimension.minValue));
4086
4094
  var newLast = Math.max(lastValue, end);
4087
4095
  var newFirst = Math.min(firstValue, start);
4088
4096
  return [newFirst, newLast];
@@ -4164,7 +4172,9 @@ var linkedMapAnimationInfo = createSelector(function (store, mapId) {
4164
4172
  * @returns {string} returnType: string
4165
4173
  */
4166
4174
  var getAnimationStartTime = createSelector(getMapById, function (store) {
4167
- return (store === null || store === void 0 ? void 0 : store.animationStartTime) ? store.animationStartTime : moment.utc().subtract(6, 'h').format(dateFormat);
4175
+ return (store === null || store === void 0 ? void 0 : store.animationStartTime) ? store.animationStartTime : dateUtils.dateToString(dateUtils.sub(dateUtils.utc(), {
4176
+ hours: 6
4177
+ }), dateFormat);
4168
4178
  }, selectorMemoizationOptions);
4169
4179
  /**
4170
4180
  * Gets end time of animation
@@ -4175,7 +4185,9 @@ var getAnimationStartTime = createSelector(getMapById, function (store) {
4175
4185
  * @returns {string} returnType: string
4176
4186
  */
4177
4187
  var getAnimationEndTime$1 = createSelector(getMapById, function (store) {
4178
- return (store === null || store === void 0 ? void 0 : store.animationEndTime) ? store.animationEndTime : moment.utc().subtract(10, 'm').format(dateFormat);
4188
+ return (store === null || store === void 0 ? void 0 : store.animationEndTime) ? store.animationEndTime : dateUtils.dateToString(dateUtils.sub(dateUtils.utc(), {
4189
+ minutes: 10
4190
+ }), dateFormat);
4179
4191
  }, selectorMemoizationOptions);
4180
4192
  /**
4181
4193
  * Returns map is auto updating
@@ -4289,7 +4301,7 @@ var getMapTimeSliderWidth = createSelector(getMapById, function (store) {
4289
4301
  * @returns {number} returnType: number - center time as a unix timestamp
4290
4302
  */
4291
4303
  var getMapTimeSliderCenterTime = createSelector(getMapById, function (store) {
4292
- return store ? store.timeSliderCenterTime : moment().unix();
4304
+ return store ? store.timeSliderCenterTime : dateUtils.unix(dateUtils.utc());
4293
4305
  }, selectorMemoizationOptions);
4294
4306
  /**
4295
4307
  * Returns the unfiltered selected time of time slider
@@ -5128,16 +5140,16 @@ var storeTestSettings = /*#__PURE__*/Object.freeze({
5128
5140
  var _marked$6 = /*#__PURE__*/_regeneratorRuntime().mark(updateAnimation),
5129
5141
  _marked2$4 = /*#__PURE__*/_regeneratorRuntime().mark(handleBaseLayersSaga),
5130
5142
  _marked3$2 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$5);
5131
- // Expects start, end time as moment object and interval in minutes
5143
+ // Expects start, end time as Date object and interval in minutes
5132
5144
  var generateTimeList = function generateTimeList(start, end, interval) {
5133
5145
  var timeList = [];
5134
- var unixStart = moment(start).utc().unix();
5135
- var unixEnd = moment(end).utc().unix();
5146
+ var unixStart = dateUtils.unix(start);
5147
+ var unixEnd = dateUtils.unix(end);
5136
5148
  var intervalSeconds = interval * 60;
5137
5149
  for (var j = unixStart; j <= unixEnd; j += intervalSeconds) {
5138
5150
  timeList.push({
5139
5151
  name: 'time',
5140
- value: moment.unix(j).toISOString()
5152
+ value: dateUtils.fromUnix(j).toISOString()
5141
5153
  });
5142
5154
  }
5143
5155
  return timeList;
@@ -5145,14 +5157,24 @@ var generateTimeList = function generateTimeList(start, end, interval) {
5145
5157
  var getAnimationEndTime = function getAnimationEndTime(animationEndTime) {
5146
5158
  var calculateFromNow = animationEndTime.split(/[-+]/)[0] === 'NOW';
5147
5159
  var isAddingTime = animationEndTime.indexOf('+') !== -1;
5148
- var timeInMinutes = moment.duration(animationEndTime.split(/[-+]/)[1]).asMinutes();
5149
- var startingTime = calculateFromNow ? moment().utc() : moment().utc().startOf('day');
5150
- var newAnimationEndTime = isAddingTime ? moment(startingTime).add(timeInMinutes, 'minutes').toISOString() : moment(startingTime).subtract(timeInMinutes, 'minutes').toISOString();
5160
+ var duration = animationEndTime.substring(animationEndTime.indexOf('PT') + 2);
5161
+ var _duration$split = duration.split('H'),
5162
+ _duration$split2 = _slicedToArray(_duration$split, 2),
5163
+ hours = _duration$split2[0],
5164
+ minutes = _duration$split2[1];
5165
+ var timeInMinutes = parseInt(hours, 10) * 60 + parseInt(minutes, 10);
5166
+ var startingTime = calculateFromNow ? dateUtils.utc() : dateUtils.startOfDay(dateUtils.utc());
5167
+ var newAnimationEndTime = isAddingTime ? dateUtils.add(startingTime, {
5168
+ minutes: timeInMinutes
5169
+ }).toISOString() : dateUtils.sub(startingTime, {
5170
+ minutes: timeInMinutes
5171
+ }).toISOString();
5151
5172
  return newAnimationEndTime;
5152
5173
  };
5153
5174
  var isAnimationEndTimeValid = function isAnimationEndTimeValid(animationEndTime) {
5154
5175
  var hasValidPrefix = animationEndTime.split(/[-+]/)[0] === 'NOW' || animationEndTime.split(/[-+]/)[0] === 'TODAY';
5155
- var hasValidDate = moment.isDuration(moment.duration(animationEndTime.split(/[-+]/)[1]));
5176
+ var durationString = animationEndTime.substring(animationEndTime.indexOf('PT') + 2);
5177
+ var hasValidDate = /^(\d+H)?(\d+M)?$/.test(durationString);
5156
5178
  return hasValidPrefix && hasValidDate;
5157
5179
  };
5158
5180
  var validInitialAnimationStep = function validInitialAnimationStep(initialAnimationStep, draw) {
@@ -5180,9 +5202,9 @@ function startAnimationSaga(_ref) {
5180
5202
  while (1) switch (_context.prev = _context.next) {
5181
5203
  case 0:
5182
5204
  mapId = payload.mapId, start = payload.start, initialTime = payload.initialTime, end = payload.end, interval = payload.interval, timeList = payload.timeList;
5183
- roundedStart = roundWithTimeStep(Number(start && moment.utc(start).unix()), interval, 'ceil');
5184
- roundedEnd = roundWithTimeStep(Number(end && moment.utc(end).unix()), interval, 'floor');
5185
- animationList = timeList || generateTimeList(moment.utc(roundedStart * 1000), moment.utc(roundedEnd * 1000), interval);
5205
+ roundedStart = roundWithTimeStep(Number(start && dateUtils.unix(dateUtils.utc(start))), interval, 'ceil');
5206
+ roundedEnd = roundWithTimeStep(Number(end && dateUtils.unix(dateUtils.utc(end))), interval, 'floor');
5207
+ animationList = timeList || generateTimeList(dateUtils.fromUnix(roundedStart), dateUtils.fromUnix(roundedEnd), interval);
5186
5208
  _context.next = 6;
5187
5209
  return animationList;
5188
5210
  case 6:
@@ -5251,16 +5273,16 @@ function updateAnimation(mapId, maxValue) {
5251
5273
  return select(getAnimationStartTime, mapId);
5252
5274
  case 2:
5253
5275
  animationStart = _context4.sent;
5254
- animationStartUnix = moment.utc(animationStart).unix();
5276
+ animationStartUnix = dateUtils.unix(dateUtils.utc(animationStart));
5255
5277
  _context4.next = 6;
5256
5278
  return select(getAnimationEndTime$1, mapId);
5257
5279
  case 6:
5258
5280
  animationEnd = _context4.sent;
5259
- animationEndUnix = moment.utc(animationEnd).unix();
5260
- t = moment.utc(maxValue).unix();
5281
+ animationEndUnix = dateUtils.unix(dateUtils.utc(animationEnd));
5282
+ t = dateUtils.unix(dateUtils.utc(maxValue));
5261
5283
  deltaT = t - animationEndUnix;
5262
- start = moment.unix(animationStartUnix + deltaT).utc().format(dateFormat);
5263
- end = moment.unix(animationEndUnix + deltaT).utc().format(dateFormat);
5284
+ start = dateUtils.dateToString(dateUtils.fromUnix(animationStartUnix + deltaT), dateFormat);
5285
+ end = dateUtils.dateToString(dateUtils.fromUnix(animationEndUnix + deltaT), dateFormat);
5264
5286
  _context4.next = 14;
5265
5287
  return put(mapActions.setAnimationEndTime({
5266
5288
  mapId: mapId,
@@ -5552,7 +5574,7 @@ function handleBaseLayersSaga(mapId, baseLayers) {
5552
5574
  function setMapPresetSaga(_ref6) {
5553
5575
  var payload = _ref6.payload;
5554
5576
  return /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
5555
- var _a, _b, _c, mapId, initialProps, mapPreset, layers, activeLayerId, autoTimeStepLayerId, autoUpdateLayerId, proj, shouldAutoUpdate, shouldAnimate, animationPayload, toggleTimestepAuto, showTimeSlider, displayMapPin, shouldShowZoomControls, shouldShowLegend, dockedLayerManagerSize, _filterLayers, mapLayers, baseLayers, overLayers, autoTimeStepLayerIdNew, autoUpdateLayerIdNew, onlyActiveLayerIdIsSet, newLayerIds, firstLayerId, baseLayersWithDefaultLayer, overLayersWithDefaultLayer, allBaseLayers, animationLength, animationEndTime, shouldEndtimeOverride, interval, animationEnd, _animationEnd, duration, _animationEnd2, animationStart, shouldOpenLegend, legendId, fiveMinuteDelayForAnimation, _animationEnd3, _animationStart;
5577
+ var _a, _b, _c, mapId, initialProps, mapPreset, layers, activeLayerId, autoTimeStepLayerId, autoUpdateLayerId, proj, shouldAutoUpdate, shouldAnimate, animationPayload, toggleTimestepAuto, showTimeSlider, displayMapPin, shouldShowZoomControls, shouldShowLegend, dockedLayerManagerSize, _filterLayers, mapLayers, baseLayers, overLayers, autoTimeStepLayerIdNew, autoUpdateLayerIdNew, onlyActiveLayerIdIsSet, newLayerIds, firstLayerId, baseLayersWithDefaultLayer, overLayersWithDefaultLayer, allBaseLayers, isProjectionSupported, animationLength, animationEndTime, shouldEndtimeOverride, interval, animationEnd, _animationEnd, duration, _animationEnd2, animationStart, shouldOpenLegend, legendId, fiveMinuteDelayForAnimation, _animationEnd3, _animationStart;
5556
5578
  return _regeneratorRuntime().wrap(function _callee6$(_context8) {
5557
5579
  while (1) switch (_context8.prev = _context8.next) {
5558
5580
  case 0:
@@ -5560,7 +5582,7 @@ function setMapPresetSaga(_ref6) {
5560
5582
  mapId = payload.mapId, initialProps = payload.initialProps;
5561
5583
  mapPreset = initialProps.mapPreset;
5562
5584
  if (!mapPreset) {
5563
- _context8.next = 121;
5585
+ _context8.next = 124;
5564
5586
  break;
5565
5587
  }
5566
5588
  layers = mapPreset.layers, activeLayerId = mapPreset.activeLayerId, autoTimeStepLayerId = mapPreset.autoTimeStepLayerId, autoUpdateLayerId = mapPreset.autoUpdateLayerId, proj = mapPreset.proj, shouldAutoUpdate = mapPreset.shouldAutoUpdate, shouldAnimate = mapPreset.shouldAnimate, animationPayload = mapPreset.animationPayload, toggleTimestepAuto = mapPreset.toggleTimestepAuto, showTimeSlider = mapPreset.showTimeSlider, displayMapPin = mapPreset.displayMapPin, shouldShowZoomControls = mapPreset.shouldShowZoomControls, shouldShowLegend = mapPreset.shouldShowLegend, dockedLayerManagerSize = mapPreset.dockedLayerManagerSize;
@@ -5612,262 +5634,282 @@ function setMapPresetSaga(_ref6) {
5612
5634
  return call(handleBaseLayersSaga, mapId, allBaseLayers);
5613
5635
  case 24:
5614
5636
  if (!proj) {
5615
- _context8.next = 27;
5637
+ _context8.next = 30;
5616
5638
  break;
5617
5639
  }
5618
- _context8.next = 27;
5640
+ isProjectionSupported = webmapUtils.getWMJSMapById(mapId).isProjectionSupported(proj.srs);
5641
+ if (isProjectionSupported) {
5642
+ _context8.next = 28;
5643
+ break;
5644
+ }
5645
+ throw new Error("Projection ".concat(proj.srs, " is not supported"));
5646
+ case 28:
5647
+ _context8.next = 30;
5619
5648
  return put(mapActions.setBbox({
5620
5649
  mapId: mapId,
5621
- bbox: proj === null || proj === void 0 ? void 0 : proj.bbox,
5622
- srs: proj === null || proj === void 0 ? void 0 : proj.srs
5650
+ bbox: proj.bbox,
5651
+ srs: proj.srs
5623
5652
  }));
5624
- case 27:
5653
+ case 30:
5625
5654
  animationLength = animationPayload && animationPayload.duration;
5626
5655
  animationEndTime = animationPayload && animationPayload.endTime && isAnimationEndTimeValid(animationPayload.endTime) && animationPayload.endTime;
5627
5656
  shouldEndtimeOverride = animationPayload ? animationPayload.shouldEndtimeOverride : false;
5628
5657
  if (!shouldEndtimeOverride) {
5629
- _context8.next = 33;
5658
+ _context8.next = 36;
5630
5659
  break;
5631
5660
  }
5632
- _context8.next = 33;
5661
+ _context8.next = 36;
5633
5662
  return put(mapActions.setEndTimeOverriding({
5634
5663
  mapId: mapId,
5635
5664
  shouldEndtimeOverride: shouldEndtimeOverride
5636
5665
  }));
5637
- case 33:
5666
+ case 36:
5638
5667
  if (!(shouldAutoUpdate !== undefined && !animationEndTime)) {
5639
- _context8.next = 36;
5668
+ _context8.next = 39;
5640
5669
  break;
5641
5670
  }
5642
- _context8.next = 36;
5671
+ _context8.next = 39;
5643
5672
  return put(mapActions.toggleAutoUpdate({
5644
5673
  mapId: mapId,
5645
5674
  shouldAutoUpdate: shouldAutoUpdate
5646
5675
  }));
5647
- case 36:
5676
+ case 39:
5648
5677
  if (!(showTimeSlider !== undefined)) {
5649
- _context8.next = 39;
5678
+ _context8.next = 42;
5650
5679
  break;
5651
5680
  }
5652
- _context8.next = 39;
5681
+ _context8.next = 42;
5653
5682
  return put(mapActions.toggleTimeSliderIsVisible({
5654
5683
  mapId: mapId,
5655
5684
  isTimeSliderVisible: showTimeSlider
5656
5685
  }));
5657
- case 39:
5686
+ case 42:
5658
5687
  if (!(shouldShowZoomControls !== undefined)) {
5659
- _context8.next = 42;
5688
+ _context8.next = 45;
5660
5689
  break;
5661
5690
  }
5662
- _context8.next = 42;
5691
+ _context8.next = 45;
5663
5692
  return put(mapActions.toggleZoomControls({
5664
5693
  mapId: mapId,
5665
5694
  shouldShowZoomControls: shouldShowZoomControls
5666
5695
  }));
5667
- case 42:
5696
+ case 45:
5668
5697
  if (!(displayMapPin !== undefined)) {
5669
- _context8.next = 45;
5698
+ _context8.next = 48;
5670
5699
  break;
5671
5700
  }
5672
- _context8.next = 45;
5701
+ _context8.next = 48;
5673
5702
  return put(mapActions.toggleMapPinIsVisible({
5674
5703
  mapId: mapId,
5675
5704
  displayMapPin: displayMapPin
5676
5705
  }));
5677
- case 45:
5706
+ case 48:
5678
5707
  // sets timestep by interval of animationPayload
5679
5708
  interval = animationPayload && animationPayload.interval;
5680
5709
  if (!interval) {
5681
- _context8.next = 49;
5710
+ _context8.next = 52;
5682
5711
  break;
5683
5712
  }
5684
- _context8.next = 49;
5713
+ _context8.next = 52;
5685
5714
  return put(mapActions.setTimeStep({
5686
5715
  mapId: mapId,
5687
5716
  timeStep: interval
5688
5717
  }));
5689
- case 49:
5718
+ case 52:
5690
5719
  if (!animationEndTime) {
5691
- _context8.next = 58;
5720
+ _context8.next = 61;
5692
5721
  break;
5693
5722
  }
5694
- _context8.next = 52;
5723
+ _context8.next = 55;
5695
5724
  return put(mapActions.setAnimationEndTime({
5696
5725
  mapId: mapId,
5697
5726
  animationEndTime: getAnimationEndTime(animationEndTime)
5698
5727
  }));
5699
- case 52:
5728
+ case 55:
5700
5729
  if (animationLength) {
5701
- _context8.next = 58;
5730
+ _context8.next = 61;
5702
5731
  break;
5703
5732
  }
5704
- _context8.next = 55;
5733
+ _context8.next = 58;
5705
5734
  return select(getAnimationEndTime$1, mapId);
5706
- case 55:
5735
+ case 58:
5707
5736
  animationEnd = _context8.sent;
5708
- _context8.next = 58;
5737
+ _context8.next = 61;
5709
5738
  return put(mapActions.setAnimationStartTime({
5710
5739
  mapId: mapId,
5711
- animationStartTime: moment(animationEnd).subtract(5 * 60, 'minutes') // set to default of 5 hours
5712
- .toISOString()
5740
+ animationStartTime: dateUtils.sub(dateUtils.utc(animationEnd), {
5741
+ minutes: 5 * 60 // set to default of 5 hours
5742
+ }).toISOString()
5713
5743
  }));
5714
- case 58:
5744
+ case 61:
5715
5745
  if (!animationLength) {
5716
- _context8.next = 64;
5746
+ _context8.next = 67;
5717
5747
  break;
5718
5748
  }
5719
- _context8.next = 61;
5749
+ _context8.next = 64;
5720
5750
  return select(getAnimationEndTime$1, mapId);
5721
- case 61:
5751
+ case 64:
5722
5752
  _animationEnd = _context8.sent;
5723
- _context8.next = 64;
5753
+ _context8.next = 67;
5724
5754
  return put(mapActions.setAnimationStartTime({
5725
5755
  mapId: mapId,
5726
- animationStartTime: moment(_animationEnd).subtract(animationLength, 'minutes').toISOString()
5756
+ animationStartTime: dateUtils.sub(dateUtils.utc(_animationEnd), {
5757
+ minutes: animationLength
5758
+ }).toISOString()
5727
5759
  }));
5728
- case 64:
5760
+ case 67:
5729
5761
  if (!(animationPayload && animationPayload.speed)) {
5730
- _context8.next = 67;
5762
+ _context8.next = 70;
5731
5763
  break;
5732
5764
  }
5733
- _context8.next = 67;
5765
+ _context8.next = 70;
5734
5766
  return put(mapActions.setAnimationDelay({
5735
5767
  mapId: mapId,
5736
5768
  animationDelay: getSpeedDelay(animationPayload.speed)
5737
5769
  }));
5738
- case 67:
5770
+ case 70:
5739
5771
  if (!(shouldAnimate === true)) {
5740
- _context8.next = 92;
5772
+ _context8.next = 95;
5741
5773
  break;
5742
5774
  }
5743
5775
  duration = animationPayload && animationPayload.duration ? animationPayload.duration : 5 * 60; // set to default of 5 hours
5744
5776
  if (!(shouldEndtimeOverride && animationEndTime)) {
5745
- _context8.next = 75;
5777
+ _context8.next = 78;
5746
5778
  break;
5747
5779
  }
5748
- _context8.next = 72;
5780
+ _context8.next = 75;
5749
5781
  return select(getAnimationEndTime$1, mapId);
5750
- case 72:
5782
+ case 75:
5751
5783
  _context8.t0 = _context8.sent;
5752
- _context8.next = 76;
5784
+ _context8.next = 79;
5753
5785
  break;
5754
- case 75:
5755
- _context8.t0 = moment.utc().format(dateFormat);
5756
- case 76:
5786
+ case 78:
5787
+ _context8.t0 = dateUtils.dateToString(dateUtils.utc(), dateFormat);
5788
+ case 79:
5757
5789
  _animationEnd2 = _context8.t0;
5758
5790
  if (!(shouldEndtimeOverride && animationLength)) {
5759
- _context8.next = 83;
5791
+ _context8.next = 86;
5760
5792
  break;
5761
5793
  }
5762
- _context8.next = 80;
5794
+ _context8.next = 83;
5763
5795
  return select(getAnimationStartTime, mapId);
5764
- case 80:
5796
+ case 83:
5765
5797
  _context8.t1 = _context8.sent;
5766
- _context8.next = 84;
5798
+ _context8.next = 87;
5767
5799
  break;
5768
- case 83:
5769
- _context8.t1 = moment.utc().subtract(duration, 'minutes').format(dateFormat);
5770
- case 84:
5800
+ case 86:
5801
+ _context8.t1 = dateUtils.dateToString(dateUtils.sub(dateUtils.utc(_animationEnd2), {
5802
+ minutes: duration
5803
+ }), dateFormat);
5804
+ case 87:
5771
5805
  animationStart = _context8.t1;
5772
- _context8.next = 87;
5806
+ _context8.next = 90;
5773
5807
  return put(mapActions.mapStartAnimation({
5774
5808
  mapId: mapId,
5775
5809
  start: animationStart,
5776
5810
  end: _animationEnd2,
5777
5811
  interval: interval || defaultTimeStep
5778
5812
  }));
5779
- case 87:
5813
+ case 90:
5780
5814
  if (!interval) {
5781
- _context8.next = 90;
5815
+ _context8.next = 93;
5782
5816
  break;
5783
5817
  }
5784
- _context8.next = 90;
5818
+ _context8.next = 93;
5785
5819
  return put(mapActions.toggleTimestepAuto({
5786
5820
  mapId: mapId,
5787
5821
  timestepAuto: false
5788
5822
  }));
5789
- case 90:
5790
- _context8.next = 95;
5823
+ case 93:
5824
+ _context8.next = 98;
5791
5825
  break;
5792
- case 92:
5826
+ case 95:
5793
5827
  if (!(toggleTimestepAuto !== undefined)) {
5794
- _context8.next = 95;
5828
+ _context8.next = 98;
5795
5829
  break;
5796
5830
  }
5797
- _context8.next = 95;
5831
+ _context8.next = 98;
5798
5832
  return put(mapActions.toggleTimestepAuto({
5799
5833
  mapId: mapId,
5800
5834
  timestepAuto: toggleTimestepAuto
5801
5835
  }));
5802
- case 95:
5836
+ case 98:
5803
5837
  // show legend
5804
5838
  shouldOpenLegend = shouldShowLegend !== undefined ? shouldShowLegend : IS_LEGEND_OPEN_BY_DEFAULT;
5805
- _context8.next = 98;
5839
+ _context8.next = 101;
5806
5840
  return select(getLegendId, mapId);
5807
- case 98:
5841
+ case 101:
5808
5842
  legendId = _context8.sent;
5809
5843
  if (!legendId) {
5810
- _context8.next = 102;
5844
+ _context8.next = 105;
5811
5845
  break;
5812
5846
  }
5813
- _context8.next = 102;
5847
+ _context8.next = 105;
5814
5848
  return put(uiActions.setToggleOpenDialog({
5815
5849
  type: legendId,
5816
5850
  setOpen: shouldOpenLegend
5817
5851
  }));
5818
- case 102:
5852
+ case 105:
5819
5853
  if (!dockedLayerManagerSize) {
5820
- _context8.next = 105;
5854
+ _context8.next = 108;
5821
5855
  break;
5822
5856
  }
5823
- _context8.next = 105;
5857
+ _context8.next = 108;
5824
5858
  return put(mapActions.setDockedLayerManagerSize({
5825
5859
  mapId: mapId,
5826
5860
  dockedLayerManagerSize: dockedLayerManagerSize
5827
5861
  }));
5828
- case 105:
5862
+ case 108:
5829
5863
  if (!(animationEndTime && (shouldEndtimeOverride || !(shouldAutoUpdate || shouldAnimate)))) {
5830
- _context8.next = 121;
5864
+ _context8.next = 124;
5831
5865
  break;
5832
5866
  }
5833
5867
  fiveMinuteDelayForAnimation = 1000 * 60 * 5;
5834
- _context8.next = 109;
5868
+ _context8.next = 112;
5835
5869
  return delay(fiveMinuteDelayForAnimation);
5836
- case 109:
5837
- _context8.next = 111;
5870
+ case 112:
5871
+ _context8.next = 114;
5838
5872
  return select(getAnimationEndTime$1, mapId);
5839
- case 111:
5873
+ case 114:
5840
5874
  _animationEnd3 = _context8.sent;
5841
- _context8.next = 114;
5875
+ _context8.next = 117;
5842
5876
  return put(mapActions.setAnimationEndTime({
5843
5877
  mapId: mapId,
5844
- animationEndTime: moment(_animationEnd3).add(5, 'minutes').toISOString()
5878
+ animationEndTime: dateUtils.add(dateUtils.utc(_animationEnd3), {
5879
+ minutes: 5
5880
+ }).toISOString()
5845
5881
  }));
5846
- case 114:
5847
- _context8.next = 116;
5882
+ case 117:
5883
+ _context8.next = 119;
5848
5884
  return select(getAnimationStartTime, mapId);
5849
- case 116:
5885
+ case 119:
5850
5886
  _animationStart = _context8.sent;
5851
- _context8.next = 119;
5887
+ _context8.next = 122;
5852
5888
  return put(mapActions.setAnimationStartTime({
5853
5889
  mapId: mapId,
5854
- animationStartTime: moment(_animationStart).add(5, 'minutes').toISOString()
5890
+ animationStartTime: dateUtils.add(dateUtils.utc(_animationStart), {
5891
+ minutes: 5
5892
+ }).toISOString()
5855
5893
  }));
5856
- case 119:
5857
- _context8.next = 105;
5894
+ case 122:
5895
+ _context8.next = 108;
5858
5896
  break;
5859
- case 121:
5860
- _context8.next = 126;
5897
+ case 124:
5898
+ _context8.next = 130;
5861
5899
  break;
5862
- case 123:
5863
- _context8.prev = 123;
5864
- _context8.t2 = _context8["catch"](0);
5865
- console.error(_context8.t2);
5866
5900
  case 126:
5901
+ _context8.prev = 126;
5902
+ _context8.t2 = _context8["catch"](0);
5903
+ _context8.next = 130;
5904
+ return put(mapActions.setMapPresetError({
5905
+ mapId: payload.mapId,
5906
+ error: _context8.t2.message
5907
+ }));
5908
+ case 130:
5867
5909
  case "end":
5868
5910
  return _context8.stop();
5869
5911
  }
5870
- }, _callee6, null, [[0, 123]]);
5912
+ }, _callee6, null, [[0, 126]]);
5871
5913
  })();
5872
5914
  }
5873
5915
  function unregisterMapSaga(_ref7) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/store",
3
- "version": "9.6.0",
3
+ "version": "9.8.0",
4
4
  "description": "GeoWeb Store library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -18,7 +18,6 @@
18
18
  "immer": "^9.0.21",
19
19
  "@redux-eggs/redux-toolkit": "^2.2.0",
20
20
  "@redux-eggs/saga-extension": "^2.2.0",
21
- "moment": "^2.29.4",
22
21
  "date-fns": "^3.3.0",
23
22
  "lodash": "^4.17.21",
24
23
  "@opengeoweb/theme": "*"
@@ -45,6 +45,10 @@ export declare const mapStoreActions: {
45
45
  setDisableMapPin: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").DisableMapPinPayload, "mapReducer/setDisableMapPin">;
46
46
  toggleMapPinIsVisible: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").ToggleMapPinIsVisiblePayload, "mapReducer/toggleMapPinIsVisible">;
47
47
  setDockedLayerManagerSize: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").SetDockedLayerManagerSize, "mapReducer/setDockedLayerManagerSize">;
48
+ setMapPresetError: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
49
+ mapId: string;
50
+ error: string;
51
+ }, "mapReducer/setMapPresetError">;
48
52
  addLayer: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").AddLayerPayload, "layerReducer/addLayer">;
49
53
  duplicateMapLayer: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").DuplicateMapLayerPayload, "layerReducer/duplicateMapLayer">;
50
54
  layerChangeDimension: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").SetLayerDimensionPayload, "layerReducer/layerChangeDimension">;
@@ -3,7 +3,7 @@ import * as utils from './utils';
3
3
  export declare const mapUtils: {
4
4
  replaceLayerIdsToEnsureUniqueLayerIdsInStore: (layerIds: import("./replaceLayerIdsToEnsureUniqueLayerIdsInStore").LayersAndAutoLayerIds) => import("./replaceLayerIdsToEnsureUniqueLayerIdsInStore").LayersAndAutoLayerIds;
5
5
  moveArrayElements<T>(array: T[], oldIndex: number, newIndex: number): T[];
6
- dateFormat: "YYYY-MM-DDTHH:mm:ss[Z]";
6
+ dateFormat: "yyyy-MM-dd'T'HH:mm:ss'Z";
7
7
  createMap: ({ id, isAnimating, animationStartTime, animationEndTime, isAutoUpdating, isEndTimeOverriding, bbox, srs, baseLayers, overLayers, mapLayers, featureLayers, dimensions, autoUpdateLayerId, autoTimeStepLayerId, timeSliderSpan, timeStep, animationDelay, timeSliderWidth, timeSliderCenterTime, timeSliderSecondsPerPx, isTimestepAuto, isTimeSpanAuto, isTimeSliderHoverOn, isTimeSliderVisible, displayMapPin, disableMapPin, shouldShowZoomControls, }: utils.CreateMapProps) => mapTypes.WebMap;
8
8
  checkValidLayersPayload: (layers: import("../types").Layer[], mapId: string) => boolean;
9
9
  getDraftMapById: (mapId: string, draft: mapTypes.WebMapState) => mapTypes.WebMap;
@@ -52,6 +52,10 @@ export declare const slice: import("@reduxjs/toolkit").Slice<WebMapState, {
52
52
  setDisableMapPin: (draft: Draft<WebMapState>, action: PayloadAction<DisableMapPinPayload>) => void;
53
53
  toggleMapPinIsVisible: (draft: Draft<WebMapState>, action: PayloadAction<ToggleMapPinIsVisiblePayload>) => void;
54
54
  setDockedLayerManagerSize: (draft: Draft<WebMapState>, action: PayloadAction<SetDockedLayerManagerSize>) => void;
55
+ setMapPresetError: (draft: Draft<WebMapState>, action: PayloadAction<{
56
+ mapId: string;
57
+ error: string;
58
+ }>) => void;
55
59
  }, "mapReducer">;
56
60
  export declare const mapActions: {
57
61
  setMapPreset: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").SetMapPresetPayload, string>;
@@ -97,5 +101,9 @@ export declare const mapActions: {
97
101
  setDisableMapPin: import("@reduxjs/toolkit").ActionCreatorWithPayload<DisableMapPinPayload, "mapReducer/setDisableMapPin">;
98
102
  toggleMapPinIsVisible: import("@reduxjs/toolkit").ActionCreatorWithPayload<ToggleMapPinIsVisiblePayload, "mapReducer/toggleMapPinIsVisible">;
99
103
  setDockedLayerManagerSize: import("@reduxjs/toolkit").ActionCreatorWithPayload<SetDockedLayerManagerSize, "mapReducer/setDockedLayerManagerSize">;
104
+ setMapPresetError: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
105
+ mapId: string;
106
+ error: string;
107
+ }, "mapReducer/setMapPresetError">;
100
108
  };
101
109
  export declare const reducer: import("redux").Reducer<WebMapState, import("redux").AnyAction>;
@@ -1,10 +1,9 @@
1
1
  import { SagaIterator } from 'redux-saga';
2
- import { Moment } from 'moment';
3
2
  import { AnimationStep } from '@opengeoweb/webmap';
4
3
  import { mapActions } from '.';
5
4
  import { layerActions } from '../layers';
6
5
  import { Layer } from '../layers/types';
7
- export declare const generateTimeList: (start: Moment, end: Moment, interval: number) => {
6
+ export declare const generateTimeList: (start: Date, end: Date, interval: number) => {
8
7
  name: string;
9
8
  value: string;
10
9
  }[];
@@ -3,7 +3,7 @@ import { Bbox, Dimension } from './types';
3
3
  import { Scale } from './enums';
4
4
  import type { WebMapState, WebMap, SpeedFactorType } from '../types';
5
5
  import type { Layer } from '../layers/types';
6
- export declare const dateFormat = "YYYY-MM-DDTHH:mm:ss[Z]";
6
+ export declare const dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z";
7
7
  export interface CreateMapProps {
8
8
  id: string;
9
9
  isAnimating?: boolean;