@opengeoweb/taf 2.5.0 → 2.6.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.d.ts CHANGED
@@ -2,3 +2,4 @@ export * from './lib/components/TafForm';
2
2
  export * from './lib/components/TafModule';
3
3
  export { createApi } from './lib/utils/api';
4
4
  export { createApi as createFakeApi } from './lib/utils/fakeApi';
5
+ export * from './lib/components/ComponentsLookUp';
package/index.esm.js CHANGED
@@ -4,8 +4,8 @@ import { TextField, SvgIcon, Grid, Box, Button, IconButton, Tooltip, Chip, Typog
4
4
  import { useFormContext, Controller, useFieldArray } from 'react-hook-form';
5
5
  import { ReactSortable, Sortable } from 'react-sortablejs';
6
6
  import { getDeepProperty, ReactHookFormHiddenInput, ReactHookFormProvider } from '@opengeoweb/form-fields';
7
- import { useApiContext, useApi, createApiInstance } from '@opengeoweb/api';
8
- import { useIsMounted, ToggleMenu, useDraftFormHelpers, ToolContainerDraggable, useConfirmationDialog, usePreventBrowserClose, ToolButton, ToolHeader, getAxiosErrorMessage, AlertBanner, ConfirmationServiceProvider, usePoller } from '@opengeoweb/shared';
7
+ import { useApiContext, useApi, createApiInstance, ApiProvider } from '@opengeoweb/api';
8
+ import { useIsMounted, ToggleMenu, useDraftFormHelpers, ToolContainerDraggable, useConfirmationDialog, usePreventBrowserClose, ToolButton, ToolHeader, getAxiosErrorMessage, AlertBanner, ConfirmationServiceProvider, usePoller, ErrorBoundary } from '@opengeoweb/shared';
9
9
  import moment from 'moment';
10
10
  import { isEqual } from 'lodash';
11
11
  import makeStyles from '@mui/styles/makeStyles';
@@ -1994,6 +1994,22 @@ var validateFourthCloud = function validateFourthCloud(firstCloudValue, secondCl
1994
1994
  return true;
1995
1995
  };
1996
1996
 
1997
+ var emptyBaseForecast = {
1998
+ wind: '',
1999
+ visibility: '',
2000
+ weather: {
2001
+ weather1: '',
2002
+ weather2: '',
2003
+ weather3: ''
2004
+ },
2005
+ cloud: {
2006
+ cloud1: '',
2007
+ cloud2: '',
2008
+ cloud3: '',
2009
+ cloud4: ''
2010
+ }
2011
+ }; // formatters
2012
+
1997
2013
  var formatIssueTime = function formatIssueTime(issueDate) {
1998
2014
  return issueDate ? "".concat(moment(issueDate).utc().format('DDHHmm'), "Z") : 'Not issued';
1999
2015
  };
@@ -2299,8 +2315,6 @@ var tacHasError = function tacHasError(tac) {
2299
2315
  return tac === TAC_MISSING_DATA || tac === TAC_NOT_AVAILABLE || tac === TAC_RETRIEVING_DATA || tac === TAC_FAILED;
2300
2316
  };
2301
2317
  var useTACGenerator = function useTACGenerator(taf, requestTAC) {
2302
- var standardTAC = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
2303
-
2304
2318
  var _React$useState = React__default.useState(taf.status === 'NEW' ? TAC_NOT_AVAILABLE : TAC_RETRIEVING_DATA),
2305
2319
  _React$useState2 = _slicedToArray(_React$useState, 2),
2306
2320
  TAC = _React$useState2[0],
@@ -2325,16 +2339,11 @@ var useTACGenerator = function useTACGenerator(taf, requestTAC) {
2325
2339
  }
2326
2340
  }, [isMounted, requestTAC]);
2327
2341
  React__default.useEffect(function () {
2328
- if (taf.status !== 'NEW' && !standardTAC) {
2342
+ if (taf.status !== 'NEW') {
2329
2343
  retrieveTAC(taf);
2330
2344
  } // eslint-disable-next-line react-hooks/exhaustive-deps
2331
2345
 
2332
2346
  }, []);
2333
- React__default.useEffect(function () {
2334
- if (standardTAC !== '') {
2335
- setTAC(standardTAC);
2336
- }
2337
- }, [standardTAC]);
2338
2347
  return [TAC, retrieveTAC];
2339
2348
  };
