@opengeoweb/sigmet-airmet 14.0.1 → 14.2.1

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,22 +1,23 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { createApiInstance, useApiContext, useApi, ApiProvider, createFakeApiInstance } from '@opengeoweb/api';
3
- import { PROJECTION, useIsMounted, dateUtils, CustomTooltip, usePrevious, ConfirmationServiceProvider, usePreventBrowserClose, useConfirmationDialog, CustomDialog, AlertBanner, isAxiosError, getAxiosErrorMessage, StatusTag, usePoller, ErrorBoundary } from '@opengeoweb/shared';
2
+ import { sessionStorageProvider, PROJECTION, useIsMounted, dateUtils, usePreventBrowserClose, CustomTooltip, usePrevious, ConfirmationServiceProvider, useConfirmationDialog, CustomDialog, AlertBanner, StatusTag, usePoller, ErrorBoundary } from '@opengeoweb/shared';
4
3
  import { Box as Box$1 } from '@mui/system';
5
4
  import * as React from 'react';
6
- import React__default, { useState, useRef, useEffect, useCallback } from 'react';
7
- import { FormControlLabel, Radio, Grid, Typography, Box, Checkbox, MenuItem, FormHelperText, TextField, useTheme, Backdrop, CircularProgress, Card, Button, LinearProgress, List, ListItemButton } from '@mui/material';
8
- import { useFormContext, Controller } from 'react-hook-form';
9
- import { FORM_FIELDS_NAMESPACE, useDraftFormHelpers, ReactHookFormRadioGroup, hasValidGeometry, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMin, isValidMax, isEmpty, ReactHookFormDateTime, countIntersectionPoints, hasMulitpleIntersections, ReactHookFormHiddenInput, hasIntersectionWithFIR, isValidGeoJsonCoordinates, isMaximumOneDrawing, isXHoursBefore, isXHoursAfter, ReactHookFormTextField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
5
+ import React__default, { useRef, useEffect, useCallback } from 'react';
6
+ import { FormControlLabel, Radio, Grid, Typography, Box, Checkbox, MenuItem, FormHelperText, useTheme, Backdrop, CircularProgress, Card, Button, LinearProgress, List, ListItemButton } from '@mui/material';
7
+ import { useFormContext } from 'react-hook-form';
8
+ import { FORM_FIELDS_NAMESPACE, useDraftFormHelpers, ReactHookFormRadioGroup, hasValidGeometry, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMin, isValidMax, isEmpty, ReactHookFormDateTime, countIntersectionPoints, hasMulitpleIntersections, ReactHookFormHiddenInput, hasIntersectionWithFIR, isValidGeoJsonCoordinates, isMaximumOneDrawing, isXHoursBefore, isXHoursAfter, ReactHookFormTextField, DegreesMinutesField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
9
+ import { useSelector, useDispatch, shallowEqual } from 'react-redux';
10
+ import { uiSelectors, useUpdateSharedData, mapSelectors, syncGroupsActions, layerActions, mapActions, defaultLayers, syncConstants, uiActions, uiTypes, genericSelectors, drawingToolActions } from '@opengeoweb/store';
10
11
  import { defaultIntersectionStyleProperties, defaultGeoJSONStyleProperties, addSelectionTypeToGeoJSON, DRAWMODE, defaultPoint, addGeoJSONProperties, defaultBox, defaultPolygon, defaultDelete, getIcon, addFeatureProperties, OpenLayersFeatureLayer, genericOpenLayersFeatureStyle, OpenLayersMapDraw, useMapDrawTool, rewindGeometry } from '@opengeoweb/webmap-react';
12
+ import { getHeaders, handleResponse, useAuthQuery, useAuthenticationContext } from '@opengeoweb/api';
13
+ import { useQueryClient, useMutation } from '@tanstack/react-query';
11
14
  import i18n from 'i18next';
12
15
  import { useTranslation } from 'react-i18next';
13
16
  import { LegendConnect, OlMapViewConnect, TimeSliderConnect } from '@opengeoweb/core';
14
- import { uiSelectors, useUpdateSharedData, mapSelectors, syncGroupsActions, layerActions, mapActions, defaultLayers, syncConstants, uiActions, uiTypes, genericSelectors, drawingToolActions } from '@opengeoweb/store';
15
17
  import { DrawFIRLand, Edit, Success, Clock } from '@opengeoweb/theme';
16
18
  import { LayerType, webmapUtils } from '@opengeoweb/webmap';
17
- import { useSelector, useDispatch, shallowEqual } from 'react-redux';
18
19
  import { debounce } from 'lodash';
19
- import { useAuthenticationContext } from '@opengeoweb/authentication';
20
+ import { useAuthenticationContext as useAuthenticationContext$1 } from '@opengeoweb/authentication';
20
21
 
21
22
  var en = {
22
23
  "sigmet-airmet": "sigmet",
@@ -529,56 +530,6 @@ var sigmetAirmetTranslations = {
529
530
  nl: nl
530
531
  };
531
532
 
532
- /* *
533
- * Licensed under the Apache License, Version 2.0 (the "License");
534
- * you may not use this file except in compliance with the License.
535
- * You may obtain a copy of the License at
536
- *
537
- * http://www.apache.org/licenses/LICENSE-2.0
538
- *
539
- * Unless required by applicable law or agreed to in writing, software
540
- * distributed under the License is distributed on an "AS IS" BASIS,
541
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
542
- * See the License for the specific language governing permissions and
543
- * limitations under the License.
544
- *
545
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
546
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
547
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
548
- * */
549
- var getApiRoutes$1 = function getApiRoutes(axiosInstance) {
550
- return {
551
- getSigmetConfiguration: function getSigmetConfiguration() {
552
- return axiosInstance.get('/sigmet-config');
553
- },
554
- getSigmetList: function getSigmetList() {
555
- return axiosInstance.get('/sigmetlist');
556
- },
557
- postSigmet: function postSigmet(formData) {
558
- return axiosInstance.post('/sigmet', Object.assign({}, formData));
559
- },
560
- getSigmetTAC: function getSigmetTAC(sigmetData) {
561
- return axiosInstance.post('/sigmet2tac', Object.assign({}, sigmetData));
562
- },
563
- getAirmetConfiguration: function getAirmetConfiguration() {
564
- return axiosInstance.get('/airmet-config');
565
- },
566
- getAirmetList: function getAirmetList() {
567
- return axiosInstance.get('/airmetlist');
568
- },
569
- postAirmet: function postAirmet(formData) {
570
- return axiosInstance.post('/airmet', Object.assign({}, formData));
571
- },
572
- getAirmetTAC: function getAirmetTAC(sigmetData) {
573
- return axiosInstance.post('/airmet2tac', Object.assign({}, sigmetData));
574
- }
575
- };
576
- };
577
- var createApi$1 = function createApi(props) {
578
- var axiosInstance = createApiInstance(props);
579
- return getApiRoutes$1(axiosInstance);
580
- };
581
-
582
533
  /**
583
534
  * The possible type for the airmet
584
535
  */
@@ -990,6 +941,281 @@ function _regeneratorRuntime() {
990
941
  })();
991
942
  }
992
943
 
944
+ /* *
945
+ * Licensed under the Apache License, Version 2.0 (the "License");
946
+ * you may not use this file except in compliance with the License.
947
+ * You may obtain a copy of the License at
948
+ *
949
+ * http://www.apache.org/licenses/LICENSE-2.0
950
+ *
951
+ * Unless required by applicable law or agreed to in writing, software
952
+ * distributed under the License is distributed on an "AS IS" BASIS,
953
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
954
+ * See the License for the specific language governing permissions and
955
+ * limitations under the License.
956
+ *
957
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
958
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
959
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
960
+ * */
961
+ var SA_NAMESPACE = 'sigmetairmet';
962
+ var ns = [SA_NAMESPACE, FORM_FIELDS_NAMESPACE];
963
+ var useSigmetAirmetTranslation = function useSigmetAirmetTranslation() {
964
+ return useTranslation(ns);
965
+ };
966
+
967
+ var config = sessionStorageProvider.getConfig();
968
+ var airmetBaseUrl = config.GW_AIRMET_BASE_URL || '';
969
+ var sigmetBaseUrl = config.GW_SIGMET_BASE_URL || '';
970
+ var safeFetch = /*#__PURE__*/function () {
971
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, options, timeoutMs) {
972
+ var controller, timeout, response, newError;
973
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
974
+ while (1) switch (_context.prev = _context.next) {
975
+ case 0:
976
+ if (timeoutMs === void 0) {
977
+ timeoutMs = 5000;
978
+ }
979
+ controller = new AbortController();
980
+ timeout = setTimeout(function () {
981
+ return controller.abort();
982
+ }, timeoutMs);
983
+ _context.prev = 3;
984
+ _context.next = 6;
985
+ return fetch(url, Object.assign({}, options, {
986
+ signal: controller.signal
987
+ }));
988
+ case 6:
989
+ response = _context.sent;
990
+ _context.next = 9;
991
+ return handleResponse(response);
992
+ case 9:
993
+ return _context.abrupt("return", _context.sent);
994
+ case 12:
995
+ _context.prev = 12;
996
+ _context.t0 = _context["catch"](3);
997
+ newError = Object.assign({}, _context.t0, {
998
+ name: i18n.t('error-backend')
999
+ });
1000
+ throw newError;
1001
+ case 16:
1002
+ _context.prev = 16;
1003
+ clearTimeout(timeout);
1004
+ return _context.finish(16);
1005
+ case 19:
1006
+ case "end":
1007
+ return _context.stop();
1008
+ }
1009
+ }, _callee, null, [[3, 12, 16, 19]]);
1010
+ }));
1011
+ return function safeFetch(_x, _x2, _x3) {
1012
+ return _ref.apply(this, arguments);
1013
+ };
1014
+ }();
1015
+ // API
1016
+ var getAirmetList = function getAirmetList(auth) {
1017
+ return safeFetch(airmetBaseUrl + "/airmetlist", {
1018
+ headers: getHeaders(auth)
1019
+ });
1020
+ };
1021
+ var getSigmetList = function getSigmetList(auth) {
1022
+ return safeFetch(sigmetBaseUrl + "/sigmetlist", {
1023
+ headers: getHeaders(auth)
1024
+ });
1025
+ };
1026
+ var getAirmetConfig = function getAirmetConfig(auth) {
1027
+ return fetch(airmetBaseUrl + "/airmet-config", {
1028
+ headers: getHeaders(auth)
1029
+ }).then(function (result) {
1030
+ return result.json();
1031
+ });
1032
+ };
1033
+ var getSigmetConfig = function getSigmetConfig(auth) {
1034
+ return fetch(sigmetBaseUrl + "/sigmet-config", {
1035
+ headers: getHeaders(auth)
1036
+ }).then(function (result) {
1037
+ return result.json();
1038
+ });
1039
+ };
1040
+ var postTAC = /*#__PURE__*/function () {
1041
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url, auth, product) {
1042
+ var result, textData;
1043
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1044
+ while (1) switch (_context2.prev = _context2.next) {
1045
+ case 0:
1046
+ _context2.next = 2;
1047
+ return fetch(url, {
1048
+ method: 'POST',
1049
+ body: JSON.stringify(product),
1050
+ headers: getHeaders(auth)
1051
+ });
1052
+ case 2:
1053
+ result = _context2.sent;
1054
+ if (result.ok) {
1055
+ _context2.next = 5;
1056
+ break;
1057
+ }
1058
+ throw new Error("Failed to fetch TAC data: " + result.statusText);
1059
+ case 5:
1060
+ _context2.next = 7;
1061
+ return result.text();
1062
+ case 7:
1063
+ textData = _context2.sent;
1064
+ return _context2.abrupt("return", {
1065
+ data: textData
1066
+ });
1067
+ case 9:
1068
+ case "end":
1069
+ return _context2.stop();
1070
+ }
1071
+ }, _callee2);
1072
+ }));
1073
+ return function postTAC(_x4, _x5, _x6) {
1074
+ return _ref2.apply(this, arguments);
1075
+ };
1076
+ }();
1077
+ var getSigmetTAC = function getSigmetTAC(auth, product) {
1078
+ return postTAC(sigmetBaseUrl + "/sigmet2tac", auth, product);
1079
+ };
1080
+ var getAirmetTAC = function getAirmetTAC(auth, product) {
1081
+ return postTAC(airmetBaseUrl + "/airmet2tac", auth, product);
1082
+ };
1083
+ var postSigmet = function postSigmet(auth, data) {
1084
+ return fetch(sigmetBaseUrl + "/sigmet", {
1085
+ headers: getHeaders(auth),
1086
+ method: 'POST',
1087
+ body: JSON.stringify(data)
1088
+ }).then(handleResponse);
1089
+ };
1090
+ var postAirmet = function postAirmet(auth, data) {
1091
+ return fetch(airmetBaseUrl + "/airmet", {
1092
+ headers: getHeaders(auth),
1093
+ method: 'POST',
1094
+ body: JSON.stringify(data)
1095
+ }).then(handleResponse);
1096
+ };
1097
+
1098
+ var useAirmetList = function useAirmetList(disabled) {
1099
+ if (disabled === void 0) {
1100
+ disabled = false;
1101
+ }
1102
+ return useAuthQuery(['airmet-list'], getAirmetList, disabled, false);
1103
+ };
1104
+ var useSigmetList = function useSigmetList(disabled) {
1105
+ if (disabled === void 0) {
1106
+ disabled = false;
1107
+ }
1108
+ return useAuthQuery(['sigmet-list'], getSigmetList, disabled, false);
1109
+ };
1110
+ var useProductConfig = function useProductConfig(productType) {
1111
+ var airmetQuery = useAuthQuery(['airmet-config'], getAirmetConfig, productType !== 'airmet');
1112
+ var sigmetQuery = useAuthQuery(['sigmet-config'], getSigmetConfig, productType !== 'sigmet');
1113
+ return productType === 'airmet' ? airmetQuery : sigmetQuery;
1114
+ };
1115
+ var useTACApi = function useTACApi() {
1116
+ var _useAuthenticationCon = useAuthenticationContext(),
1117
+ auth = _useAuthenticationCon.auth;
1118
+ var queryClient = useQueryClient();
1119
+ var fetchSigmetTAC = function fetchSigmetTAC(product) {
1120
+ return queryClient.fetchQuery({
1121
+ queryKey: ['sigmet-tac', product],
1122
+ queryFn: function queryFn() {
1123
+ return getSigmetTAC(auth, product);
1124
+ },
1125
+ staleTime: 1000 * 15
1126
+ });
1127
+ };
1128
+ var fetchAirmetTAC = function fetchAirmetTAC(product) {
1129
+ return queryClient.fetchQuery({
1130
+ queryKey: ['airmet-tac', product],
1131
+ queryFn: function queryFn() {
1132
+ return getAirmetTAC(auth, product);
1133
+ },
1134
+ staleTime: 1000 * 15
1135
+ });
1136
+ };
1137
+ return {
1138
+ fetchSigmetTAC: fetchSigmetTAC,
1139
+ fetchAirmetTAC: fetchAirmetTAC
1140
+ };
1141
+ };
1142
+ var usePostSigmet = function usePostSigmet() {
1143
+ var _useAuthenticationCon2 = useAuthenticationContext(),
1144
+ auth = _useAuthenticationCon2.auth;
1145
+ var queryClient = useQueryClient();
1146
+ return useMutation({
1147
+ mutationFn: function mutationFn(formData) {
1148
+ if (!auth) {
1149
+ throw new Error('Authentication context not found');
1150
+ }
1151
+ return postSigmet(auth, formData);
1152
+ },
1153
+ onError: function onError() {
1154
+ void queryClient.invalidateQueries({
1155
+ queryKey: ['sigmet']
1156
+ });
1157
+ },
1158
+ onSuccess: function () {
1159
+ var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1160
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1161
+ while (1) switch (_context.prev = _context.next) {
1162
+ case 0:
1163
+ _context.next = 2;
1164
+ return queryClient.invalidateQueries({
1165
+ queryKey: ['sigmet-list']
1166
+ });
1167
+ case 2:
1168
+ case "end":
1169
+ return _context.stop();
1170
+ }
1171
+ }, _callee);
1172
+ }));
1173
+ function onSuccess() {
1174
+ return _onSuccess.apply(this, arguments);
1175
+ }
1176
+ return onSuccess;
1177
+ }()
1178
+ });
1179
+ };
1180
+ var usePostAirmet = function usePostAirmet() {
1181
+ var _useAuthenticationCon3 = useAuthenticationContext(),
1182
+ auth = _useAuthenticationCon3.auth;
1183
+ var queryClient = useQueryClient();
1184
+ return useMutation({
1185
+ mutationFn: function mutationFn(formData) {
1186
+ if (!auth) {
1187
+ throw new Error('Authentication context not found');
1188
+ }
1189
+ return postAirmet(auth, formData);
1190
+ },
1191
+ onError: function onError() {
1192
+ void queryClient.invalidateQueries({
1193
+ queryKey: ['airmet']
1194
+ });
1195
+ },
1196
+ onSuccess: function () {
1197
+ var _onSuccess2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
1198
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1199
+ while (1) switch (_context2.prev = _context2.next) {
1200
+ case 0:
1201
+ _context2.next = 2;
1202
+ return queryClient.invalidateQueries({
1203
+ queryKey: ['airmet-list']
1204
+ });
1205
+ case 2:
1206
+ case "end":
1207
+ return _context2.stop();
1208
+ }
1209
+ }, _callee2);
1210
+ }));
1211
+ function onSuccess() {
1212
+ return _onSuccess2.apply(this, arguments);
1213
+ }
1214
+ return onSuccess;
1215
+ }()
1216
+ });
1217
+ };
1218
+
993
1219
  /* *
994
1220
  * Licensed under the Apache License, Version 2.0 (the "License");
995
1221
  * you may not use this file except in compliance with the License.
@@ -4392,37 +4618,6 @@ var airmetDefaultConfig = {
4392
4618
  var sigmetConfig = sigmetDefaultConfig;
4393
4619
  var airmetConfig = airmetDefaultConfig;
4394
4620
 
4395
- /* *
4396
- * Licensed under the Apache License, Version 2.0 (the "License");
4397
- * you may not use this file except in compliance with the License.
4398
- * You may obtain a copy of the License at
4399
- *
4400
- * http://www.apache.org/licenses/LICENSE-2.0
4401
- *
4402
- * Unless required by applicable law or agreed to in writing, software
4403
- * distributed under the License is distributed on an "AS IS" BASIS,
4404
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4405
- * See the License for the specific language governing permissions and
4406
- * limitations under the License.
4407
- *
4408
- * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4409
- * Copyright 2024 - Finnish Meteorological Institute (FMI)
4410
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
4411
- * */
4412
- var SA_NAMESPACE = 'sigmetairmet';
4413
- var ns = [SA_NAMESPACE, FORM_FIELDS_NAMESPACE];
4414
- var translateKeyOutsideComponents = function translateKeyOutsideComponents(key, params) {
4415
- if (params === void 0) {
4416
- params = undefined;
4417
- }
4418
- return i18n.t(key, Object.assign({
4419
- ns: ns
4420
- }, params));
4421
- };
4422
- var useSigmetAirmetTranslation = function useSigmetAirmetTranslation() {
4423
- return useTranslation(ns);
4424
- };
4425
-
4426
4621
  /* *
4427
4622
  * Licensed under the Apache License, Version 2.0 (the "License");
4428
4623
  * you may not use this file except in compliance with the License.
@@ -5321,35 +5516,6 @@ var useFormLayers = function useFormLayers(layers) {
5321
5516
  formFeatures: formLayers
5322
5517
  }, sourcePanelId);
5323
5518
  };
5324
- function degreesMinutesToDecimal(input) {
5325
- var raw = input.toString().trim();
5326
- var negative = raw.startsWith('-');
5327
- var digits = raw.replace(/[^0-9]/g, '');
5328
- var sign = negative ? -1 : 1;
5329
- if (digits.length <= 2) {
5330
- var _deg = parseInt(digits || '0', 10);
5331
- return sign * _deg;
5332
- }
5333
- // split into degrees + minutes
5334
- var deg = parseInt(digits.slice(0, digits.length - 2), 10);
5335
- var min = parseInt(digits.slice(-2), 10);
5336
- // normalize minutes overflow (e.g. 65 → 1°05′)
5337
- var extraDeg = Math.floor(min / 60);
5338
- min %= 60;
5339
- return sign * (deg + extraDeg + min / 60);
5340
- }
5341
- function decimalToDegreesMinutes(value) {
5342
- var sign = value < 0 ? '-' : '';
5343
- var abs = Math.abs(value);
5344
- var degrees = Math.floor(abs);
5345
- var minutes = Math.round((abs - degrees) * 60);
5346
- // normalize rounding overflow (e.g. 59.9 min → +1 degree)
5347
- if (minutes === 60) {
5348
- abs += 1;
5349
- return decimalToDegreesMinutes(sign === '-' ? -abs : abs);
5350
- }
5351
- return "" + sign + degrees + "\xB0" + minutes.toString().padStart(2, '0') + "\u2032";
5352
- }
5353
5519
  var getSequenceStyling = function getSequenceStyling(product, hasTac) {
5354
5520
  if (hasTac === void 0) {
5355
5521
  hasTac = false;
@@ -5390,6 +5556,7 @@ var DrawTools = function DrawTools(_ref) {
5390
5556
  onChangeTool = _ref.onChangeTool,
5391
5557
  _ref$isDisabled = _ref.isDisabled,
5392
5558
  isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
5559
+ usePreventBrowserClose(activeTool !== '');
5393
5560
  return jsx(Box, {
5394
5561
  "data-testid": "drawtools",
5395
5562
  sx: {
@@ -6777,12 +6944,12 @@ var ValidFrom = function ValidFrom(_ref) {
6777
6944
  var productConfig = _ref.productConfig,
6778
6945
  isDisabled = _ref.isDisabled,
6779
6946
  isReadOnly = _ref.isReadOnly,
6780
- _ref$isAmending = _ref.isAmending,
6781
- isAmending = _ref$isAmending === void 0 ? false : _ref$isAmending,
6782
6947
  _ref$onChange = _ref.onChange,
6783
6948
  _onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
6784
6949
  _ref$onUserChange = _ref.onUserChange,
6785
- onUserChange = _ref$onUserChange === void 0 ? function () {} : _ref$onUserChange;
6950
+ onUserChange = _ref$onUserChange === void 0 ? function () {} : _ref$onUserChange,
6951
+ _ref$lockBecauseActiv = _ref.lockBecauseActive,
6952
+ lockBecauseActive = _ref$lockBecauseActiv === void 0 ? false : _ref$lockBecauseActiv;
6786
6953
  var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
6787
6954
  t = _useSigmetAirmetTrans.t;
6788
6955
  var _useFormContext = useFormContext(),
@@ -6792,13 +6959,13 @@ var ValidFrom = function ValidFrom(_ref) {
6792
6959
  var _useDraftFormHelpers = useDraftFormHelpers(),
6793
6960
  isRequired = _useDraftFormHelpers.isRequired;
6794
6961
  var label = getFieldLabel(t, t('date-and-time'), isReadOnly);
6795
- // Update input field to now if amending exceeds the current minute
6962
+ // Only auto-sync to now when amending an already-active SIGMET
6796
6963
  React__default.useEffect(function () {
6797
- if (!isAmending) {
6798
- return undefined;
6964
+ if (!lockBecauseActive) {
6965
+ return;
6799
6966
  }
6800
6967
  var updateNow = function updateNow() {
6801
- setValue('validDateStart', dateUtils.getCurrentTimeAsString(), {
6968
+ return setValue('validDateStart', dateUtils.getCurrentTimeAsString(), {
6802
6969
  shouldValidate: true
6803
6970
  });
6804
6971
  };
@@ -6809,13 +6976,28 @@ var ValidFrom = function ValidFrom(_ref) {
6809
6976
  updateNow();
6810
6977
  intervalId = setInterval(updateNow, 60000);
6811
6978
  }, msUntilNextMinute);
6979
+ // eslint-disable-next-line consistent-return
6812
6980
  return function () {
6813
6981
  clearTimeout(timeoutId);
6814
6982
  if (intervalId) {
6815
6983
  clearInterval(intervalId);
6816
6984
  }
6817
6985
  };
6818
- }, [isAmending, setValue]);
6986
+ }, [lockBecauseActive, setValue]);
6987
+ var nowIso = dateUtils.getCurrentTimeAsString();
6988
+ var rules = lockBecauseActive ? {} : {
6989
+ validate: {
6990
+ isRequired: isRequired,
6991
+ isValidDate: dateUtils.isValidIsoDateString,
6992
+ isValueBeforeCurrentTime: function isValueBeforeCurrentTime(value) {
6993
+ return isXHoursBefore(value, nowIso, 0) || t('valid-from-before-current-error');
6994
+ },
6995
+ isCurrentTimeXHoursBeforeValue: function isCurrentTimeXHoursBeforeValue(value) {
6996
+ var hours = getHoursBeforeValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig);
6997
+ return isXHoursBefore(nowIso, value, hours) || getValidFromXHoursBeforeMessage(t, hours);
6998
+ }
6999
+ }
7000
+ };
6819
7001
  return jsx(ProductFormFieldLayout, {
6820
7002
  title: t('valid-from'),
6821
7003
  children: jsx(ReactHookFormDateTime, {
@@ -6823,28 +7005,13 @@ var ValidFrom = function ValidFrom(_ref) {
6823
7005
  name: "validDateStart",
6824
7006
  label: label,
6825
7007
  defaultNullValue: getDefaultValidFromValue(productConfig),
6826
- rules: isAmending ? {} // skip validation, auto-controlled
6827
- : {
6828
- validate: {
6829
- isRequired: isRequired,
6830
- isValidDate: dateUtils.isValidIsoDateString,
6831
- // The validity start cannot be before the current time
6832
- isValueBeforeCurrentTime: function isValueBeforeCurrentTime(value) {
6833
- return isXHoursBefore(value, dateUtils.getCurrentTimeAsString(), 0) || t('valid-from-before-current-error');
6834
- },
6835
- // The current time can be no more than 4 hours before the validity start (12 for VA/TC SIGMET)
6836
- isCurrentTimeXHoursBeforeValue: function isCurrentTimeXHoursBeforeValue(value) {
6837
- var isValid = isXHoursBefore(dateUtils.getCurrentTimeAsString(), value, getHoursBeforeValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig));
6838
- return isValid || getValidFromXHoursBeforeMessage(t, getHoursBeforeValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig));
6839
- }
6840
- }
6841
- },
7008
+ rules: rules,
6842
7009
  onChange: function onChange() {
6843
7010
  onUserChange == null || onUserChange();
6844
7011
  triggerValidations(['validDateEnd', 'observationOrForecastTime'], getValues, trigger);
6845
7012
  _onChange();
6846
7013
  },
6847
- disabled: isDisabled || isAmending,
7014
+ disabled: isDisabled || lockBecauseActive,
6848
7015
  isReadOnly: isReadOnly,
6849
7016
  "data-testid": "valid-from",
6850
7017
  sx: Object.assign({}, styles$2.helperText, {
@@ -6944,103 +7111,6 @@ var ValidUntil = function ValidUntil(_ref) {
6944
7111
  });
6945
7112
  };
6946
7113
 
6947
- var DegreesMinutesField = function DegreesMinutesField(_ref) {
6948
- var name = _ref.name,
6949
- label = _ref.label,
6950
- _ref$disabled = _ref.disabled,
6951
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
6952
- _ref$isReadOnly = _ref.isReadOnly,
6953
- isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
6954
- _ref$size = _ref.size,
6955
- size = _ref$size === void 0 ? 'small' : _ref$size,
6956
- _ref$isLongitude = _ref.isLongitude,
6957
- isLongitude = _ref$isLongitude === void 0 ? false : _ref$isLongitude;
6958
- var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
6959
- t = _useSigmetAirmetTrans.t;
6960
- var _useFormContext = useFormContext(),
6961
- control = _useFormContext.control;
6962
- var _useState = useState(null),
6963
- localInput = _useState[0],
6964
- setLocalInput = _useState[1];
6965
- var _useState2 = useState(false),
6966
- isEditing = _useState2[0],
6967
- setIsEditing = _useState2[1];
6968
- return jsx(Controller, {
6969
- name: name,
6970
- control: control,
6971
- rules: {
6972
- validate: function validate(value) {
6973
- if (value == null || isNaN(value)) {
6974
- return true;
6975
- } // let empty pass
6976
- if (!isLongitude && (value < -90 || value > 90)) {
6977
- return t('form-fields-error-latitude-minutes');
6978
- }
6979
- if (isLongitude && (value < -180 || value > 180)) {
6980
- return t('form-fields-error-longitude-minutes');
6981
- }
6982
- return true;
6983
- }
6984
- },
6985
- render: function render(_ref2) {
6986
- var _fieldState$error;
6987
- var field = _ref2.field,
6988
- fieldState = _ref2.fieldState;
6989
- var value = field.value,
6990
- onChange = field.onChange;
6991
- var handleChange = function handleChange(e) {
6992
- setLocalInput(e.target.value);
6993
- setIsEditing(true);
6994
- };
6995
- var handleBlur = function handleBlur() {
6996
- if (localInput != null && localInput !== '-' && localInput !== '') {
6997
- var input = localInput.replace(/[^\d-]/g, '');
6998
- var negative = input.startsWith('-');
6999
- var digits = input.replace(/[^0-9]/g, '');
7000
- // Latitude: 4 digits (DDMM), Longitude: 5 (DDDMM)
7001
- var maxLen = isLongitude ? 5 : 4;
7002
- if (digits.length > maxLen) {
7003
- digits = digits.slice(0, maxLen);
7004
- }
7005
- var normalized = negative ? "-" + digits : digits;
7006
- try {
7007
- var decimal = degreesMinutesToDecimal(normalized);
7008
- onChange(decimal);
7009
- } catch (_unused) {
7010
- // Invalid, do not update form value
7011
- }
7012
- }
7013
- setIsEditing(false);
7014
- setLocalInput(null);
7015
- };
7016
- var displayValue;
7017
- if (isEditing) {
7018
- displayValue = localInput != null ? localInput : '';
7019
- } else if (value != null) {
7020
- displayValue = decimalToDegreesMinutes(value);
7021
- } else {
7022
- displayValue = '';
7023
- }
7024
- return jsx(TextField, {
7025
- placeholder: isLongitude ? 'DDD°MM′' : 'DD°MM′',
7026
- label: label,
7027
- value: displayValue,
7028
- onChange: handleChange,
7029
- onBlur: handleBlur,
7030
- disabled: disabled,
7031
- slotProps: {
7032
- input: {
7033
- readOnly: isReadOnly
7034
- }
7035
- },
7036
- size: size,
7037
- error: !!fieldState.error,
7038
- helperText: (_fieldState$error = fieldState.error) == null ? void 0 : _fieldState$error.message
7039
- });
7040
- }
7041
- });
7042
- };
7043
-
7044
7114
  var VolcanicFields = function VolcanicFields(_ref) {
7045
7115
  var isDisabled = _ref.isDisabled,
7046
7116
  isReadOnly = _ref.isReadOnly,
@@ -7087,7 +7157,8 @@ var VolcanicFields = function VolcanicFields(_ref) {
7087
7157
  name: "vaSigmetVolcanoCoordinates.latitude",
7088
7158
  label: t('latitude-degrees-and-minutes'),
7089
7159
  disabled: isDisabled,
7090
- isReadOnly: isReadOnly
7160
+ isReadOnly: isReadOnly,
7161
+ t: t
7091
7162
  }) : jsx(ReactHookFormNumberField, {
7092
7163
  name: "vaSigmetVolcanoCoordinates.latitude",
7093
7164
  label: t('latitude'),
@@ -7116,7 +7187,8 @@ var VolcanicFields = function VolcanicFields(_ref) {
7116
7187
  label: t('longitude-degrees-and-minutes'),
7117
7188
  disabled: isDisabled,
7118
7189
  isReadOnly: isReadOnly,
7119
- isLongitude: true
7190
+ isLongitude: true,
7191
+ t: t
7120
7192
  }) : jsx(ReactHookFormNumberField, {
7121
7193
  name: "vaSigmetVolcanoCoordinates.longitude",
7122
7194
  label: t('longitude'),
@@ -8390,11 +8462,11 @@ var SigmetForm = function SigmetForm(_ref) {
8390
8462
  getTAC = _ref.getTAC,
8391
8463
  storedGeoJSON = _ref.storedGeoJSON,
8392
8464
  storedEndGeoJSON = _ref.storedEndGeoJSON,
8393
- isAmending = _ref.isAmending;
8465
+ lockValidFrom = _ref.lockValidFrom;
8394
8466
  var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
8395
8467
  t = _useSigmetAirmetTrans.t;
8396
- var _useApiContext = useApiContext(),
8397
- api = _useApiContext.api;
8468
+ var _useTACApi = useTACApi(),
8469
+ fetchSigmetTAC = _useTACApi.fetchSigmetTAC;
8398
8470
  var _useFormContext2 = useFormContext(),
8399
8471
  watch = _useFormContext2.watch,
8400
8472
  setValue = _useFormContext2.setValue,
@@ -8407,11 +8479,49 @@ var SigmetForm = function SigmetForm(_ref) {
8407
8479
  var _React$useState2 = React__default.useState(getDefaultPhenomena(productConfig).phenomena),
8408
8480
  phenomenaList = _React$useState2[0],
8409
8481
  setPhenomenaList = _React$useState2[1];
8482
+ var sourcePanelId = useSelector(function (store) {
8483
+ return uiSelectors.getSourcePanelId(store, 'publicWarnings');
8484
+ });
8485
+ var linkedMaps = useSelector(function (store) {
8486
+ return genericSelectors.getLinkedMaps(store, sourcePanelId);
8487
+ });
8488
+ var getSrsForMapId = useSelector(function (store) {
8489
+ return linkedMaps ? mapSelectors.getSrs(store, linkedMaps[0]) : undefined;
8490
+ });
8491
+ // Fallback to Mercator for '', null, or undefined
8492
+ var projection = getSrsForMapId != null && getSrsForMapId.trim() ? getSrsForMapId : 'EPSG:3857';
8493
+ var prevProjection = usePrevious(projection);
8494
+ // Trigger update if projection changes
8495
+ useEffect(function () {
8496
+ if (prevProjection === undefined) {
8497
+ return;
8498
+ }
8499
+ if (projection !== prevProjection) {
8500
+ var _startGeoJSON$feature;
8501
+ if (startGeoJSON != null && (_startGeoJSON$feature = startGeoJSON.features) != null && _startGeoJSON$feature.length) {
8502
+ updateStartGeoJson(startGeoJSON);
8503
+ }
8504
+ }
8505
+ // eslint-disable-next-line react-hooks/exhaustive-deps
8506
+ }, [projection, prevProjection]);
8507
+ useEffect(function () {
8508
+ if (prevProjection === undefined) {
8509
+ return;
8510
+ }
8511
+ if (projection !== prevProjection) {
8512
+ var _endGeoJSON$features;
8513
+ if (endGeoJSON != null && (_endGeoJSON$features = endGeoJSON.features) != null && _endGeoJSON$features.length) {
8514
+ updateEndGeoJson(endGeoJSON);
8515
+ }
8516
+ }
8517
+ // eslint-disable-next-line react-hooks/exhaustive-deps
8518
+ }, [projection, prevProjection]);
8410
8519
  var _useMapDrawTool = useMapDrawTool({
8411
8520
  defaultDrawModes: getDrawTools(t, StartOrEndDrawing.start, getFir(productConfig, firBorderAtStart)),
8412
- defaultGeoJSON: !isCancelSigmet && initialSigmet && initialSigmet.startGeometry ? addFeatureProperties(initialSigmet.startGeometry, featurePropsStart) : undefined,
8413
- defaultGeoJSONIntersection: !isCancelSigmet && initialSigmet && initialSigmet.startGeometryIntersect ? addFeatureProperties(initialSigmet.startGeometryIntersect, featurePropsIntersectionStart) : undefined,
8414
- defaultGeoJSONIntersectionBounds: addFeatureProperties(getFir(productConfig, firBorderAtStart), featurePropsFIR)
8521
+ defaultGeoJSON: !isCancelSigmet && initialSigmet != null && initialSigmet.startGeometry ? addFeatureProperties(initialSigmet.startGeometry, featurePropsStart) : undefined,
8522
+ defaultGeoJSONIntersection: !isCancelSigmet && initialSigmet != null && initialSigmet.startGeometryIntersect ? addFeatureProperties(initialSigmet.startGeometryIntersect, featurePropsIntersectionStart) : undefined,
8523
+ defaultGeoJSONIntersectionBounds: addFeatureProperties(getFir(productConfig, firBorderAtStart), featurePropsFIR),
8524
+ projection: projection
8415
8525
  }),
8416
8526
  startGeoJSON = _useMapDrawTool.geoJSON,
8417
8527
  setStartGeoJSON = _useMapDrawTool.setGeoJSON,
@@ -8425,10 +8535,11 @@ var SigmetForm = function SigmetForm(_ref) {
8425
8535
  setStartEditModes = _useMapDrawTool.setDrawModes;
8426
8536
  var _useMapDrawTool2 = useMapDrawTool({
8427
8537
  defaultDrawModes: getDrawTools(t, StartOrEndDrawing.end, getFir(productConfig, firBorderAtStart)),
8428
- defaultGeoJSON: !isCancelSigmet && initialSigmet && initialSigmet.endGeometry ? addFeatureProperties(initialSigmet.endGeometry, featurePropsEnd) : undefined,
8429
- defaultGeoJSONIntersection: !isCancelSigmet && initialSigmet && initialSigmet.endGeometryIntersect ? addFeatureProperties(initialSigmet.endGeometryIntersect, featurePropsIntersectionEnd) : undefined,
8538
+ defaultGeoJSON: !isCancelSigmet && initialSigmet != null && initialSigmet.endGeometry ? addFeatureProperties(initialSigmet.endGeometry, featurePropsEnd) : undefined,
8539
+ defaultGeoJSONIntersection: !isCancelSigmet && initialSigmet != null && initialSigmet.endGeometryIntersect ? addFeatureProperties(initialSigmet.endGeometryIntersect, featurePropsIntersectionEnd) : undefined,
8430
8540
  defaultGeoJSONIntersectionBounds: addFeatureProperties(getFir(productConfig, firBorderAtStart), featurePropsFIR),
8431
- defaultGeoJSONIntersectionProperties: featurePropsIntersectionEnd
8541
+ defaultGeoJSONIntersectionProperties: featurePropsIntersectionEnd,
8542
+ projection: projection
8432
8543
  }),
8433
8544
  endGeoJSON = _useMapDrawTool2.geoJSON,
8434
8545
  setEndGeoJSON = _useMapDrawTool2.setGeoJSON,
@@ -8443,7 +8554,7 @@ var SigmetForm = function SigmetForm(_ref) {
8443
8554
  var getHasFormErrors = function getHasFormErrors() {
8444
8555
  return Object.keys(errors).length > 0;
8445
8556
  };
8446
- var _useTAC = useTAC(t, initialSigmet !== null ? initialSigmet : initialCancelSigmet, getTAC || api.getSigmetTAC, getHasFormErrors, getOmitChangeFromConfig(productConfig)),
8557
+ var _useTAC = useTAC(t, initialSigmet != null ? initialSigmet : initialCancelSigmet, getTAC != null ? getTAC : fetchSigmetTAC, getHasFormErrors, getOmitChangeFromConfig(productConfig)),
8447
8558
  tac = _useTAC[0],
8448
8559
  updateTac = _useTAC[1];
8449
8560
  React__default.useEffect(function () {
@@ -8524,7 +8635,7 @@ var SigmetForm = function SigmetForm(_ref) {
8524
8635
  var helperText = isReadOnly ? '' : 'Optional';
8525
8636
  React__default.useEffect(function () {
8526
8637
  var isInDrawMode = activeStartTool !== '' || activeEndTool !== '';
8527
- setDialogActionsDisabled && setDialogActionsDisabled(isInDrawMode);
8638
+ setDialogActionsDisabled == null || setDialogActionsDisabled(isInDrawMode);
8528
8639
  if (mode === 'view') {
8529
8640
  setIsDisabled(true);
8530
8641
  } else {
@@ -8586,20 +8697,20 @@ var SigmetForm = function SigmetForm(_ref) {
8586
8697
  isReadOnly: isReadOnly,
8587
8698
  helperText: helperText,
8588
8699
  onChange: onChangeForm
8589
- }), !isCancelSigmet && hasVolcanicAshes && !isShortTest() && jsx(VolcanicFields, {
8700
+ }), !isCancelSigmet && hasVolcanicAshes && !isShortTest() ? jsx(VolcanicFields, {
8590
8701
  isDisabled: isDisabled,
8591
8702
  isReadOnly: isReadOnly,
8592
8703
  helperText: helperText,
8593
8704
  degreesAndMinutes: degreesAndMinutes
8594
- }), jsx(ValidFrom, {
8705
+ }) : null, jsx(ValidFrom, {
8595
8706
  productConfig: productConfig,
8596
8707
  isDisabled: isDisabled,
8597
- isAmending: isAmending,
8598
8708
  isReadOnly: isReadOnly,
8599
8709
  onChange: onChangeForm,
8600
8710
  onUserChange: function onUserChange() {
8601
8711
  return setHasUserChangedTime(true);
8602
- }
8712
+ },
8713
+ lockBecauseActive: lockValidFrom
8603
8714
  }), jsx(ValidUntil, {
8604
8715
  productConfig: productConfig,
8605
8716
  isDisabled: isDisabled,
@@ -8614,7 +8725,7 @@ var SigmetForm = function SigmetForm(_ref) {
8614
8725
  isDisabled: isDisabled,
8615
8726
  isReadOnly: isReadOnly,
8616
8727
  onChange: function onChange(event, newPhenomenaList) {
8617
- onChangeFir(newPhenomenaList || [], event);
8728
+ onChangeFir(newPhenomenaList != null ? newPhenomenaList : [], event);
8618
8729
  }
8619
8730
  }), jsx(StartGeometry, {
8620
8731
  isReadOnly: isReadOnly,
@@ -8646,7 +8757,7 @@ var SigmetForm = function SigmetForm(_ref) {
8646
8757
  }), !isCancelSigmet && !omitChange && jsx(Change, {
8647
8758
  isDisabled: isDisabled,
8648
8759
  isReadOnly: isReadOnly
8649
- }), isCancelSigmet && watch('vaSigmetMoveToFIR') && jsx(ProductFormFieldLayout, {
8760
+ }), isCancelSigmet && watch('vaSigmetMoveToFIR') ? jsx(ProductFormFieldLayout, {
8650
8761
  children: jsxs(Typography, {
8651
8762
  variant: "body2",
8652
8763
  sx: Object.assign({}, styles$2.body, {
@@ -8657,7 +8768,7 @@ var SigmetForm = function SigmetForm(_ref) {
8657
8768
  children: [" ", watch('vaSigmetMoveToFIR')]
8658
8769
  })]
8659
8770
  })
8660
- }), jsx(IssuedAt, {
8771
+ }) : null, jsx(IssuedAt, {
8661
8772
  date: getProductIssueDate(t, initialSigmet, initialCancelSigmet),
8662
8773
  isReadOnly: isReadOnly
8663
8774
  }), jsxs(Tac, {
@@ -8667,7 +8778,7 @@ var SigmetForm = function SigmetForm(_ref) {
8667
8778
  name: "sequence",
8668
8779
  defaultValue: "-1"
8669
8780
  }), /* Add hidden fields for TAC generation in case of cancel sigmet */
