@opengeoweb/warnings 6.1.0 → 7.0.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
@@ -1,11 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { useContext, useRef, useCallback, useDebugValue, Fragment, useState, useEffect } from 'react';
3
3
  import 'react-dom';
4
- import { Polygons, Edit, Delete } from '@opengeoweb/theme';
5
- import { uiTypes, uiSelectors, uiActions, layerSelectors, drawSelectors, mapStoreActions, drawActions, snackbarActions } from '@opengeoweb/store';
6
- import { MapControlButton, useSetupDialog } from '@opengeoweb/core';
7
- import { dateUtils, ToggleMenu, ToolContainerDraggable, AlertBanner, calculateDialogSizeAndPosition } from '@opengeoweb/shared';
8
- import { List, Typography, ListItem, MenuItem, ListItemText, Paper, ListItemButton, Box, Stack } from '@mui/material';
4
+ import { Polygons } from '@opengeoweb/theme';
5
+ import { uiTypes, uiSelectors, layerSelectors, drawSelectors, uiActions, drawActions, mapStoreActions, snackbarActions } from '@opengeoweb/store';
6
+ import { MapControlButton } from '@opengeoweb/webmap-react';
7
+ import { useAreaDrawDialogAction, useSetupDialog } from '@opengeoweb/core';
8
+ import { dateUtils, ToolContainerDraggable, AlertBanner, calculateDialogSizeAndPosition } from '@opengeoweb/shared';
9
+ import { Typography, List, ListItem, Paper, ListItemButton, Box, Stack, LinearProgress } from '@mui/material';
9
10
  import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
10
11
 
11
12
  var shim = {exports: {}};
@@ -1198,357 +1199,376 @@ initializeUseSelector(withSelector.exports.useSyncExternalStoreWithSelector);
1198
1199
  * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1199
1200
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
1200
1201
  * */