2340
2349
  var useDragOrder = function useDragOrder(trigger, move, onFormBlur) {
@@ -2526,7 +2535,7 @@ var prepareTafValues = function prepareTafValues(_taf, tafAction) {
2526
2535
  var taf = tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND' || tafAction === 'CORRECT' || tafAction === 'DRAFT_CORRECT' ? getAmendedCorrectedTafTimes(_taf, tafAction) : _taf;
2527
2536
  return Object.assign(Object.assign(Object.assign(Object.assign({}, taf), {
2528
2537
  messageType: getMessageType(taf, tafAction),
2529
- baseForecast: formatFormValues(taf.baseForecast)
2538
+ baseForecast: Object.assign(Object.assign({}, emptyBaseForecast), formatFormValues(taf.baseForecast))
2530
2539
  }), taf.changeGroups && {
2531
2540
  changeGroups: taf.changeGroups.map(formatFormValues)
2532
2541
  }), addEmptyChangeGroup && {
@@ -2913,7 +2922,7 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
2913
2922
  getValues = _useFormContext.getValues,
2914
2923
  trigger = _useFormContext.trigger;
2915
2924
 
2916
- var _useDraftFormHelpers = useDraftFormHelpers(),
2925
+ var _useDraftFormHelpers = useDraftFormHelpers(true),
2917
2926
  isNotRequiredForAction = _useDraftFormHelpers.isRequired; // cross-field required validation
2918
2927
 
2919
2928
 
@@ -3742,20 +3751,6 @@ var getPaneTitle = function getPaneTitle(sumOfErrors) {
3742
3751
  }
3743
3752
  };
3744
3753
 
3745
- var getErrorDefaultMessage = function getErrorDefaultMessage(error) {
3746
- switch (error.type) {
3747
- case 'required':
3748
- {
3749
- return 'this field is required';
3750
- }
3751
-
3752
- default:
3753
- {
3754
- return error.message;
3755
- }
3756
- }
3757
- };
3758
-
3759
3754
  var capitalizeWord = function capitalizeWord(_ref) {
3760
3755
  var _ref2 = _toArray(_ref),
3761
3756
  firstLetter = _ref2[0],
@@ -3793,7 +3788,7 @@ var getErrorMessage = function getErrorMessage(error, index) {
3793
3788
  firstNamePart = _name$split2[0];
3794
3789
 
3795
3790
  var fieldErrorTitle = humanizeErrorMessage(firstNamePart);
3796
- return "".concat(index + 1, ". ").concat(fieldErrorTitle, ": ").concat(getErrorDefaultMessage(error));
3791
+ return "".concat(index + 1, ". ").concat(fieldErrorTitle, ": ").concat(error.message);
3797
3792
  };
3798
3793
  var MODAL_DIALOG_ELEMENT = 'modal-dialog';
3799
3794
  var useIssuesPane = function useIssuesPane() {
@@ -3878,12 +3873,16 @@ var TafModuleContext = /*#__PURE__*/React.createContext({
3878
3873
  onValidateForm: null,
3879
3874
  registerValidateForm: null,
3880
3875
  tafAction: null,
3881
- setTafAction: null
3876
+ setTafAction: null,
3877
+ isFormDirty: null,
3878
+ setIsFormDirty: null
3882
3879
  });
3883
3880
  var useTafModuleContext = function useTafModuleContext() {
3884
3881
  return React.useContext(TafModuleContext);
3885
3882
  };
3886
- var useTafModuleState = function useTafModuleState() {
3883
+ var useTafModuleState = function useTafModuleState(_ref) {
3884
+ var onPreventCloseView = _ref.onPreventCloseView;
3885
+
3887
3886
  var _React$useState = React.useState(function () {
3888
3887
  return new Promise(function () {
3889
3888
  return true;
@@ -3898,22 +3897,40 @@ var useTafModuleState = function useTafModuleState() {
3898
3897
  tafAction = _React$useState4[0],
3899
3898
  setTafAction = _React$useState4[1];
3900
3899
 
3900
+ var _React$useState5 = React.useState(false),
3901
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
3902
+ isFormDirty = _React$useState6[0],
3903
+ setIsFormDirty = _React$useState6[1];
3904
+
3901
3905
  var onRegisterValidateForm = function onRegisterValidateForm(promiseToRegister) {
3902
3906
  registerValidateForm(function () {
3903
3907
  return promiseToRegister;
3904
3908
  });
3905
3909
  };
3906
3910
 
3911
+ var onChangeFormDirty = function onChangeFormDirty(isDirty) {
3912
+ if (isDirty !== isFormDirty) {
3913
+ setIsFormDirty(isDirty);
3914
+ onPreventCloseView(isDirty);
3915
+ }
3916
+ };
3917
+
3907
3918
  return {
3908
3919
  onValidateForm: onValidateForm,
3909
3920
  registerValidateForm: onRegisterValidateForm,
3910
3921
  tafAction: tafAction,
3911
- setTafAction: setTafAction
3922
+ setTafAction: setTafAction,
3923
+ isFormDirty: isFormDirty,
3924
+ setIsFormDirty: onChangeFormDirty
3912
3925
  };
3913
3926
  };
3914
- var TafModuleProvider = function TafModuleProvider(_ref) {
3915
- var children = _ref.children;
3916
- var contextState = useTafModuleState();
3927
+ var TafModuleProvider = function TafModuleProvider(_ref2) {
3928
+ var children = _ref2.children,
3929
+ _ref2$onPreventCloseV = _ref2.onPreventCloseView,
3930
+ onPreventCloseView = _ref2$onPreventCloseV === void 0 ? function () {} : _ref2$onPreventCloseV;
3931
+ var contextState = useTafModuleState({
3932
+ onPreventCloseView: onPreventCloseView
3933
+ });
3917
3934
  return /*#__PURE__*/React.createElement(TafModuleContext.Provider, {
3918
3935
  value: contextState
3919
3936
  }, children);
@@ -3927,10 +3944,6 @@ var TafForm = function TafForm(_ref) {
3927
3944
  onFormAction = _ref$onFormAction === void 0 ? function () {
3928
3945
  return null;
3929
3946
  } : _ref$onFormAction,
3930
- _ref$onFormDirty = _ref.onFormDirty,
3931
- onFormDirty = _ref$onFormDirty === void 0 ? function () {
3932
- return null;
3933
- } : _ref$onFormDirty,
3934
3947
  _ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
3935
3948
  isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
3936
3949
  _ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
@@ -3947,14 +3960,15 @@ var TafForm = function TafForm(_ref) {
3947
3960
  var isDefaultDisabled = getIsFormDefaultDisabled(tafFromBackend.taf.status);
3948
3961
  var confirmDialog = useConfirmationDialog();
3949
3962
 
3950
- var _useDraftFormHelpers = useDraftFormHelpers(),
3963
+ var _useDraftFormHelpers = useDraftFormHelpers(true),
3951
3964
  toggleIsDraft = _useDraftFormHelpers.toggleIsDraft,
3952
3965
  DraftFieldHelper = _useDraftFormHelpers.DraftFieldHelper;
3953
3966
 
3954
3967
  var _useTafModuleContext = useTafModuleContext(),
3955
3968
  registerValidateForm = _useTafModuleContext.registerValidateForm,
3956
3969
  tafAction = _useTafModuleContext.tafAction,
3957
- setTafAction = _useTafModuleContext.setTafAction;
3970
+ setTafAction = _useTafModuleContext.setTafAction,
3971
+ setIsFormDirty = _useTafModuleContext.setIsFormDirty;
3958
3972
 
3959
3973
  var _useApiContext = useApiContext(),
3960
3974
  api = _useApiContext.api;
@@ -4008,8 +4022,8 @@ var TafForm = function TafForm(_ref) {
4008
4022
  }, [hasErrors]); // Needed to be able to show a confirmation dialog on switching tabs when form is edited and not saved
4009
4023
 
4010
4024
  React__default.useEffect(function () {
4011
- onFormDirty(isFormDirty);
4012
- }, [isFormDirty, onFormDirty]);
4025
+ setIsFormDirty(isFormDirty);
4026
+ }, [isFormDirty, setIsFormDirty]);
4013
4027
 
4014
4028
  var onSubmit = function onSubmit(data) {
4015
4029
  // eslint-disable-next-line no-console
@@ -4238,6 +4252,11 @@ var TafForm = function TafForm(_ref) {
4238
4252
  reset({});
4239
4253
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
4240
4254
  }, []);
4255
+ React__default.useEffect(function () {
4256
+ var newValues = prepareTafValues(tafFromBackend.taf, undefined, !isDefaultDisabled && !tafFromBackend.taf.changeGroups); // set new form values when tafFromBackend changed
4257
+
4258
+ reset(newValues); // eslint-disable-next-line react-hooks/exhaustive-deps
4259
+ }, [tafFromBackend]);
4241
4260
  React__default.useEffect(function () {
4242
4261
  if (shouldValidate && !isDisabled) {
4243
4262
  // trigger validation on all changegroup validity times after initial load since they could be outside the new validity period
@@ -4523,21 +4542,6 @@ var muiTabA11yProps = function muiTabA11yProps(index) {
4523
4542
  'aria-controls': "simple-tabpanel-".concat(index)
4524
4543
  };
4525
4544
  };
4526
- var emptyBaseForecast = {
4527
- wind: '',
4528
- visibility: '',
4529
- weather: {
4530
- weather1: '',
4531
- weather2: '',
4532
- weather3: ''
4533
- },
4534
- cloud: {
4535
- cloud1: '',
4536
- cloud2: '',
4537
- cloud3: '',
4538
- cloud4: ''
4539
- }
4540
- };
4541
4545
  var prepareTafExportValues = function prepareTafExportValues(tafToCopy, currentTaf) {
4542
4546
  var _a;
4543
4547
 
@@ -5214,47 +5218,48 @@ var usePostTafRequest = function usePostTafRequest(request) {
5214
5218
  switch (_context.prev = _context.next) {
5215
5219
  case 0:
5216
5220
  setLoading(true);
5217
- _context.prev = 1;
5218
- _context.next = 4;
5221
+ setError(null);
5222
+ _context.prev = 2;
5223
+ _context.next = 5;
5219
5224
  return request(params);
5220
5225
 
5221
- case 4:
5226
+ case 5:
5222
5227
  if (isMounted.current) {
5223
- _context.next = 6;
5228
+ _context.next = 7;
5224
5229
  break;
5225
5230
  }
5226
5231
 
5227
5232
  return _context.abrupt("return");
5228
5233
 
5229
- case 6:
5234
+ case 7:
5230
5235
  setLoading(false);
5231
5236
  setError(null);
5232
- _context.next = 18;
5237
+ _context.next = 19;
5233
5238
  break;
5234
5239
 
5235
- case 10:
5236
- _context.prev = 10;
5237
- _context.t0 = _context["catch"](1);
5240
+ case 11:
5241
+ _context.prev = 11;
5242
+ _context.t0 = _context["catch"](2);
5238
5243
 
5239
5244
  if (isMounted.current) {
5240
- _context.next = 14;
5245
+ _context.next = 15;
5241
5246
  break;
5242
5247
  }
5243
5248
 
5244
5249
  return _context.abrupt("return");
5245
5250
 
5246
- case 14:
5251
+ case 15:
5247
5252
  newErrorr = errorParser ? errorParser(_context.t0, params) : _context.t0;
5248
5253
  setLoading(false);
5249
5254
  setError(newErrorr);
5250
5255
  throw newErrorr;
5251
5256
 
5252
- case 18:
5257
+ case 19:
5253
5258
  case "end":
5254
5259
  return _context.stop();
5255
5260
  }
5256
5261
  }
5257
- }, _callee, null, [[1, 10]]);
5262
+ }, _callee, null, [[2, 11]]);
5258
5263
  }));
5259
5264
  };
5260
5265
 
@@ -5276,10 +5281,6 @@ var TafPanel = function TafPanel(_ref) {
5276
5281
  postTaf = _ref$postTaf === void 0 ? function () {
5277
5282
  return null;
5278
5283
  } : _ref$postTaf,
5279
- _ref$onFormDirty = _ref.onFormDirty,
5280
- onFormDirty = _ref$onFormDirty === void 0 ? function () {
5281
- return null;
5282
- } : _ref$onFormDirty,
5283
5284
  _ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
5284
5285
  isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
5285
5286
  _ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
@@ -5353,16 +5354,21 @@ var TafPanel = function TafPanel(_ref) {
5353
5354
  severity: "error",
5354
5355
  title: error.title,
5355
5356
  info: error.message,
5356
- dataTestId: "taf-error"
5357
- }), /*#__PURE__*/React__default.createElement(TafForm, {
5357
+ dataTestId: "taf-error",
5358
+ shouldClose: true
5359
+ }), /*#__PURE__*/React__default.createElement(Box, {
5360
+ sx: {
5361
+ marginTop: '10px',
5362
+ padding: 1
5363
+ }
5364
+ }, /*#__PURE__*/React__default.createElement(TafForm, {
5358
5365
  tafFromBackend: tafFromBackend,
5359
5366
  onFormAction: onTafAction,
5360
- onFormDirty: onFormDirty,
5361
5367
  isIssuesPaneOpen: isIssuesPaneOpen,
5362
5368
  setIsIssuesPaneOpen: setIsIssuesPaneOpen,
5363
5369
  isDisabled: isFormDisabled,
5364
5370
  setIsDisabled: setIsFormDisabled
5365
- }));
5371
+ })));
5366
5372
  };
5367
5373
 
5368
5374
  /* *
@@ -5423,7 +5429,8 @@ var TafLayout = function TafLayout(_ref) {
5423
5429
 
5424
5430
  var _useTafModuleContext = useTafModuleContext(),
5425
5431
  onValidateForm = _useTafModuleContext.onValidateForm,
5426
- tafAction = _useTafModuleContext.tafAction;
5432
+ tafAction = _useTafModuleContext.tafAction,
5433
+ isFormDirty = _useTafModuleContext.isFormDirty;
5427
5434
 
5428
5435
  var _React$useState = React__default.useState(sortTafTimeSlots(tafList)),
5429
5436
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -5454,13 +5461,8 @@ var TafLayout = function TafLayout(_ref) {
5454
5461
 
5455
5462
  var _React$useState9 = React__default.useState(false),
5456
5463
  _React$useState10 = _slicedToArray(_React$useState9, 2),
5457
- isFormDirty = _React$useState10[0],
5458
- setIsFormDirty = _React$useState10[1];
5459
-
5460
- var _React$useState11 = React__default.useState(false),
5461
- _React$useState12 = _slicedToArray(_React$useState11, 2),
5462
- isFormDisabled = _React$useState12[0],
5463
- setIsFormDisabled = _React$useState12[1];
5464
+ isFormDisabled = _React$useState10[0],
5465
+ setIsFormDisabled = _React$useState10[1];
5464
5466
 
5465
5467
  var postTaf = function postTaf(data) {
5466
5468
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
@@ -5518,16 +5520,18 @@ var TafLayout = function TafLayout(_ref) {
5518
5520
  _context2.t0 = _context2["catch"](1);
5519
5521
  confirmDialog(CONFIRM_DIALOG_OPTIONS).then(function () {
5520
5522
  action(value);
5523
+ setError(null);
5521
5524
  });
5522
5525
 
5523
5526
  case 13:
5524
- _context2.next = 16;
5527
+ _context2.next = 17;
5525
5528
  break;
5526
5529
 
5527
5530
  case 15:
5528
5531
  action(value);
5532
+ setError(null);
5529
5533
 
5530
- case 16:
5534
+ case 17:
5531
5535
  case "end":
5532
5536
  return _context2.stop();
5533
5537
  }
@@ -5646,8 +5650,6 @@ var TafLayout = function TafLayout(_ref) {
5646
5650
  }, /*#__PURE__*/React__default.createElement(Card, {
5647
5651
  variant: "outlined",
5648
5652
  sx: {
5649
- padding: 1,
5650
- paddingTop: 0,
5651
5653
  marginBottom: '12px',
5652
5654
  position: 'relative'
5653
5655
  }
@@ -5662,7 +5664,6 @@ var TafLayout = function TafLayout(_ref) {
5662
5664
  activeTafIndex: activeTafIndex,
5663
5665
  index: index,
5664
5666
  tafFromBackend: tafFromBackend,
5665
- onFormDirty: setIsFormDirty,
5666
5667
  isIssuesPaneOpen: isIssuesPaneOpen,
5667
5668
  setIsIssuesPaneOpen: onToggleIssuesPane,
5668
5669
  isFormDisabled: isFormDisabled,
@@ -5673,13 +5674,15 @@ var TafLayout = function TafLayout(_ref) {
5673
5674
  });
5674
5675
  }))), /*#__PURE__*/React__default.createElement(Grid, {
5675
5676
  item: true,
5676
- xs: 3,
5677
- sx: {
5678
- height: '100%'
5677
+ xs: 0,
5678
+ sm: 3,
5679
+ height: {
5680
+ xs: 0,
5681
+ sm: '100%'
5679
5682
  },
5680
- display: {
5681
- xs: 'none',
5682
- sm: 'block'
5683
+ width: {
5684
+ xs: 0,
5685
+ sm: '100%'
5683
5686
  }
5684
5687
  }, /*#__PURE__*/React__default.createElement(TacOverview, {
5685
5688
  upcomingTafs: upcoming,
@@ -5694,26 +5697,11 @@ var TafLayout = function TafLayout(_ref) {
5694
5697
  }));
5695
5698
  };
5696
5699
 
5697
- /* *
5698
- * Licensed under the Apache License, Version 2.0 (the "License");
5699
- * you may not use this file except in compliance with the License.
5700
- * You may obtain a copy of the License at
5701
- *
5702
- * http://www.apache.org/licenses/LICENSE-2.0
5703
- *
5704
- * Unless required by applicable law or agreed to in writing, software
5705
- * distributed under the License is distributed on an "AS IS" BASIS,
5706
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5707
- * See the License for the specific language governing permissions and
5708
- * limitations under the License.
5709
- *
5710
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5711
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
5712
- * */
5700
+ var TafWrapper = function TafWrapper(_a) {
5701
+ var children = _a.children,
5702
+ props = __rest(_a, ["children"]);
5713
5703
 
5714
- var TafWrapper = function TafWrapper(_ref) {
5715
- var children = _ref.children;
5716
- return /*#__PURE__*/React.createElement(TafModuleProvider, null, /*#__PURE__*/React.createElement(ConfirmationServiceProvider, null, /*#__PURE__*/React.createElement(ReactHookFormProvider, {
5704
+ return /*#__PURE__*/React.createElement(TafModuleProvider, Object.assign({}, props), /*#__PURE__*/React.createElement(ConfirmationServiceProvider, null, /*#__PURE__*/React.createElement(ReactHookFormProvider, {
5717
5705
  options: {
5718
5706
  mode: 'onTouched',
5719
5707
  reValidateMode: 'onChange',
@@ -5795,15 +5783,17 @@ var TafModule = function TafModule() {
5795
5783
  }), hasTafListError && /*#__PURE__*/React.createElement(AlertBanner, {
5796
5784
  severity: "error",
5797
5785
  title: "An error has occurred while retrieving the list",
5798
- info: getTafListError.message
5786
+ info: getTafListError.message,
5787
+ dataTestId: "taf-list-error",
5788
+ shouldClose: true
5799
5789
  }), /*#__PURE__*/React.createElement(TafLayout, {
5800
5790
  tafList: tafList,
5801
5791
  onPostTaf: reFetchNewTafList
5802
5792
  }));
5803
5793
  };
5804
5794
 
5805
- var Wrapper = function Wrapper() {
5806
- return /*#__PURE__*/React.createElement(TafWrapper, null, /*#__PURE__*/React.createElement(TafModule, null));
5795
+ var Wrapper = function Wrapper(props) {
5796
+ return /*#__PURE__*/React.createElement(TafWrapper, Object.assign({}, props), /*#__PURE__*/React.createElement(TafModule, null));
5807
5797
  };
5808
5798
 
5809
5799
  /* *
@@ -6805,4 +6795,85 @@ var createApi = function createApi() {
6805
6795
  };
6806
6796
  };
6807
6797
 
6808
- export { TafForm, Wrapper as TafModule, createApi$1 as createApi, createApi as createFakeApi };
6798
+ /* *
6799
+ * Licensed under the Apache License, Version 2.0 (the "License");
6800
+ * you may not use this file except in compliance with the License.
6801
+ * You may obtain a copy of the License at
6802
+ *
6803
+ * http://www.apache.org/licenses/LICENSE-2.0
6804
+ *
6805
+ * Unless required by applicable law or agreed to in writing, software
6806
+ * distributed under the License is distributed on an "AS IS" BASIS,
6807
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6808
+ * See the License for the specific language governing permissions and
6809
+ * limitations under the License.
6810
+ *
6811
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
6812
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
6813
+ * */
6814
+ var tafScreenPreset = {
6815
+ id: 'screenConfigTaf',
6816
+ title: 'TAF',
6817
+ views: {
6818
+ byId: {
6819
+ taf: {
6820
+ title: 'TAF',
6821
+ componentType: 'TafModule',
6822
+ initialProps: {}
6823
+ }
6824
+ },
6825
+ allIds: ['taf']
6826
+ },
6827
+ syncGroups: [],
6828
+ mosaicNode: 'taf'
6829
+ };
6830
+ var TafApiWrapper = function TafApiWrapper(_ref) {
6831
+ var config = _ref.config,
6832
+ auth = _ref.auth,
6833
+ onSetAuth = _ref.onSetAuth,
6834
+ onPreventCloseView = _ref.onPreventCloseView;
6835
+ return config ? /*#__PURE__*/React.createElement(ApiProvider, {
6836
+ baseURL: config.baseUrl,
6837
+ appURL: config.appUrl,
6838
+ auth: auth,
6839
+ onSetAuth: onSetAuth,
6840
+ createApi: createApi$1,
6841
+ authTokenUrl: config.authTokenUrl,
6842
+ authClientId: config.authClientId
6843
+ }, /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(Wrapper, {
6844
+ onPreventCloseView: onPreventCloseView
6845
+ }))) : null;
6846
+ };
6847
+ var componentsLookUp = function componentsLookUp(payload, _ref2) {
6848
+ var config = _ref2.config,
6849
+ auth = _ref2.auth,
6850
+ onSetAuth = _ref2.onSetAuth;
6851
+ var ConnectedModuleWrapper = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
6852
+ var componentType = payload.componentType;
6853
+
6854
+ switch (componentType) {
6855
+ case 'TafModule':
6856
+ if (ConnectedModuleWrapper) {
6857
+ return /*#__PURE__*/React.createElement(ConnectedModuleWrapper, {
6858
+ component: TafApiWrapper,
6859
+ payload: payload,
6860
+ "data-testid": "tafmodule",
6861
+ config: config,
6862
+ auth: auth,
6863
+ onSetAuth: onSetAuth
6864
+ });
6865
+ }
6866
+
6867
+ return /*#__PURE__*/React.createElement(TafApiWrapper, {
6868
+ "data-testid": "tafmodule",
6869
+ config: config,
6870
+ auth: auth,
6871
+ onSetAuth: onSetAuth
6872
+ });
6873
+
6874
+ default:
6875
+ return null;
6876
+ }
6877
+ };
6878
+
6879
+ export { TafApiWrapper, TafForm, Wrapper as TafModule, componentsLookUp, createApi$1 as createApi, createApi as createFakeApi, tafScreenPreset };