8670
- isCancelSigmet && jsxs(Fragment, {
8781
+ isCancelSigmet ? jsxs(Fragment, {
8671
8782
  children: [jsx(ReactHookFormHiddenInput, {
8672
8783
  name: "cancelsSigmetSequenceId"
8673
8784
  }), jsx(ReactHookFormHiddenInput, {
@@ -8675,7 +8786,7 @@ var SigmetForm = function SigmetForm(_ref) {
8675
8786
  }), jsx(ReactHookFormHiddenInput, {
8676
8787
  name: "validDateStartOfSigmetToCancel"
8677
8788
  })]
8678
- })]
8789
+ }) : null]
8679
8790
  })]
8680
8791
  });
8681
8792
  };
@@ -8753,7 +8864,7 @@ var AirmetForm = function AirmetForm(_ref) {
8753
8864
  product = _ref.product,
8754
8865
  getTAC = _ref.getTAC,
8755
8866
  storedGeoJSON = _ref.storedGeoJSON,
8756
- isAmending = _ref.isAmending;
8867
+ lockValidFrom = _ref.lockValidFrom;
8757
8868
  var _useFormContext2 = useFormContext(),
8758
8869
  watch = _useFormContext2.watch,
8759
8870
  setValue = _useFormContext2.setValue,
@@ -8769,14 +8880,40 @@ var AirmetForm = function AirmetForm(_ref) {
8769
8880
  setHasUserChangedTime = _React$useState2[1];
8770
8881
  var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
8771
8882
  t = _useSigmetAirmetTrans.t;
8772
- var _useApiContext = useApiContext(),
8773
- api = _useApiContext.api;
8883
+ var _useTACApi = useTACApi(),
8884
+ fetchAirmetTAC = _useTACApi.fetchAirmetTAC;
8774
8885
  var firBorderAtStart = initialAirmet ? initialAirmet.locationIndicatorATSR : productConfig.active_firs[0];
8886
+ var sourcePanelId = useSelector(function (store) {
8887
+ return uiSelectors.getSourcePanelId(store, 'publicWarnings');
8888
+ });
8889
+ var linkedMaps = useSelector(function (store) {
8890
+ return genericSelectors.getLinkedMaps(store, sourcePanelId);
8891
+ });
8892
+ var getSrsForMapId = useSelector(function (store) {
8893
+ return linkedMaps ? mapSelectors.getSrs(store, linkedMaps[0]) : undefined;
8894
+ });
8895
+ // Fallback to Mercator for '', null, or undefined
8896
+ var projection = getSrsForMapId != null && getSrsForMapId.trim() ? getSrsForMapId : 'EPSG:3857';
8897
+ var prevProjection = usePrevious(projection);
8898
+ // Trigger update if projection changes
8899
+ useEffect(function () {
8900
+ if (prevProjection === undefined) {
8901
+ return;
8902
+ }
8903
+ if (projection !== prevProjection) {
8904
+ var _startGeoJSON$feature;
8905
+ if (startGeoJSON != null && (_startGeoJSON$feature = startGeoJSON.features) != null && _startGeoJSON$feature.length) {
8906
+ updateStartGeoJson(startGeoJSON);
8907
+ }
8908
+ }
8909
+ // eslint-disable-next-line react-hooks/exhaustive-deps
8910
+ }, [projection, prevProjection]);
8775
8911
  var _useMapDrawTool = useMapDrawTool({
8776
8912
  defaultDrawModes: getDrawTools(t, StartOrEndDrawing.start, getFir(productConfig, firBorderAtStart)),
8777
- defaultGeoJSON: !isCancelAirmet && initialAirmet && initialAirmet.startGeometry ? addFeatureProperties(initialAirmet.startGeometry, featurePropsStart) : undefined,
8778
- defaultGeoJSONIntersection: !isCancelAirmet && initialAirmet && initialAirmet.startGeometryIntersect ? addFeatureProperties(initialAirmet.startGeometryIntersect, featurePropsIntersectionStart) : undefined,
8779
- defaultGeoJSONIntersectionBounds: addFeatureProperties(getFir(productConfig, firBorderAtStart), featurePropsFIR)
8913
+ defaultGeoJSON: !isCancelAirmet && initialAirmet != null && initialAirmet.startGeometry ? addFeatureProperties(initialAirmet.startGeometry, featurePropsStart) : undefined,
8914
+ defaultGeoJSONIntersection: !isCancelAirmet && !!(initialAirmet != null && initialAirmet.startGeometry) ? addFeatureProperties(initialAirmet.startGeometryIntersect, featurePropsIntersectionStart) : undefined,
8915
+ defaultGeoJSONIntersectionBounds: addFeatureProperties(getFir(productConfig, firBorderAtStart), featurePropsFIR),
8916
+ projection: projection
8780
8917
  }),
8781
8918
  startGeoJSON = _useMapDrawTool.geoJSON,
8782
8919
  setGeoJSON = _useMapDrawTool.setGeoJSON,
@@ -8791,7 +8928,7 @@ var AirmetForm = function AirmetForm(_ref) {
8791
8928
  var getHasFormErrors = function getHasFormErrors() {
8792
8929
  return Object.keys(errors).length > 0;
8793
8930
  };
8794
- var _useTAC = useTAC(t, initialAirmet !== null ? initialAirmet : initialCancelAirmet, getTAC || api.getAirmetTAC, getHasFormErrors),
8931
+ var _useTAC = useTAC(t, initialAirmet != null ? initialAirmet : initialCancelAirmet, getTAC != null ? getTAC : fetchAirmetTAC, getHasFormErrors),
8795
8932
  tac = _useTAC[0],
8796
8933
  updateTac = _useTAC[1];
8797
8934
  React__default.useEffect(function () {
@@ -8888,17 +9025,17 @@ var AirmetForm = function AirmetForm(_ref) {
8888
9025
  isDisabled: isDisabled,
8889
9026
  isReadOnly: isReadOnly,
8890
9027
  onChange: onChangeForm
8891
- }), !isCancelAirmet && hasSurfaceVisiblity && jsx(SurfaceVisibility, {
9028
+ }), !isCancelAirmet && hasSurfaceVisiblity ? jsx(SurfaceVisibility, {
8892
9029
  isReadOnly: isReadOnly,
8893
9030
  isDisabled: isDisabled,
8894
9031
  onChange: onChangeForm,
8895
9032
  productConfig: productConfig
8896
- }), !isCancelAirmet && hasSurfaceWind && jsx(SurfaceWind, {
9033
+ }) : null, !isCancelAirmet && hasSurfaceWind ? jsx(SurfaceWind, {
8897
9034
  isReadOnly: isReadOnly,
8898
9035
  isDisabled: isDisabled,
8899
9036
  onChange: onChangeForm,
8900
9037
  productConfig: productConfig
8901
- }), !isCancelAirmet && jsx(ObservationForecast, {
9038
+ }) : null, !isCancelAirmet && jsx(ObservationForecast, {
8902
9039
  isDisabled: isDisabled,
8903
9040
  isReadOnly: isReadOnly
8904
9041
  }), !isCancelAirmet && jsx(ObservationForecastTime, {
@@ -8909,12 +9046,12 @@ var AirmetForm = function AirmetForm(_ref) {
8909
9046
  }), jsx(ValidFrom, {
8910
9047
  productConfig: productConfig,
8911
9048
  isDisabled: isDisabled,
8912
- isAmending: isAmending,
8913
9049
  isReadOnly: isReadOnly,
8914
9050
  onChange: onChangeForm,
8915
9051
  onUserChange: function onUserChange() {
8916
9052
  return setHasUserChangedTime(true);
8917
- }
9053
+ },
9054
+ lockBecauseActive: lockValidFrom
8918
9055
  }), jsx(ValidUntil, {
8919
9056
  productConfig: productConfig,
8920
9057
  isDisabled: isDisabled,
@@ -8929,7 +9066,7 @@ var AirmetForm = function AirmetForm(_ref) {
8929
9066
  isDisabled: isDisabled,
8930
9067
  productConfig: productConfig,
8931
9068
  onChange: function onChange(event, newPhenomenaList) {
8932
- onChangeFir(newPhenomenaList || [], event);
9069
+ onChangeFir(newPhenomenaList != null ? newPhenomenaList : [], event);
8933
9070
  }
8934
9071
  }), jsx(StartGeometry, {
8935
9072
  isReadOnly: isReadOnly,
@@ -8940,18 +9077,18 @@ var AirmetForm = function AirmetForm(_ref) {
8940
9077
  activeTool: activeStartTool,
8941
9078
  productConfig: productConfig,
8942
9079
  isDisabled: drawToolsDisabled
8943
- }), !isCancelAirmet && hasLevels && jsx(Levels, {
9080
+ }), !isCancelAirmet && hasLevels ? jsx(Levels, {
8944
9081
  isDisabled: isDisabled,
8945
9082
  isReadOnly: isReadOnly,
8946
9083
  onChange: onChangeForm,
8947
9084
  productType: "airmet",
8948
9085
  productConfig: productConfig
8949
- }), !isCancelAirmet && hasCloudLevels && jsx(CloudLevels, {
9086
+ }) : null, !isCancelAirmet && hasCloudLevels ? jsx(CloudLevels, {
8950
9087
  isDisabled: isDisabled,
8951
9088
  isReadOnly: isReadOnly,
8952
9089
  onChange: onChangeForm,
8953
9090
  productConfig: productConfig
8954
- }), !isCancelAirmet && jsx(Progress, {
9091
+ }) : null, !isCancelAirmet && jsx(Progress, {
8955
9092
  productType: "airmet",
8956
9093
  isDisabled: isDisabled,
8957
9094
  isReadOnly: isReadOnly,
@@ -8970,7 +9107,7 @@ var AirmetForm = function AirmetForm(_ref) {
8970
9107
  name: "sequence",
8971
9108
  defaultValue: "-1"
8972
9109
  }), /* Add hidden fields for TAC generation in case of cancel airmet */
8973
- isCancelAirmet && jsxs(Fragment, {
9110
+ isCancelAirmet ? jsxs(Fragment, {
8974
9111
  children: [jsx(ReactHookFormHiddenInput, {
8975
9112
  name: "cancelsAirmetSequenceId"
8976
9113
  }), jsx(ReactHookFormHiddenInput, {
@@ -8978,7 +9115,7 @@ var AirmetForm = function AirmetForm(_ref) {
8978
9115
  }), jsx(ReactHookFormHiddenInput, {
8979
9116
  name: "validDateStartOfAirmetToCancel"
8980
9117
  })]
8981
- })]
9118
+ }) : null]
8982
9119
  })]
8983
9120
  });
8984
9121
  };