1201
- var dialogType$1 = uiTypes.DialogTypes.AreaManager;
1202
+ var areaDialogType = uiTypes.DialogTypes.AreaManager;
1202
1203
  var AreaManagerMapButtonConnect = function AreaManagerMapButtonConnect(_ref) {
1203
1204
  var mapId = _ref.mapId,
1204
1205
  _ref$source = _ref.source,
1205
1206
  source = _ref$source === void 0 ? 'app' : _ref$source;
1206
- var dispatch = useDispatch();
1207
+ var _useAreaDrawDialogAct = useAreaDrawDialogAction({
1208
+ mapId: mapId,
1209
+ source: source
1210
+ }),
1211
+ closeDrawDialog = _useAreaDrawDialogAct.closeDrawDialog,
1212
+ openAreaDialog = _useAreaDrawDialogAct.openAreaDialog,
1213
+ closeAreaDialog = _useAreaDrawDialogAct.closeAreaDialog;
1207
1214
  var mapIdForCurrentlyOpenDialog = useSelector(function (store) {
1208
- return uiSelectors.getDialogMapId(store, dialogType$1);
1215
+ return uiSelectors.getDialogMapId(store, areaDialogType);
1209
1216
  });
1210
- var dialogIsOpen = useSelector(function (store) {
1211
- return uiSelectors.getisDialogOpen(store, dialogType$1);
1217
+ var isAreaDialogOpen = useSelector(function (store) {
1218
+ return uiSelectors.getisDialogOpen(store, areaDialogType);
1212
1219
  });
1220
+ var drawingDialogType = "".concat(uiTypes.DialogTypes.DockedDrawingTool, "-").concat(mapId);
1221
+ var isDrawDialogOpen = useSelector(function (store) {
1222
+ return uiSelectors.getisDialogOpen(store, drawingDialogType);
1223
+ });
1224
+ var openAreasDialog = function openAreasDialog() {
1225
+ // close drawing dialog if open
1226
+ if (isDrawDialogOpen) {
1227
+ closeDrawDialog();
1228
+ }
1229
+ // open area manager dialog
1230
+ openAreaDialog();
1231
+ };
1232
+ var onClick = function onClick() {
1233
+ var openDialogForAnotherMap = mapIdForCurrentlyOpenDialog !== mapId;
1234
+ var shouldOpen = openDialogForAnotherMap || !isAreaDialogOpen;
1235
+ shouldOpen ? openAreasDialog() : closeAreaDialog();
1236
+ };
1213
1237
  return /*#__PURE__*/React__default.createElement(MapControlButton, {
1214
1238
  "aria-label": "Area Manager Button for ".concat(mapId),
1215
1239
  title: "Area Manager",
1216
- onClick: function onClick() {
1217
- var openDialogForAnotherMap = mapIdForCurrentlyOpenDialog !== mapId;
1218
- var shouldOpen = openDialogForAnotherMap || !dialogIsOpen;
1219
- dispatch(uiActions.setActiveMapIdForDialog({
1220
- type: dialogType$1,
1221
- mapId: mapId,
1222
- setOpen: shouldOpen,
1223
- source: source
1224
- }));
1225
- },
1226
- isActive: mapIdForCurrentlyOpenDialog === mapId && dialogIsOpen
1240
+ onClick: onClick,
1241
+ isActive: mapIdForCurrentlyOpenDialog === mapId && isAreaDialogOpen
1227
1242
  }, /*#__PURE__*/React__default.createElement(Polygons, null));
1228
1243
  };
1229
1244
 
1230
- function _iterableToArrayLimit(arr, i) {
1231
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
1232
- if (null != _i) {
1233
- var _s,
1234
- _e,
1235
- _x,
1236
- _r,
1237
- _arr = [],
1238
- _n = !0,
1239
- _d = !1;
1245
+ function _iterableToArrayLimit(r, l) {
1246
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
1247
+ if (null != t) {
1248
+ var e,
1249
+ n,
1250
+ i,
1251
+ u,
1252
+ a = [],
1253
+ f = !0,
1254
+ o = !1;
1240
1255
  try {
1241
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
1242
- if (Object(_i) !== _i) return;
1243
- _n = !1;
1244
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
1245
- } catch (err) {
1246
- _d = !0, _e = err;
1256
+ if (i = (t = t.call(r)).next, 0 === l) {
1257
+ if (Object(t) !== t) return;
1258
+ f = !1;
1259
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
1260
+ } catch (r) {
1261
+ o = !0, n = r;
1247
1262
  } finally {
1248
1263
  try {
1249
- if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
1264
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
1250
1265
  } finally {
1251
- if (_d) throw _e;
1266
+ if (o) throw n;
1252
1267
  }
1253
1268
  }
1254
- return _arr;
1269
+ return a;
1255
1270
  }
1256
1271
  }
1257
1272
  function _regeneratorRuntime() {
1258
1273
  _regeneratorRuntime = function () {
1259
- return exports;
1274
+ return e;
1260
1275
  };
1261
- var exports = {},
1262
- Op = Object.prototype,
1263
- hasOwn = Op.hasOwnProperty,
1264
- defineProperty = Object.defineProperty || function (obj, key, desc) {
1265
- obj[key] = desc.value;
1276
+ var t,
1277
+ e = {},
1278
+ r = Object.prototype,
1279
+ n = r.hasOwnProperty,
1280
+ o = Object.defineProperty || function (t, e, r) {
1281
+ t[e] = r.value;
1266
1282
  },
1267
- $Symbol = "function" == typeof Symbol ? Symbol : {},
1268
- iteratorSymbol = $Symbol.iterator || "@@iterator",
1269
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
1270
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
1271
- function define(obj, key, value) {
1272
- return Object.defineProperty(obj, key, {
1273
- value: value,
1283
+ i = "function" == typeof Symbol ? Symbol : {},
1284
+ a = i.iterator || "@@iterator",
1285
+ c = i.asyncIterator || "@@asyncIterator",
1286
+ u = i.toStringTag || "@@toStringTag";
1287
+ function define(t, e, r) {
1288
+ return Object.defineProperty(t, e, {
1289
+ value: r,
1274
1290
  enumerable: !0,
1275
1291
  configurable: !0,
1276
1292
  writable: !0
1277
- }), obj[key];
1293
+ }), t[e];
1278
1294
  }
1279
1295
  try {
1280
1296
  define({}, "");
1281
- } catch (err) {
1282
- define = function (obj, key, value) {
1283
- return obj[key] = value;
1297
+ } catch (t) {
1298
+ define = function (t, e, r) {
1299
+ return t[e] = r;
1284
1300
  };
1285
1301
  }
1286
- function wrap(innerFn, outerFn, self, tryLocsList) {
1287
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
1288
- generator = Object.create(protoGenerator.prototype),
1289
- context = new Context(tryLocsList || []);
1290
- return defineProperty(generator, "_invoke", {
1291
- value: makeInvokeMethod(innerFn, self, context)
1292
- }), generator;
1302
+ function wrap(t, e, r, n) {
1303
+ var i = e && e.prototype instanceof Generator ? e : Generator,
1304
+ a = Object.create(i.prototype),
1305
+ c = new Context(n || []);
1306
+ return o(a, "_invoke", {
1307
+ value: makeInvokeMethod(t, r, c)
1308
+ }), a;
1293
1309
  }
1294
- function tryCatch(fn, obj, arg) {
1310
+ function tryCatch(t, e, r) {
1295
1311
  try {
1296
1312
  return {
1297
1313
  type: "normal",
1298
- arg: fn.call(obj, arg)
1314
+ arg: t.call(e, r)
1299
1315
  };
1300
- } catch (err) {
1316
+ } catch (t) {
1301
1317
  return {
1302
1318
  type: "throw",
1303
- arg: err
1319
+ arg: t
1304
1320
  };
1305
1321
  }
1306
1322
  }
1307
- exports.wrap = wrap;
1308
- var ContinueSentinel = {};
1323
+ e.wrap = wrap;
1324
+ var h = "suspendedStart",
1325
+ l = "suspendedYield",
1326
+ f = "executing",
1327
+ s = "completed",
1328
+ y = {};
1309
1329
  function Generator() {}
1310
1330
  function GeneratorFunction() {}
1311
1331
  function GeneratorFunctionPrototype() {}
1312
- var IteratorPrototype = {};
1313
- define(IteratorPrototype, iteratorSymbol, function () {
1332
+ var p = {};
1333
+ define(p, a, function () {
1314
1334
  return this;
1315
1335
  });
1316
- var getProto = Object.getPrototypeOf,
1317
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
1318
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
1319
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
1320
- function defineIteratorMethods(prototype) {
1321
- ["next", "throw", "return"].forEach(function (method) {
1322
- define(prototype, method, function (arg) {
1323
- return this._invoke(method, arg);
1336
+ var d = Object.getPrototypeOf,
1337
+ v = d && d(d(values([])));
1338
+ v && v !== r && n.call(v, a) && (p = v);
1339
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
1340
+ function defineIteratorMethods(t) {
1341
+ ["next", "throw", "return"].forEach(function (e) {
1342
+ define(t, e, function (t) {
1343
+ return this._invoke(e, t);
1324
1344
  });
1325
1345
  });
1326
1346
  }
1327
- function AsyncIterator(generator, PromiseImpl) {
1328
- function invoke(method, arg, resolve, reject) {
1329
- var record = tryCatch(generator[method], generator, arg);
1330
- if ("throw" !== record.type) {
1331
- var result = record.arg,
1332
- value = result.value;
1333
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
1334
- invoke("next", value, resolve, reject);
1335
- }, function (err) {
1336
- invoke("throw", err, resolve, reject);
1337
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
1338
- result.value = unwrapped, resolve(result);
1339
- }, function (error) {
1340
- return invoke("throw", error, resolve, reject);
1347
+ function AsyncIterator(t, e) {
1348
+ function invoke(r, o, i, a) {
1349
+ var c = tryCatch(t[r], t, o);
1350
+ if ("throw" !== c.type) {
1351
+ var u = c.arg,
1352
+ h = u.value;
1353
+ return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
1354
+ invoke("next", t, i, a);
1355
+ }, function (t) {
1356
+ invoke("throw", t, i, a);
1357
+ }) : e.resolve(h).then(function (t) {
1358
+ u.value = t, i(u);
1359
+ }, function (t) {
1360
+ return invoke("throw", t, i, a);
1341
1361
  });
1342
1362
  }
1343
- reject(record.arg);
1363
+ a(c.arg);
1344
1364
  }
1345
- var previousPromise;
1346
- defineProperty(this, "_invoke", {
1347
- value: function (method, arg) {
1365
+ var r;
1366
+ o(this, "_invoke", {
1367
+ value: function (t, n) {
1348
1368
  function callInvokeWithMethodAndArg() {
1349
- return new PromiseImpl(function (resolve, reject) {
1350
- invoke(method, arg, resolve, reject);
1369
+ return new e(function (e, r) {
1370
+ invoke(t, n, e, r);
1351
1371
  });
1352
1372
  }
1353
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
1373
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
1354
1374
  }
1355
1375
  });
1356
1376
  }
1357
- function makeInvokeMethod(innerFn, self, context) {
1358
- var state = "suspendedStart";
1359
- return function (method, arg) {
1360
- if ("executing" === state) throw new Error("Generator is already running");
1361
- if ("completed" === state) {
1362
- if ("throw" === method) throw arg;
1377
+ function makeInvokeMethod(e, r, n) {
1378
+ var o = h;
1379
+ return function (i, a) {
1380
+ if (o === f) throw new Error("Generator is already running");
1381
+ if (o === s) {
1382
+ if ("throw" === i) throw a;
1363
1383
  return {
1364
- value: void 0,
1384
+ value: t,
1365
1385
  done: !0
1366
1386
  };
1367
1387
  }
1368
- for (context.method = method, context.arg = arg;;) {
1369
- var delegate = context.delegate;
1370
- if (delegate) {
1371
- var delegateResult = maybeInvokeDelegate(delegate, context);
1372
- if (delegateResult) {
1373
- if (delegateResult === ContinueSentinel) continue;
1374
- return delegateResult;
1388
+ for (n.method = i, n.arg = a;;) {
1389
+ var c = n.delegate;
1390
+ if (c) {
1391
+ var u = maybeInvokeDelegate(c, n);
1392
+ if (u) {
1393
+ if (u === y) continue;
1394
+ return u;
1375
1395
  }
1376
1396
  }
1377
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
1378
- if ("suspendedStart" === state) throw state = "completed", context.arg;
1379
- context.dispatchException(context.arg);
1380
- } else "return" === context.method && context.abrupt("return", context.arg);
1381
- state = "executing";
1382
- var record = tryCatch(innerFn, self, context);
1383
- if ("normal" === record.type) {
1384
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
1397
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
1398
+ if (o === h) throw o = s, n.arg;
1399
+ n.dispatchException(n.arg);
1400
+ } else "return" === n.method && n.abrupt("return", n.arg);
1401
+ o = f;
1402
+ var p = tryCatch(e, r, n);
1403
+ if ("normal" === p.type) {
1404
+ if (o = n.done ? s : l, p.arg === y) continue;
1385
1405
  return {
1386
- value: record.arg,
1387
- done: context.done
1406
+ value: p.arg,
1407
+ done: n.done
1388
1408
  };
1389
1409
  }
1390
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
1410
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
1391
1411
  }
1392
1412
  };
1393
1413
  }
1394
- function maybeInvokeDelegate(delegate, context) {
1395
- var methodName = context.method,
1396
- method = delegate.iterator[methodName];
1397
- if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
1398
- var record = tryCatch(method, delegate.iterator, context.arg);
1399
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
1400
- var info = record.arg;
1401
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
1414
+ function maybeInvokeDelegate(e, r) {
1415
+ var n = r.method,
1416
+ o = e.iterator[n];
1417
+ if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
1418
+ var i = tryCatch(o, e.iterator, r.arg);
1419
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
1420
+ var a = i.arg;
1421
+ return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
1402
1422
  }
1403
- function pushTryEntry(locs) {
1404
- var entry = {
1405
- tryLoc: locs[0]
1423
+ function pushTryEntry(t) {
1424
+ var e = {
1425
+ tryLoc: t[0]
1406
1426
  };
1407
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
1427
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
1408
1428
  }
1409
- function resetTryEntry(entry) {
1410
- var record = entry.completion || {};
1411
- record.type = "normal", delete record.arg, entry.completion = record;
1429
+ function resetTryEntry(t) {
1430
+ var e = t.completion || {};
1431
+ e.type = "normal", delete e.arg, t.completion = e;
1412
1432
  }
1413
- function Context(tryLocsList) {
1433
+ function Context(t) {
1414
1434
  this.tryEntries = [{
1415
1435
  tryLoc: "root"
1416
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
1436
+ }], t.forEach(pushTryEntry, this), this.reset(!0);
1417
1437
  }
1418
- function values(iterable) {
1419
- if (iterable || "" === iterable) {
1420
- var iteratorMethod = iterable[iteratorSymbol];
1421
- if (iteratorMethod) return iteratorMethod.call(iterable);
1422
- if ("function" == typeof iterable.next) return iterable;
1423
- if (!isNaN(iterable.length)) {
1424
- var i = -1,
1425
- next = function next() {
1426
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
1427
- return next.value = undefined, next.done = !0, next;
1438
+ function values(e) {
1439
+ if (e || "" === e) {
1440
+ var r = e[a];
1441
+ if (r) return r.call(e);
1442
+ if ("function" == typeof e.next) return e;
1443
+ if (!isNaN(e.length)) {
1444
+ var o = -1,
1445
+ i = function next() {
1446
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
1447
+ return next.value = t, next.done = !0, next;
1428
1448
  };
1429
- return next.next = next;
1449
+ return i.next = i;
1430
1450
  }
1431
1451
  }
1432
- throw new TypeError(typeof iterable + " is not iterable");
1452
+ throw new TypeError(typeof e + " is not iterable");
1433
1453
  }
1434
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
1454
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
1435
1455
  value: GeneratorFunctionPrototype,
1436
1456
  configurable: !0
1437
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
1457
+ }), o(GeneratorFunctionPrototype, "constructor", {
1438
1458
  value: GeneratorFunction,
1439
1459
  configurable: !0
1440
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
1441
- var ctor = "function" == typeof genFun && genFun.constructor;
1442
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
1443
- }, exports.mark = function (genFun) {
1444
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
1445
- }, exports.awrap = function (arg) {
1460
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
1461
+ var e = "function" == typeof t && t.constructor;
1462
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
1463
+ }, e.mark = function (t) {
1464
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
1465
+ }, e.awrap = function (t) {
1446
1466
  return {
1447
- __await: arg
1467
+ __await: t
1448
1468
  };
1449
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
1469
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
1450
1470
  return this;
1451
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
1452
- void 0 === PromiseImpl && (PromiseImpl = Promise);
1453
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
1454
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
1455
- return result.done ? result.value : iter.next();
1471
+ }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
1472
+ void 0 === i && (i = Promise);
1473
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
1474
+ return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
1475
+ return t.done ? t.value : a.next();
1456
1476
  });
1457
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
1477
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
1458
1478
  return this;
1459
- }), define(Gp, "toString", function () {
1479
+ }), define(g, "toString", function () {
1460
1480
  return "[object Generator]";
1461
- }), exports.keys = function (val) {
1462
- var object = Object(val),
1463
- keys = [];
1464
- for (var key in object) keys.push(key);
1465
- return keys.reverse(), function next() {
1466
- for (; keys.length;) {
1467
- var key = keys.pop();
1468
- if (key in object) return next.value = key, next.done = !1, next;
1481
+ }), e.keys = function (t) {
1482
+ var e = Object(t),
1483
+ r = [];
1484
+ for (var n in e) r.push(n);
1485
+ return r.reverse(), function next() {
1486
+ for (; r.length;) {
1487
+ var t = r.pop();
1488
+ if (t in e) return next.value = t, next.done = !1, next;
1469
1489
  }
1470
1490
  return next.done = !0, next;
1471
1491
  };
1472
- }, exports.values = values, Context.prototype = {
1492
+ }, e.values = values, Context.prototype = {
1473
1493
  constructor: Context,
1474
- reset: function (skipTempReset) {
1475
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
1494
+ reset: function (e) {
1495
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
1476
1496
  },
1477
1497
  stop: function () {
1478
1498
  this.done = !0;
1479
- var rootRecord = this.tryEntries[0].completion;
1480
- if ("throw" === rootRecord.type) throw rootRecord.arg;
1499
+ var t = this.tryEntries[0].completion;
1500
+ if ("throw" === t.type) throw t.arg;
1481
1501
  return this.rval;
1482
1502
  },
1483
- dispatchException: function (exception) {
1484
- if (this.done) throw exception;
1485
- var context = this;
1486
- function handle(loc, caught) {
1487
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
1503
+ dispatchException: function (e) {
1504
+ if (this.done) throw e;
1505
+ var r = this;
1506
+ function handle(n, o) {
1507
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
1488
1508
  }
1489
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1490
- var entry = this.tryEntries[i],
1491
- record = entry.completion;
1492
- if ("root" === entry.tryLoc) return handle("end");
1493
- if (entry.tryLoc <= this.prev) {
1494
- var hasCatch = hasOwn.call(entry, "catchLoc"),
1495
- hasFinally = hasOwn.call(entry, "finallyLoc");
1496
- if (hasCatch && hasFinally) {
1497
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
1498
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
1499
- } else if (hasCatch) {
1500
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
1509
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
1510
+ var i = this.tryEntries[o],
1511
+ a = i.completion;
1512
+ if ("root" === i.tryLoc) return handle("end");
1513
+ if (i.tryLoc <= this.prev) {
1514
+ var c = n.call(i, "catchLoc"),
1515
+ u = n.call(i, "finallyLoc");
1516
+ if (c && u) {
1517
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
1518
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
1519
+ } else if (c) {
1520
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
1501
1521
  } else {
1502
- if (!hasFinally) throw new Error("try statement without catch or finally");
1503
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
1522
+ if (!u) throw new Error("try statement without catch or finally");
1523
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
1504
1524
  }
1505
1525
  }
1506
1526
  }
1507
1527
  },
1508
- abrupt: function (type, arg) {
1509
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1510
- var entry = this.tryEntries[i];
1511
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
1512
- var finallyEntry = entry;
1528
+ abrupt: function (t, e) {
1529
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
1530
+ var o = this.tryEntries[r];
1531
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
1532
+ var i = o;
1513
1533
  break;
1514
1534
  }
1515
1535
  }
1516
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
1517
- var record = finallyEntry ? finallyEntry.completion : {};
1518
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
1536
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
1537
+ var a = i ? i.completion : {};
1538
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
1519
1539
  },
1520
- complete: function (record, afterLoc) {
1521
- if ("throw" === record.type) throw record.arg;
1522
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
1540
+ complete: function (t, e) {
1541
+ if ("throw" === t.type) throw t.arg;
1542
+ return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
1523
1543
  },
1524
- finish: function (finallyLoc) {
1525
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1526
- var entry = this.tryEntries[i];
1527
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
1544
+ finish: function (t) {
1545
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
1546
+ var r = this.tryEntries[e];
1547
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
1528
1548
  }
1529
1549
  },
1530
- catch: function (tryLoc) {
1531
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1532
- var entry = this.tryEntries[i];
1533
- if (entry.tryLoc === tryLoc) {
1534
- var record = entry.completion;
1535
- if ("throw" === record.type) {
1536
- var thrown = record.arg;
1537
- resetTryEntry(entry);
1550
+ catch: function (t) {
1551
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
1552
+ var r = this.tryEntries[e];
1553
+ if (r.tryLoc === t) {
1554
+ var n = r.completion;
1555
+ if ("throw" === n.type) {
1556
+ var o = n.arg;
1557
+ resetTryEntry(r);
1538
1558
  }
1539
- return thrown;
1559
+ return o;
1540
1560
  }
1541
1561
  }
1542
1562
  throw new Error("illegal catch attempt");
1543
1563
  },
1544
- delegateYield: function (iterable, resultName, nextLoc) {
1564
+ delegateYield: function (e, r, n) {
1545
1565
  return this.delegate = {
1546
- iterator: values(iterable),
1547
- resultName: resultName,
1548
- nextLoc: nextLoc
1549
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
1566
+ iterator: values(e),
1567
+ resultName: r,
1568
+ nextLoc: n
1569
+ }, "next" === this.method && (this.arg = t), y;
1550
1570
  }
1551
- }, exports;
1571
+ }, e;
1552
1572
  }
1553
1573
  function _slicedToArray(arr, i) {
1554
1574
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
@@ -1631,12 +1651,21 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
1631
1651
  * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1632
1652
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
1633
1653
  * */
1654
+ var NO_AREAS_FOUND = 'No areas found';
1634
1655
  var Drawings = function Drawings(_ref) {
1635
1656
  var drawings = _ref.drawings,
1636
1657
  onClickDrawing = _ref.onClickDrawing,
1637
- onClickEdit = _ref.onClickEdit,
1638
1658
  activeDrawing = _ref.activeDrawing;
1639
1659
  var lastHeaderRef = React__default.useRef('');
1660
+ if (drawings.length === 0) {
1661
+ return /*#__PURE__*/React__default.createElement(Typography, {
1662
+ sx: {
1663
+ paddingLeft: '16px',
1664
+ paddingTop: '8px'
1665
+ },
1666
+ variant: "body1"
1667
+ }, NO_AREAS_FOUND);
1668
+ }
1640
1669
  return /*#__PURE__*/React__default.createElement(List, null, drawings.map(function (drawing) {
1641
1670
  var drawingDate = dateUtils.isoStringToDate(drawing.lastUpdatedTime);
1642
1671
  var header = dateUtils.dateToString(drawingDate, 'EEEE, MMMM dd', true);
@@ -1650,17 +1679,7 @@ var Drawings = function Drawings(_ref) {
1650
1679
  },
1651
1680
  variant: "caption"
1652
1681
  }, header), /*#__PURE__*/React__default.createElement(ListItem, {
1653
- disablePadding: true,
1654
- secondaryAction: /*#__PURE__*/React__default.createElement(ToggleMenu, {
1655
- menuTitle: "Area options",
1656
- tooltipTitle: "Area options",
1657
- menuPosition: "bottom",
1658
- "aria-label": "Options"
1659
- }, /*#__PURE__*/React__default.createElement(MenuItem, {
1660
- onClick: function onClick() {
1661
- return onClickEdit(drawing.id);
1662
- }
1663
- }, /*#__PURE__*/React__default.createElement(ListItemText, null, "Edit"), /*#__PURE__*/React__default.createElement(Edit, null)), /*#__PURE__*/React__default.createElement(MenuItem, null, /*#__PURE__*/React__default.createElement(ListItemText, null, "Delete"), " ", /*#__PURE__*/React__default.createElement(Delete, null)))
1682
+ disablePadding: true
1664
1683
  }, /*#__PURE__*/React__default.createElement(Paper, {
1665
1684
  elevation: 1,
1666
1685
  sx: {
@@ -1733,25 +1752,17 @@ var AreaManager = function AreaManager(_ref) {
1733
1752
  drawingListItems = _ref.drawingListItems,
1734
1753
  _ref$onClickDrawing = _ref.onClickDrawing,
1735
1754
  onClickDrawing = _ref$onClickDrawing === void 0 ? function () {} : _ref$onClickDrawing,
1736
- _ref$onUnMount = _ref.onUnMount,
1737
- onUnMount = _ref$onUnMount === void 0 ? function () {} : _ref$onUnMount,
1738
- _ref$onEditDrawing = _ref.onEditDrawing,
1739
- onEditDrawing = _ref$onEditDrawing === void 0 ? function () {} : _ref$onEditDrawing,
1740
1755
  _ref$activeDrawingId = _ref.activeDrawingId,
1741
1756
  activeDrawingId = _ref$activeDrawingId === void 0 ? '' : _ref$activeDrawingId,
1742
- error = _ref.error;
1757
+ error = _ref.error,
1758
+ _ref$isLoading = _ref.isLoading,
1759
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading;
1743
1760
  var minSize = DEFAULT_AREA_MANAGER_MIN_SIZE;
1744
1761
  var startSizeCalc = calculateStartSize(minSize, size, startPosition);
1745
1762
  var _React$useState = React.useState(startSizeCalc),
1746
1763
  _React$useState2 = _slicedToArray(_React$useState, 2),
1747
1764
  sizeInState = _React$useState2[0],
1748
1765
  setSizeInState = _React$useState2[1];
1749
- React.useEffect(function () {
1750
- return function () {
1751
- onUnMount();
1752
- };
1753
- // eslint-disable-next-line react-hooks/exhaustive-deps
1754
- }, []);
1755
1766
  return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
1756
1767
  title: title,
1757
1768
  startSize: sizeInState,
@@ -1784,13 +1795,16 @@ var AreaManager = function AreaManager(_ref) {
1784
1795
  setSizeInState(dragSize);
1785
1796
  }
1786
1797
  }
1787
- }, error && /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(AlertBanner, {
1798
+ }, isLoading && /*#__PURE__*/React.createElement(LinearProgress, {
1799
+ "data-testid": "loading-bar",
1800
+ color: "secondary"
1801
+ }), error && /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(AlertBanner, {
1788
1802
  title: error,
1789
1803
  shouldClose: true
1790
- })), /*#__PURE__*/React.createElement(Drawings, {
1804
+ })), !isLoading && !error && /*#__PURE__*/React.createElement(Drawings, {
1791
1805
  drawings: drawingListItems,
1792
1806
  onClickDrawing: onClickDrawing,
1793
- onClickEdit: onEditDrawing,
1807
+ // onClickEdit={onEditDrawing}
1794
1808
  activeDrawing: activeDrawingId
1795
1809
  }));
1796
1810
  };
@@ -1812,6 +1826,10 @@ var AreaManager = function AreaManager(_ref) {
1812
1826
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
1813
1827
  * */
1814
1828
  var API_NAME = 'warnings';
1829
+ var getIdFromUrl = function getIdFromUrl(url) {
1830
+ var splitString = url && url.split('/');
1831
+ return url && splitString[splitString.length - 2];
1832
+ };
1815
1833
  var getApiRoutes$1 = function getApiRoutes(axiosInstance) {
1816
1834
  return {
1817
1835
  getDrawings: function getDrawings() {
@@ -1824,7 +1842,10 @@ var getApiRoutes$1 = function getApiRoutes(axiosInstance) {
1824
1842
  return axiosInstance.post("/drawings/".concat(drawingId, "/"), data);
1825
1843
  },
1826
1844
  saveDrawingAs: function saveDrawingAs(data) {
1827
- return axiosInstance.post("/drawings/", data);
1845
+ return axiosInstance.post("/drawings/", data).then(function (response) {
1846
+ var headerLocation = response === null || response === void 0 ? void 0 : response.request.getResponseHeader('Location');
1847
+ return getIdFromUrl(headerLocation);
1848
+ });
1828
1849
  },
1829
1850
  deleteDrawing: function deleteDrawing(drawingId) {
1830
1851
  return axiosInstance.post("/drawings/".concat(drawingId, "?delete=true"));
@@ -1848,7 +1869,6 @@ var AreaManagerConnect = function AreaManagerConnect(_ref) {
1848
1869
  var _useSetupDialog = useSetupDialog(dialogType, source),
1849
1870
  dialogOrder = _useSetupDialog.dialogOrder,
1850
1871
  setDialogOrder = _useSetupDialog.setDialogOrder,
1851
- onCloseDialog = _useSetupDialog.onCloseDialog,
1852
1872
  isDialogOpen = _useSetupDialog.isDialogOpen,
1853
1873
  uiSource = _useSetupDialog.uiSource,
1854
1874
  setFocused = _useSetupDialog.setFocused,
@@ -1858,6 +1878,11 @@ var AreaManagerConnect = function AreaManagerConnect(_ref) {
1858
1878
  var mapId = useSelector(function (store) {
1859
1879
  return uiSelectors.getDialogMapId(store, dialogType);
1860
1880
  });
1881
+ var _useAreaDrawDialogAct = useAreaDrawDialogAction({
1882
+ mapId: mapId,
1883
+ source: source
1884
+ }),
1885
+ closeAreaDialog = _useAreaDrawDialogAct.closeAreaDialog;
1861
1886
  var geoJSONLayerId = "".concat(mapId, "-geosjon");
1862
1887
  var currentLayer = useSelector(function (store) {
1863
1888
  return layerSelectors.getLayerById(store, geoJSONLayerId);
@@ -1870,14 +1895,21 @@ var AreaManagerConnect = function AreaManagerConnect(_ref) {
1870
1895
  _useState2 = _slicedToArray(_useState, 2),
1871
1896
  drawings = _useState2[0],
1872
1897
  setDrawings = _useState2[1];
1898
+ var _useState3 = useState(false),
1899
+ _useState4 = _slicedToArray(_useState3, 2),
1900
+ loading = _useState4[0],
1901
+ setLoading = _useState4[1];
1873
1902
  var fetchDrawings = function fetchDrawings() {
1874
1903
  uiActions.setErrorDialog({
1875
1904
  error: 'error.message',
1876
1905
  type: dialogType
1877
1906
  });
1907
+ setLoading(true);
1878
1908
  warningsApi.getDrawings().then(function (response) {
1909
+ setLoading(false);
1879
1910
  setDrawings(response.data);
1880
1911
  })["catch"](function (error) {
1912
+ setLoading(false);
1881
1913
  dispatch(uiActions.setErrorDialog({
1882
1914
  error: error.message,
1883
1915
  type: dialogType
@@ -1885,9 +1917,11 @@ var AreaManagerConnect = function AreaManagerConnect(_ref) {
1885
1917
  });
1886
1918
  };
1887
1919
  useEffect(function () {
1888
- fetchDrawings();
1920
+ if (isDialogOpen) {
1921
+ fetchDrawings();
1922
+ }
1889
1923
  // eslint-disable-next-line react-hooks/exhaustive-deps
1890
- }, []);
1924
+ }, [isDialogOpen]);
1891
1925
  var deleteGeoJSONLayer = function deleteGeoJSONLayer() {
1892
1926
  dispatch(mapStoreActions.layerDelete({
1893
1927
  layerId: geoJSONLayerId,
@@ -1947,55 +1981,38 @@ var AreaManagerConnect = function AreaManagerConnect(_ref) {
1947
1981
  }, _callee2);
1948
1982
  }));
1949
1983
  };
1950
- var openDrawTools = function openDrawTools(drawingId) {
1951
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
1952
- var _yield$warningsApi$ge, data;
1953
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1954
- while (1) switch (_context3.prev = _context3.next) {
1955
- case 0:
1956
- _context3.prev = 0;
1957
- _context3.next = 3;
1958
- return warningsApi.getDrawingDetails(drawingId);
1959
- case 3:
1960
- _yield$warningsApi$ge = _context3.sent;
1961
- data = _yield$warningsApi$ge.data;
1962
- // update draw tool values
1963
- dispatch(drawActions.setDrawValues({
1964
- area: data.area,
1965
- areaName: data.name,
1966
- mapId: mapId,
1967
- id: drawingId
1968
- }));
1969
- // open draw dialog
1970
- dispatch(uiActions.setActiveMapIdForDialog({
1971
- type: "".concat(uiTypes.DialogTypes.DockedDrawingTool, "-").concat(mapId),
1972
- mapId: mapId,
1973
- setOpen: true,
1974
- source: source
1975
- }));
1976
- _context3.next = 11;
1977
- break;
1978
- case 9:
1979
- _context3.prev = 9;
1980
- _context3.t0 = _context3["catch"](0);
1981
- case 11:
1982
- case "end":
1983
- return _context3.stop();
1984
- }
1985
- }, _callee3, null, [[0, 9]]);
1986
- }));
1987
- };
1988
- var onEditDrawing = function onEditDrawing(drawingId) {
1989
- // delete current redux layers
1990
- deleteGeoJSONLayer();
1991
- onCloseDialog();
1992
- openDrawTools(drawingId);
1993
- };
1984
+ // TODO: re-enable for: https://gitlab.com/opengeoweb/opengeoweb/-/issues/4080
1985
+ // const openDrawTools = async (drawingId: string): Promise<void> => {
1986
+ // try {
1987
+ // const { data } = await warningsApi.getDrawingDetails(drawingId);
1988
+ // // update draw tool values
1989
+ // dispatch(
1990
+ // drawActions.setDrawValues({
1991
+ // area: data.area,
1992
+ // areaName: data.name,
1993
+ // mapId,
1994
+ // id: drawingId,
1995
+ // }),
1996
+ // );
1997
+ // // open draw dialog
1998
+ // dispatch(
1999
+ // uiActions.setActiveMapIdForDialog({
2000
+ // type: `${uiTypes.DialogTypes.DockedDrawingTool}-${mapId}`,
2001
+ // mapId,
2002
+ // setOpen: true,
2003
+ // source,
2004
+ // }),
2005
+ // );
2006
+ // } catch (error) {
2007
+ // // TODO: handle error. Might need to move this to redux
2008
+ // }
2009
+ // };
2010
+ // const onEditDrawing = (drawingId: string): void => {
2011
+ // closeAreaDialog();
2012
+ // openDrawTools(drawingId);
2013
+ // };
1994
2014
  var onClose = function onClose() {
1995
- onCloseDialog();
1996
- };
1997
- var onHideAreaManager = function onHideAreaManager() {
1998
- deleteGeoJSONLayer();
2015
+ closeAreaDialog();
1999
2016
  };
2000
2017
  if (!isDialogOpen) {
2001
2018
  return null;
@@ -2016,10 +2033,10 @@ var AreaManagerConnect = function AreaManagerConnect(_ref) {
2016
2033
  },
2017
2034
  drawingListItems: drawings,
2018
2035
  onClickDrawing: onClickDrawing,
2019
- onUnMount: onHideAreaManager,
2020
- onEditDrawing: onEditDrawing,
2036
+ // onEditDrawing={onEditDrawing}
2021
2037
  activeDrawingId: activeDrawingId,
2022
- error: uiError
2038
+ error: uiError,
2039
+ isLoading: loading
2023
2040
  });
2024
2041
  };
2025
2042
 
@@ -3006,9 +3023,6 @@ function delayP(ms, val) {
3006
3023
  }
3007
3024
 
3008
3025
  if (process.env.NODE_ENV !== 'production' && typeof Proxy !== 'undefined') ;
3009
- var identity = function identity(v) {
3010
- return v;
3011
- };
3012
3026
  function check(value, predicate, error) {
3013
3027
  if (!predicate(value)) {
3014
3028
  throw new Error(error);
@@ -3059,7 +3073,6 @@ var PUT = 'PUT';
3059
3073
  var CALL = 'CALL';
3060
3074
  var FORK = 'FORK';
3061
3075
  var CANCEL = 'CANCEL';
3062
- var SELECT = 'SELECT';
3063
3076
 
3064
3077
  var TEST_HINT = '\n(HINT: if you are getting these errors in tests, consider using createMockTask from @redux-saga/testing-utils)';
3065
3078
 
@@ -3243,25 +3256,6 @@ function cancel(taskOrTasks) {
3243
3256
 
3244
3257
  return makeEffect(CANCEL, taskOrTasks);
3245
3258
  }
3246
- function select(selector) {
3247
- if (selector === void 0) {
3248
- selector = identity;
3249
- }
3250
-
3251
- for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
3252
- args[_key5 - 1] = arguments[_key5];
3253
- }
3254
-
3255
- if (process.env.NODE_ENV !== 'production' && arguments.length) {
3256
- check(arguments[0], notUndef, 'select(selector, [...]): argument selector is undefined');
3257
- check(selector, func, "select(selector, [...]): argument " + selector + " is not a function");
3258
- }
3259
-
3260
- return makeEffect(SELECT, {
3261
- selector: selector,
3262
- args: args
3263
- });
3264
- }
3265
3259
  var delay =
3266
3260
  /*#__PURE__*/
3267
3261
  call.bind(null, delayP);
@@ -3402,144 +3396,91 @@ var SUBMIT_ERROR = 'Something went wrong saving a drawing';
3402
3396
  var getSnackbarMessage = function getSnackbarMessage(areaName, id) {
3403
3397
  return "Drawing ".concat(areaName, " has been ").concat(id ? 'updated' : 'saved', "!");
3404
3398
  };
3405
- function onOpenUiDialogSaga(_ref) {
3399
+ function submitDrawValuesSaga(_ref) {
3406
3400
  var payload = _ref.payload;
3407
3401
  return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3408
- var type, mapId, drawUiType, areaManagerUiType, isDrawingOpen, isAreaManagerOpen;
3402
+ var mapId, id, formValues, dialogType, warningsApi, newID;
3409
3403
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3410
3404
  while (1) switch (_context.prev = _context.next) {
3411
- case 0:
3412
- type = payload.type, mapId = payload.mapId;
3413
- drawUiType = "".concat(uiTypes.DialogTypes.DockedDrawingTool, "-").concat(mapId);
3414
- areaManagerUiType = uiTypes.DialogTypes.AreaManager;
3415
- if (!(type === areaManagerUiType)) {
3416
- _context.next = 10;
3417
- break;
3418
- }
3419
- _context.next = 6;
3420
- return select(uiSelectors.getisDialogOpen, drawUiType);
3421
- case 6:
3422
- isDrawingOpen = _context.sent;
3423
- if (!isDrawingOpen) {
3424
- _context.next = 10;
3425
- break;
3426
- }
3427
- _context.next = 10;
3428
- return put(uiActions.setToggleOpenDialog(Object.assign(Object.assign({}, payload), {
3429
- type: drawUiType,
3430
- setOpen: false
3431
- })));
3432
- case 10:
3433
- if (!(type === drawUiType)) {
3434
- _context.next = 17;
3435
- break;
3436
- }
3437
- _context.next = 13;
3438
- return select(uiSelectors.getisDialogOpen, areaManagerUiType);
3439
- case 13:
3440
- isAreaManagerOpen = _context.sent;
3441
- if (!isAreaManagerOpen) {
3442
- _context.next = 17;
3443
- break;
3444
- }
3445
- _context.next = 17;
3446
- return put(uiActions.setToggleOpenDialog(Object.assign(Object.assign({}, payload), {
3447
- type: areaManagerUiType,
3448
- setOpen: false
3449
- })));
3450
- case 17:
3451
- case "end":
3452
- return _context.stop();
3453
- }
3454
- }, _callee);
3455
- })();
3456
- }
3457
- function submitDrawValuesSaga(_ref2) {
3458
- var payload = _ref2.payload;
3459
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
3460
- var mapId, id, formValues, dialogType, warningsApi, newID;
3461
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3462
- while (1) switch (_context2.prev = _context2.next) {
3463
3405
  case 0:
3464
3406
  mapId = payload.mapId, id = payload.id, formValues = __rest(payload, ["mapId", "id"]);
3465
3407
  dialogType = "".concat(uiTypes.DialogTypes.DockedDrawingTool, "-").concat(mapId);
3466
- _context2.prev = 2;
3467
- _context2.next = 5;
3408
+ _context.prev = 2;
3409
+ _context.next = 5;
3468
3410
  return put(uiActions.toggleIsLoadingDialog({
3469
3411
  isLoading: true,
3470
3412
  type: dialogType
3471
3413
  }));
3472
3414
  case 5:
3473
- _context2.next = 7;
3415
+ _context.next = 7;
3474
3416
  return call(getWarningsApi);
3475
3417
  case 7:
3476
- warningsApi = _context2.sent;
3418
+ warningsApi = _context.sent;
3477
3419
  if (id) {
3478
- _context2.next = 16;
3420
+ _context.next = 16;
3479
3421
  break;
3480
3422
  }
3481
- _context2.next = 11;
3423
+ _context.next = 11;
3482
3424
  return call(warningsApi.saveDrawingAs, formValues);
3483
3425
  case 11:
3484
- newID = _context2.sent;
3485
- _context2.next = 14;
3486
- return put(drawActions.setDrawValues(Object.assign({
3426
+ newID = _context.sent;
3427
+ _context.next = 14;
3428
+ return put(drawActions.setDrawValues({
3487
3429
  mapId: mapId,
3488
- id: newID
3489
- }, formValues)));
3430
+ id: newID,
3431
+ areaName: formValues.name,
3432
+ area: formValues.area
3433
+ }));
3490
3434
  case 14:
3491
- _context2.next = 18;
3435
+ _context.next = 18;
3492
3436
  break;
3493
3437
  case 16:
3494
- _context2.next = 18;
3438
+ _context.next = 18;
3495
3439
  return call(warningsApi.updateDrawing, id, formValues);
3496
3440
  case 18:
3497
- _context2.next = 20;
3441
+ _context.next = 20;
3498
3442
  return put(snackbarActions.openSnackbar({
3499
- message: getSnackbarMessage(formValues.areaName, id)
3443
+ message: getSnackbarMessage(formValues.name, id)
3500
3444
  }));
3501
3445
  case 20:
3502
- _context2.next = 22;
3446
+ _context.next = 22;
3503
3447
  return put(uiActions.toggleIsLoadingDialog({
3504
3448
  isLoading: false,
3505
3449
  type: dialogType
3506
3450
  }));
3507
3451
  case 22:
3508
- _context2.next = 30;
3452
+ _context.next = 30;
3509
3453
  break;
3510
3454
  case 24:
3511
- _context2.prev = 24;
3512
- _context2.t0 = _context2["catch"](2);
3513
- _context2.next = 28;
3455
+ _context.prev = 24;
3456
+ _context.t0 = _context["catch"](2);
3457
+ _context.next = 28;
3514
3458
  return put(uiActions.toggleIsLoadingDialog({
3515
3459
  isLoading: false,
3516
3460
  type: dialogType
3517
3461
  }));
3518
3462
  case 28:
3519
- _context2.next = 30;
3463
+ _context.next = 30;
3520
3464
  return put(uiActions.setErrorDialog({
3521
3465
  type: dialogType,
3522
3466
  error: SUBMIT_ERROR
3523
3467
  }));
3524
3468
  case 30:
3525
3469
  case "end":
3526
- return _context2.stop();
3470
+ return _context.stop();
3527
3471
  }
3528
- }, _callee2, null, [[2, 24]]);
3472
+ }, _callee, null, [[2, 24]]);
3529
3473
  })();
3530
3474
  }
3531
3475
  function drawingSaga() {
3532
- return _regeneratorRuntime().wrap(function drawingSaga$(_context3) {
3533
- while (1) switch (_context3.prev = _context3.next) {
3476
+ return _regeneratorRuntime().wrap(function drawingSaga$(_context2) {
3477
+ while (1) switch (_context2.prev = _context2.next) {
3534
3478
  case 0:
3535
- _context3.next = 2;
3536
- return takeLatest$1(uiActions.setActiveMapIdForDialog, onOpenUiDialogSaga);
3537
- case 2:
3538
- _context3.next = 4;
3479
+ _context2.next = 2;
3539
3480
  return takeLatest$1(drawActions.submitDrawValues, submitDrawValuesSaga);
3540
- case 4:
3481
+ case 2:
3541
3482
  case "end":
3542
- return _context3.stop();
3483
+ return _context2.stop();
3543
3484
  }
3544
3485
  }, _marked);
3545
3486
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/warnings",
3
- "version": "6.1.0",
3
+ "version": "7.0.0",
4
4
  "description": "GeoWeb warinings library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -9,13 +9,14 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "@mui/material": "5.12.0",
12
- "@opengeoweb/api": "6.1.0",
13
- "@opengeoweb/core": "6.1.0",
14
- "@opengeoweb/shared": "6.1.0",
15
- "@opengeoweb/store": "6.1.0",
16
- "@opengeoweb/theme": "6.1.0",
12
+ "@opengeoweb/api": "7.0.0",
13
+ "@opengeoweb/core": "7.0.0",
14
+ "@opengeoweb/shared": "7.0.0",
15
+ "@opengeoweb/store": "7.0.0",
16
+ "@opengeoweb/theme": "7.0.0",
17
+ "@opengeoweb/webmap-react": "7.0.0",
17
18
  "@reduxjs/toolkit": "1.9.5",
18
- "axios": "1.4.0",
19
+ "axios": "1.5.0",
19
20
  "react": "18.2.0",
20
21
  "react-redux": "8.1.2",
21
22
  "redux-saga": "1.2.3"
@@ -26,8 +26,7 @@ export declare const AreaManager: React.FC<{
26
26
  headerSize?: HeaderSize;
27
27
  drawingListItems: DrawingListItem[];
28
28
  onClickDrawing?: (drawing: DrawingListItem) => void;
29
- onUnMount?: () => void;
30
- onEditDrawing?: (drawingId: string) => void;
31
29
  activeDrawingId?: string;
32
30
  error?: string;
31
+ isLoading?: boolean;
33
32
  }>;
@@ -23,3 +23,11 @@ export declare const AreaManagerDark: {
23
23
  };
24
24
  storyName: string;
25
25
  };
26
+ export declare const AreaManagerLightNoResults: {
27
+ (): React.ReactElement;
28
+ storyName: string;
29
+ };
30
+ export declare const AreaManagerDarkNoResults: {
31
+ (): React.ReactElement;
32
+ storyName: string;
33
+ };
@@ -1,8 +1,8 @@
1
1
  import { FC } from 'react';
2
2
  import { DrawingListItem } from '../../store/drawings/types';
3
+ export declare const NO_AREAS_FOUND = "No areas found";
3
4
  export declare const Drawings: FC<{
4
5
  drawings: DrawingListItem[];
5
6
  onClickDrawing: (drawing: DrawingListItem) => void;
6
- onClickEdit: (drawingId: string) => void;
7
7
  activeDrawing: string;
8
8
  }>;
@@ -1,9 +1,6 @@
1
1
  import { SagaIterator } from 'redux-saga';
2
2
  export declare const SUBMIT_ERROR = "Something went wrong saving a drawing";
3
3
  export declare const getSnackbarMessage: (areaName: string, id: string) => string;
4
- export declare function onOpenUiDialogSaga({ payload }: {
5
- payload: any;
6
- }): SagaIterator;
7
4
  export declare function submitDrawValuesSaga({ payload }: {
8
5
  payload: any;
9
6
  }): SagaIterator;
@@ -1,9 +1,9 @@
1
- export type DrawingScope = 'user';
1
+ import { drawTypes } from '@opengeoweb/store';
2
2
  export interface DrawingListItem {
3
3
  id: string;
4
4
  name: string;
5
5
  lastUpdatedTime: string;
6
- scope: DrawingScope;
6
+ scope: drawTypes.DrawingScope;
7
7
  area: GeoJSON.FeatureCollection;
8
8
  }
9
9
  export interface DrawingFromBE extends DrawingListItem {
@@ -2,6 +2,7 @@ import { CreateApiProps } from '@opengeoweb/api';
2
2
  import { AxiosInstance } from 'axios';
3
3
  import { DrawingDetails, DrawingFromBE, DrawingListItem } from '../store/drawings/types';
4
4
  export declare const API_NAME = "warnings";
5
+ export declare const getIdFromUrl: (url: string) => string;
5
6
  export type WarningsApi = {
6
7
  getDrawings: () => Promise<{
7
8
  data: DrawingListItem[];