@@ -9060,9 +9197,10 @@ var ProductFormDialogContent = function ProductFormDialogContent(_ref) {
9060
9197
  product = _ref.product;
9061
9198
  var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
9062
9199
  t = _useSigmetAirmetTrans.t;
9063
- var _useApiContext = useApiContext(),
9064
- api = _useApiContext.api;
9065
- var apiCall = productType === 'sigmet' ? api.postSigmet : api.postAirmet;
9200
+ var postSigmetMutation = usePostSigmet();
9201
+ var postAirmetMutation = usePostAirmet();
9202
+ var apiCall = productType === 'sigmet' ? postSigmetMutation.mutateAsync : postAirmetMutation.mutateAsync;
9203
+ var isLoading = productType === 'sigmet' ? postSigmetMutation.isPending : postAirmetMutation.isPending;
9066
9204
  var _useFormContext = useFormContext(),
9067
9205
  handleSubmit = _useFormContext.handleSubmit,
9068
9206
  formState = _useFormContext.formState,
@@ -9079,38 +9217,28 @@ var ProductFormDialogContent = function ProductFormDialogContent(_ref) {
9079
9217
  usePreventBrowserClose(isDirty);
9080
9218
  var confirmationDialog = useConfirmationDialog();
9081
9219
  var _React$useState = React.useState(false),
9082
- showLoader = _React$useState[0],
9083
- setLoader = _React$useState[1];
9084
- var _React$useState2 = React.useState(false),
9085
- errorStoreMessage = _React$useState2[0],
9086
- setErrorStoreMessage = _React$useState2[1];
9087
- var _React$useState3 = React.useState(''),
9088
- errorStoreMessageText = _React$useState3[0],
9089
- setErrorStoreMessageText = _React$useState3[1];
9090
- var _React$useState4 = React.useState(false),
9091
- dialogActionsDisabled = _React$useState4[0],
9092
- setDialogActionsDisabled = _React$useState4[1];
9220
+ errorStoreMessage = _React$useState[0],
9221
+ setErrorStoreMessage = _React$useState[1];
9222
+ var _React$useState2 = React.useState(''),
9223
+ errorStoreMessageText = _React$useState2[0],
9224
+ setErrorStoreMessageText = _React$useState2[1];
9225
+ var _React$useState3 = React.useState(false),
9226
+ dialogActionsDisabled = _React$useState3[0],
9227
+ setDialogActionsDisabled = _React$useState3[1];
9093
9228
  var postProduct = function postProduct(productToPost, newStatus) {
9094
9229
  var uuid = product !== null && product.uuid ? product.uuid : null;
9095
9230
  var postProductParam = productType === 'sigmet' ? createSigmetPostParameter(productToPost, newStatus, uuid) : createAirmetPostParameter(productToPost, newStatus, uuid);
9096
- setLoader(true);
9097
- setErrorStoreMessage(false);
9098
- setErrorStoreMessageText('');
9099
9231
  apiCall(postProductParam).then(function () {
9100
9232
  onToggleDialog();
9101
9233
  })["catch"](function (error) {
9102
9234
  setErrorStoreMessage(true);
9103
- if (isAxiosError(error)) {
9104
- setErrorStoreMessageText(getAxiosErrorMessage(error));
9105
- }
9106
- setLoader(false);
9235
+ setErrorStoreMessageText(error.message || 'Unknown error');
9107
9236
  });
9108
9237
  };
9109
9238
  var onToggleDialog = function onToggleDialog(shouldRefreshList) {
9110
9239
  if (shouldRefreshList === void 0) {
9111
9240
  shouldRefreshList = true;
9112
9241
  }
9113
- setLoader(false);
9114
9242
  toggleDialogStatus(shouldRefreshList);
9115
9243
  };
9116
9244
  var showConfirmDialog = function showConfirmDialog(action) {
@@ -9265,7 +9393,7 @@ var ProductFormDialogContent = function ProductFormDialogContent(_ref) {
9265
9393
  })
9266
9394
  }), jsx(DraftFieldHelper, {}), jsx(Backdrop, {
9267
9395
  "data-testid": "loader",
9268
- open: showLoader,
9396
+ open: isLoading,
9269
9397
  sx: {
9270
9398
  zIndex: 1500,
9271
9399
  color: '#fff'
@@ -9486,25 +9614,39 @@ var ProductListRow = function ProductListRow(_ref2) {
9486
9614
  productConfig = _ref2.productConfig;
9487
9615
  var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
9488
9616
  t = _useSigmetAirmetTrans.t;
9489
- var _useApiContext = useApiContext(),
9490
- api = _useApiContext.api;
9491
9617
  var _useIsMounted = useIsMounted(),
9492
9618
  isMounted = _useIsMounted.isMounted;
9493
9619
  var _React$useState = React__default.useState(''),
9494
9620
  TAC = _React$useState[0],
9495
9621
  setTAC = _React$useState[1];
9496
- var apiCall = productType === 'sigmet' ? api.getSigmetTAC : api.getAirmetTAC;
9622
+ var _useTACApi = useTACApi(),
9623
+ fetchSigmetTAC = _useTACApi.fetchSigmetTAC,
9624
+ fetchAirmetTAC = _useTACApi.fetchAirmetTAC;
9625
+ var apiCall = productType === 'sigmet' ? fetchSigmetTAC : fetchAirmetTAC;
9497
9626
  React__default.useEffect(function () {
9498
- var retrieveTAC = function retrieveTAC(productToPost) {
9499
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9500
- apiCall(productToPost).then(function (result) {
9501
- if (isMounted.current) {
9502
- setTAC(result.data);
9503
- }
9504
- })["catch"](function () {});
9505
- };
9627
+ var retrieveTAC = /*#__PURE__*/function () {
9628
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(productToPost) {
9629
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9630
+ while (1) switch (_context.prev = _context.next) {
9631
+ case 0:
9632
+ _context.next = 2;
9633
+ return apiCall(productToPost).then(function (result) {
9634
+ if (isMounted.current) {
9635
+ setTAC(result.data);
9636
+ }
9637
+ })["catch"](function () {});
9638
+ case 2:
9639
+ case "end":
9640
+ return _context.stop();
9641
+ }
9642
+ }, _callee);
9643
+ }));
9644
+ return function retrieveTAC(_x) {
9645
+ return _ref3.apply(this, arguments);
9646
+ };
9647
+ }();
9506
9648
  if (shouldRetrieveTAC(product)) {
9507
- retrieveTAC(product);
9649
+ void retrieveTAC(product);
9508
9650
  } else if (isMounted.current) {
9509
9651
  setTAC(noTAC(t));
9510
9652
  }
@@ -9720,80 +9862,36 @@ var ProductList = function ProductList(_ref) {
9720
9862
  };
9721
9863
 
9722
9864
  var useProductApi = function useProductApi(productType) {
9723
- var _React$useState = React__default.useState({
9724
- isLoading: false,
9725
- error: undefined,
9726
- result: []
9727
- }),
9728
- state = _React$useState[0],
9729
- setState = _React$useState[1];
9730
- var _useIsMounted = useIsMounted(),
9731
- isMounted = _useIsMounted.isMounted;
9732
- var _useApiContext = useApiContext(),
9733
- api = _useApiContext.api;
9734
- var requestList = productType === 'sigmet' ? api.getSigmetList : api.getAirmetList;
9735
- var updateState = function updateState(newState) {
9736
- if (isMounted.current) {
9737
- setState(function (currentState) {
9738
- return Object.assign({}, currentState, newState);
9739
- });
9740
- }
9741
- };
9742
- var fetchNewData = /*#__PURE__*/function () {
9743
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9744
- var _yield$requestList, data, newError;
9745
- return _regeneratorRuntime().wrap(function _callee$(_context) {
9746
- while (1) switch (_context.prev = _context.next) {
9747
- case 0:
9748
- if (!state.isLoading) {
9865
+ var sigmetQuery = useSigmetList(productType !== 'sigmet');
9866
+ var airmetQuery = useAirmetList(productType !== 'airmet');
9867
+ var query = productType === 'sigmet' ? sigmetQuery : airmetQuery;
9868
+ var data = query.data,
9869
+ isLoading = query.isLoading,
9870
+ error = query.error,
9871
+ refetch = query.refetch;
9872
+ return {
9873
+ result: data || [],
9874
+ isLoading: isLoading,
9875
+ error: error,
9876
+ fetchNewData: function () {
9877
+ var _fetchNewData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9878
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9879
+ while (1) switch (_context.prev = _context.next) {
9880
+ case 0:
9749
9881
  _context.next = 2;
9750
- break;
9751
- }
9752
- return _context.abrupt("return");
9753
- case 2:
9754
- updateState(Object.assign({}, state, {
9755
- isLoading: true,
9756
- error: undefined
9757
- }));
9758
- _context.prev = 3;
9759
- _context.next = 6;
9760
- return requestList();
9761
- case 6:
9762
- _yield$requestList = _context.sent;
9763
- data = _yield$requestList.data;
9764
- updateState(Object.assign({}, state, {
9765
- result: data,
9766
- isLoading: false
9767
- }));
9768
- _context.next = 15;
9769
- break;
9770
- case 11:
9771
- _context.prev = 11;
9772
- _context.t0 = _context["catch"](3);
9773
- newError = Object.assign({}, _context.t0, {
9774
- name: translateKeyOutsideComponents('error-backend')
9775
- });
9776
- updateState(Object.assign({}, state, {
9777
- error: newError,
9778
- isLoading: false
9779
- }));
9780
- case 15:
9781
- case "end":
9782
- return _context.stop();
9783
- }
9784
- }, _callee, null, [[3, 11]]);
9785
- }));
9786
- return function fetchNewData() {
9787
- return _ref.apply(this, arguments);
9788
- };
9789
- }();
9790
- React__default.useEffect(function () {
9791
- void fetchNewData();
9792
- // eslint-disable-next-line react-hooks/exhaustive-deps
9793
- }, []);
9794
- return Object.assign({}, state, {
9795
- fetchNewData: fetchNewData
9796
- });
9882
+ return refetch();
9883
+ case 2:
9884
+ case "end":
9885
+ return _context.stop();
9886
+ }
9887
+ }, _callee);
9888
+ }));
9889
+ function fetchNewData() {
9890
+ return _fetchNewData.apply(this, arguments);
9891
+ }
9892
+ return fetchNewData;
9893
+ }()
9894
+ };
9797
9895
  };
9798
9896
  var renewProduct = function renewProduct(oldProduct, productConfig) {
9799
9897
  return Object.assign({}, oldProduct, {
@@ -9827,8 +9925,6 @@ var renewSigmet = function renewSigmet(oldSigmet, productConfig) {
9827
9925
  * Pass in either 'sigmet' or 'airmet' as prop to determine the mode
9828
9926
  * @param {string} productType productType: string - either 'sigmet' or 'airmet'. Determines mode in which wrapper is loaded
9829
9927
  *
9830
- * @example
9831
- * ```<ApiProvider baseURL="http://test.com" appURL="http://app.com" auth={auth} onSetAuth={onSetAuth} createApi={api.createApi} authTokenURL="url/tokenrefresh"> <MetInfoWrapper productType="sigmet"/> </ApiProvider>```
9832
9928
  */
9833
9929
  var MetInfoWrapper = function MetInfoWrapper(_ref) {
9834
9930
  var productType = _ref.productType,
@@ -9910,16 +10006,13 @@ var DownloadSigmetAirmetConfigWrapper = function DownloadSigmetAirmetConfigWrapp
9910
10006
  var productType = _ref.productType;
9911
10007
  var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
9912
10008
  t = _useSigmetAirmetTrans.t;
9913
- var _useApiContext = useApiContext(),
9914
- api = _useApiContext.api;
9915
- var _useAuthenticationCon = useAuthenticationContext(),
10009
+ var _useAuthenticationCon = useAuthenticationContext$1(),
9916
10010
  isLoggedIn = _useAuthenticationCon.isLoggedIn;
9917
- var getConfigurationRequest = api[productType === 'sigmet' ? 'getSigmetConfiguration' : 'getAirmetConfiguration'];
9918
- var _useApi = useApi(getConfigurationRequest),
9919
- productConfig = _useApi.result,
9920
- isConfigLoading = _useApi.isLoading,
9921
- error = _useApi.error;
9922
- if (isConfigLoading) {
10011
+ var _useProductConfig = useProductConfig(productType),
10012
+ productConfig = _useProductConfig.data,
10013
+ isLoading = _useProductConfig.isLoading,
10014
+ error = _useProductConfig.error;
10015
+ if (isLoading) {
9923
10016
  return jsx(LinearProgress, {
9924
10017
  "data-testid": "loadingSpinner"
9925
10018
  });
@@ -9930,6 +10023,12 @@ var DownloadSigmetAirmetConfigWrapper = function DownloadSigmetAirmetConfigWrapp
9930
10023
  info: !isLoggedIn ? t('error-auth-login') : error.message
9931
10024
  });
9932
10025
  }
10026
+ if (!productConfig) {
10027
+ return jsx(AlertBanner, {
10028
+ title: t('error-title'),
10029
+ info: t('error-no-config-found')
10030
+ });
10031
+ }
9933
10032
  return jsx(MetInfoWrapper, {
9934
10033
  productType: productType,
9935
10034
  productConfig: productConfig
@@ -9938,23 +10037,10 @@ var DownloadSigmetAirmetConfigWrapper = function DownloadSigmetAirmetConfigWrapp
9938
10037
 
9939
10038
  var AviationProductApiWrapper = function AviationProductApiWrapper(_ref) {
9940
10039
  var config = _ref.config,
9941
- auth = _ref.auth,
9942
- onSetAuth = _ref.onSetAuth,
9943
10040
  productType = _ref.productType;
9944
- return config ? jsx(ApiProvider, {
9945
- config: {
9946
- baseURL: config.baseURL,
9947
- appURL: config.appURL,
9948
- authTokenURL: config.authTokenURL,
9949
- authClientId: config.authClientId
9950
- },
9951
- auth: auth,
9952
- onSetAuth: onSetAuth,
9953
- createApi: createApi$1,
9954
- children: jsx(ErrorBoundary, {
9955
- children: jsx(DownloadSigmetAirmetConfigWrapper, {
9956
- productType: productType
9957
- })
10041
+ return config ? jsx(ErrorBoundary, {
10042
+ children: jsx(DownloadSigmetAirmetConfigWrapper, {
10043
+ productType: productType
9958
10044
  })
9959
10045
  }) : null;
9960
10046
  };
@@ -11987,104 +12073,4 @@ var fakeSigmetList = [{
11987
12073
  }
11988
12074
  }];
11989
12075
 
11990
- var fakeSigmetTAC = 'EHAA SIGMET 1 VALID 121249/121449 EHDB- EHAA AMSTERDAM FIR FRQ TS OBS ENTIRE FIR FL010 STNR WKN';
11991
- var fakeAirmetTAC = 'EHAA AIRMET -1 VALID 310700/311100 EHDB- EHAA AMSTERDAM FIR ISOL CB OBS ENTIRE FIR FL020 STNR NC';
11992
- var getApiRoutes = function getApiRoutes(axiosInstance) {
11993
- return {
11994
- getSigmetConfiguration: function () {
11995
- var _getSigmetConfiguration = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
11996
- return _regeneratorRuntime().wrap(function _callee$(_context) {
11997
- while (1) switch (_context.prev = _context.next) {
11998
- case 0:
11999
- _context.next = 2;
12000
- return new Promise(function (resolve) {
12001
- setTimeout(resolve, 2000);
12002
- });
12003
- case 2:
12004
- return _context.abrupt("return", axiosInstance.get('/sigmetConfiguration').then(function () {
12005
- return {
12006
- data: sigmetConfig
12007
- };
12008
- }));
12009
- case 3:
12010
- case "end":
12011
- return _context.stop();
12012
- }
12013
- }, _callee);
12014
- }));
12015
- function getSigmetConfiguration() {
12016
- return _getSigmetConfiguration.apply(this, arguments);
12017
- }
12018
- return getSigmetConfiguration;
12019
- }(),
12020
- getAirmetConfiguration: function () {
12021
- var _getAirmetConfiguration = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
12022
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
12023
- while (1) switch (_context2.prev = _context2.next) {
12024
- case 0:
12025
- _context2.next = 2;
12026
- return new Promise(function (resolve) {
12027
- setTimeout(resolve, 2000);
12028
- });
12029
- case 2:
12030
- return _context2.abrupt("return", axiosInstance.get('/airmetConfiguration').then(function () {
12031
- return {
12032
- data: airmetConfig
12033
- };
12034
- }));
12035
- case 3:
12036
- case "end":
12037
- return _context2.stop();
12038
- }
12039
- }, _callee2);
12040
- }));
12041
- function getAirmetConfiguration() {
12042
- return _getAirmetConfiguration.apply(this, arguments);
12043
- }
12044
- return getAirmetConfiguration;
12045
- }(),
12046
- getSigmetList: function getSigmetList() {
12047
- return axiosInstance.get('/sigmetlist').then(function () {
12048
- return {
12049
- data: fakeSigmetList
12050
- };
12051
- });
12052
- },
12053
- getSigmetTAC: function getSigmetTAC(formData) {
12054
- return axiosInstance.post('/sigmet2tac', formData).then(function () {
12055
- return {
12056
- data: fakeSigmetTAC
12057
- };
12058
- });
12059
- },
12060
- getAirmetTAC: function getAirmetTAC(formdata) {
12061
- return axiosInstance.post('/airmet2tac', formdata).then(function () {
12062
- return {
12063
- data: fakeAirmetTAC
12064
- };
12065
- });
12066
- },
12067
- postSigmet: function postSigmet(_postSigmet) {
12068
- // eslint-disable-next-line no-console
12069
- console.log('form has been posted with following values:', _postSigmet.sigmet);
12070
- return axiosInstance.post('/sigmet', _postSigmet);
12071
- },
12072
- getAirmetList: function getAirmetList() {
12073
- return axiosInstance.get('/airmetlist').then(function () {
12074
- return {
12075
- data: fakeAirmetList
12076
- };
12077
- });
12078
- },
12079
- postAirmet: function postAirmet(_postAirmet) {
12080
- // eslint-disable-next-line no-console
12081
- console.log('form has been posted with following values:', _postAirmet.airmet);
12082
- return axiosInstance.post('/airmet', _postAirmet);
12083
- }
12084
- };
12085
- };
12086
- var createApi = function createApi() {
12087
- return getApiRoutes(createFakeApiInstance());
12088
- };
12089
-
12090
- export { AirmetComponentsLookUp, AirmetForm, AirmetType, CancelSigmetVolcanicMovements, CloudLevelUnits, DEFAULT_MINIMUM_SURFACE_LEVEL, DEFAULT_MIN_MOVEMENT_SPEED, DEFAULT_MIN_VISIBILITY, DEFAULT_MIN_WIND_SPEED, Direction, DownloadSigmetAirmetConfigWrapper, LevelUnits, MapViewGeoJson, MetInfoWrapper, MovementUnit, ProductAction, ProductFormDialog, Wrapper as ProductFormDialogContent, ProductList, ProductListRow, ProductStatusDescription, SA_NAMESPACE, SigmetComponentsLookUp, SigmetForm, SigmetType, StartOrEndDrawing, VisibilityCause, WindUnit, airmetConfig, createAirmetPostParameter, createApi$1 as createApi, createApi as createFakeApi, createSigmetPostParameter, decimalToDegreesMinutes, degreesMinutesToDecimal, extractUnitsToShow, fakeAirmetList, fakeSigmetList, findSequenceNumber, firSelectionType, getActiveFIRArea, getAllFirAreas, getAllowedUnits, getBaseLayers, getConfirmationDialogButtonLabel, getConfirmationDialogCancelLabel, getConfirmationDialogContent, getConfirmationDialogTitle, getDefaultPhenomena, getDefaultValidFromValue, getDefaultValidUntilValue, getDefaultValidityMinutesFromConfig, getDialogtitle, getDrawTools, getFieldLabel, getFir, getFirArea, getFirOptions, getHoursBeforeValidity, getLevelInFeet, getLifecycleActions, getMaxCloudLevelValue, getMaxCloudLowerLevelValue, getMaxHoursOfValidity, getMaxLevelValue, getMaxMovementSpeedValue, getMaxPolygonPoints, getMaxVisibilityValue, getMaxWindSpeedValue, getMinCloudLevelValue, getMinCloudLowerLevelValue, getMinLevelValue, getMinMovementSpeedValue, getMinVisibilityValue, getMinWindSpeedValue, getOmitChangeFromConfig, getPhenomenon, getProductFormMode, getProductIssueDate, getProjection, getSequenceStyling, getToolIcon, getValidFromDelayTimeMinutesFromConfig, getValidFromXHoursBeforeMessage, hasMaxFeaturePoints, hasValue, isFir, isInstanceOfAirmet, isInstanceOfCancelAirmet, isInstanceOfCancelSigmet, isInstanceOfCancelSigmetOrAirmet, isInstanceOfSigmet, isInstanceOfSigmetOrAirmet, isLevelLower, isVAPhenomenon, prepareCancelSigmet, prepareFormValues, prepareProductValues, sigmetAirmetTranslations as saTranslations, sigmetConfig, triggerValidations, updateDrawToolsWithFir, useDelayedFormValues, useFormLayers, useShortTestHelpers };
12076
+ export { AirmetComponentsLookUp, AirmetForm, AirmetType, CancelSigmetVolcanicMovements, CloudLevelUnits, DEFAULT_MINIMUM_SURFACE_LEVEL, DEFAULT_MIN_MOVEMENT_SPEED, DEFAULT_MIN_VISIBILITY, DEFAULT_MIN_WIND_SPEED, Direction, DownloadSigmetAirmetConfigWrapper, LevelUnits, MapViewGeoJson, MetInfoWrapper, MovementUnit, ProductAction, ProductFormDialog, Wrapper as ProductFormDialogContent, ProductList, ProductListRow, ProductStatusDescription, SA_NAMESPACE, SigmetComponentsLookUp, SigmetForm, SigmetType, StartOrEndDrawing, VisibilityCause, WindUnit, airmetConfig, createAirmetPostParameter, createSigmetPostParameter, extractUnitsToShow, fakeAirmetList, fakeSigmetList, findSequenceNumber, firSelectionType, getActiveFIRArea, getAllFirAreas, getAllowedUnits, getBaseLayers, getConfirmationDialogButtonLabel, getConfirmationDialogCancelLabel, getConfirmationDialogContent, getConfirmationDialogTitle, getDefaultPhenomena, getDefaultValidFromValue, getDefaultValidUntilValue, getDefaultValidityMinutesFromConfig, getDialogtitle, getDrawTools, getFieldLabel, getFir, getFirArea, getFirOptions, getHoursBeforeValidity, getLevelInFeet, getLifecycleActions, getMaxCloudLevelValue, getMaxCloudLowerLevelValue, getMaxHoursOfValidity, getMaxLevelValue, getMaxMovementSpeedValue, getMaxPolygonPoints, getMaxVisibilityValue, getMaxWindSpeedValue, getMinCloudLevelValue, getMinCloudLowerLevelValue, getMinLevelValue, getMinMovementSpeedValue, getMinVisibilityValue, getMinWindSpeedValue, getOmitChangeFromConfig, getPhenomenon, getProductFormMode, getProductIssueDate, getProjection, getSequenceStyling, getToolIcon, getValidFromDelayTimeMinutesFromConfig, getValidFromXHoursBeforeMessage, hasMaxFeaturePoints, hasValue, isFir, isInstanceOfAirmet, isInstanceOfCancelAirmet, isInstanceOfCancelSigmet, isInstanceOfCancelSigmetOrAirmet, isInstanceOfSigmet, isInstanceOfSigmetOrAirmet, isLevelLower, isVAPhenomenon, prepareCancelSigmet, prepareFormValues, prepareProductValues, sigmetAirmetTranslations as saTranslations, sigmetConfig, triggerValidations, updateDrawToolsWithFir, useDelayedFormValues, useFormLayers, useShortTestHelpers };