@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.umd.js CHANGED
@@ -1994,6 +1994,22 @@
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 ? moment__default["default"](issueDate).utc().format('DDHHmm') + "Z" : 'Not issued';
1999
2015
  };
@@ -2302,11 +2318,7 @@
2302
2318
  var tacHasError = function tacHasError(tac) {
2303
2319
  return tac === TAC_MISSING_DATA || tac === TAC_NOT_AVAILABLE || tac === TAC_RETRIEVING_DATA || tac === TAC_FAILED;
2304
2320
  };
2305
- var useTACGenerator = function useTACGenerator(taf, requestTAC, standardTAC) {
2306
- if (standardTAC === void 0) {
2307
- standardTAC = '';
2308
- }
2309
-
2321
+ var useTACGenerator = function useTACGenerator(taf, requestTAC) {
2310
2322
  var _a = __read(React__default["default"].useState(taf.status === 'NEW' ? TAC_NOT_AVAILABLE : TAC_RETRIEVING_DATA), 2),
2311
2323
  TAC = _a[0],
2312
2324
  setTAC = _a[1];
@@ -2328,16 +2340,11 @@
2328
2340
  }
2329
2341
  }, [isMounted, requestTAC]);
2330
2342
  React__default["default"].useEffect(function () {
2331
- if (taf.status !== 'NEW' && !standardTAC) {
2343
+ if (taf.status !== 'NEW') {
2332
2344
  retrieveTAC(taf);
2333
2345
  } // eslint-disable-next-line react-hooks/exhaustive-deps
2334
2346
 
2335
2347
  }, []);
2336
- React__default["default"].useEffect(function () {
2337
- if (standardTAC !== '') {
2338
- setTAC(standardTAC);
2339
- }
2340
- }, [standardTAC]);
2341
2348
  return [TAC, retrieveTAC];
2342
2349
  };
2343
2350
  var useDragOrder = function useDragOrder(trigger, move, onFormBlur) {
@@ -2530,7 +2537,7 @@
2530
2537
  var taf = tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND' || tafAction === 'CORRECT' || tafAction === 'DRAFT_CORRECT' ? getAmendedCorrectedTafTimes(_taf, tafAction) : _taf;
2531
2538
  return __assign(__assign(__assign(__assign({}, taf), {
2532
2539
  messageType: getMessageType(taf, tafAction),
2533
- baseForecast: formatFormValues(taf.baseForecast)
2540
+ baseForecast: __assign(__assign({}, emptyBaseForecast), formatFormValues(taf.baseForecast))
2534
2541
  }), taf.changeGroups && {
2535
2542
  changeGroups: taf.changeGroups.map(formatFormValues)
2536
2543
  }), addEmptyChangeGroup && {
@@ -2916,7 +2923,7 @@
2916
2923
  getValues = _g.getValues,
2917
2924
  trigger = _g.trigger;
2918
2925
 
2919
- var isNotRequiredForAction = shared.useDraftFormHelpers().isRequired; // cross-field required validation
2926
+ var isNotRequiredForAction = shared.useDraftFormHelpers(true).isRequired; // cross-field required validation
2920
2927
 
2921
2928
  var _h = __read(getRequiredCrossFields(fieldNames), 3),
2922
2929
  mainFields = _h[0],
@@ -3723,20 +3730,6 @@
3723
3730
  }
3724
3731
  };
3725
3732
 
3726
- var getErrorDefaultMessage = function getErrorDefaultMessage(error) {
3727
- switch (error.type) {
3728
- case 'required':
3729
- {
3730
- return 'this field is required';
3731
- }
3732
-
3733
- default:
3734
- {
3735
- return error.message;
3736
- }
3737
- }
3738
- };
3739
-
3740
3733
  var capitalizeWord = function capitalizeWord(_a) {
3741
3734
  var _b = __read(_a),
3742
3735
  firstLetter = _b[0],
@@ -3772,7 +3765,7 @@
3772
3765
  firstNamePart = _a[0];
3773
3766
 
3774
3767
  var fieldErrorTitle = humanizeErrorMessage(firstNamePart);
3775
- return index + 1 + ". " + fieldErrorTitle + ": " + getErrorDefaultMessage(error);
3768
+ return index + 1 + ". " + fieldErrorTitle + ": " + error.message;
3776
3769
  };
3777
3770
  var MODAL_DIALOG_ELEMENT = 'modal-dialog';
3778
3771
  var useIssuesPane = function useIssuesPane() {
@@ -3855,23 +3848,31 @@
3855
3848
  onValidateForm: null,
3856
3849
  registerValidateForm: null,
3857
3850
  tafAction: null,
3858
- setTafAction: null
3851
+ setTafAction: null,
3852
+ isFormDirty: null,
3853
+ setIsFormDirty: null
3859
3854
  });
3860
3855
  var useTafModuleContext = function useTafModuleContext() {
3861
3856
  return React__namespace.useContext(TafModuleContext);
3862
3857
  };
3863
- var useTafModuleState = function useTafModuleState() {
3864
- var _a = __read(React__namespace.useState(function () {
3858
+ var useTafModuleState = function useTafModuleState(_a) {
3859
+ var onPreventCloseView = _a.onPreventCloseView;
3860
+
3861
+ var _b = __read(React__namespace.useState(function () {
3865
3862
  return new Promise(function () {
3866
3863
  return true;
3867
3864
  });
3868
3865
  }), 2),
3869
- onValidateForm = _a[0],
3870
- registerValidateForm = _a[1];
3866
+ onValidateForm = _b[0],
3867
+ registerValidateForm = _b[1];
3868
+
3869
+ var _c = __read(React__namespace.useState(), 2),
3870
+ tafAction = _c[0],
3871
+ setTafAction = _c[1];
3871
3872
 
3872
- var _b = __read(React__namespace.useState(), 2),
3873
- tafAction = _b[0],
3874
- setTafAction = _b[1];
3873
+ var _d = __read(React__namespace.useState(false), 2),
3874
+ isFormDirty = _d[0],
3875
+ setIsFormDirty = _d[1];
3875
3876
 
3876
3877
  var onRegisterValidateForm = function onRegisterValidateForm(promiseToRegister) {
3877
3878
  registerValidateForm(function () {
@@ -3879,16 +3880,29 @@
3879
3880
  });
3880
3881
  };
3881
3882
 
3883
+ var onChangeFormDirty = function onChangeFormDirty(isDirty) {
3884
+ if (isDirty !== isFormDirty) {
3885
+ setIsFormDirty(isDirty);
3886
+ onPreventCloseView(isDirty);
3887
+ }
3888
+ };
3889
+
3882
3890
  return {
3883
3891
  onValidateForm: onValidateForm,
3884
3892
  registerValidateForm: onRegisterValidateForm,
3885
3893
  tafAction: tafAction,
3886
- setTafAction: setTafAction
3894
+ setTafAction: setTafAction,
3895
+ isFormDirty: isFormDirty,
3896
+ setIsFormDirty: onChangeFormDirty
3887
3897
  };
3888
3898
  };
3889
3899
  var TafModuleProvider = function TafModuleProvider(_a) {
3890
- var children = _a.children;
3891
- var contextState = useTafModuleState();
3900
+ var children = _a.children,
3901
+ _b = _a.onPreventCloseView,
3902
+ onPreventCloseView = _b === void 0 ? function () {} : _b;
3903
+ var contextState = useTafModuleState({
3904
+ onPreventCloseView: onPreventCloseView
3905
+ });
3892
3906
  return /*#__PURE__*/React__namespace.createElement(TafModuleContext.Provider, {
3893
3907
  value: contextState
3894
3908
  }, children);
@@ -3902,59 +3916,56 @@
3902
3916
  onFormAction = _b === void 0 ? function () {
3903
3917
  return null;
3904
3918
  } : _b,
3905
- _c = _a.onFormDirty,
3906
- onFormDirty = _c === void 0 ? function () {
3907
- return null;
3908
- } : _c,
3909
- _d = _a.isIssuesPaneOpen,
3910
- isIssuesPaneOpen = _d === void 0 ? false : _d,
3911
- _e = _a.setIsIssuesPaneOpen,
3912
- setIsIssuesPaneOpen = _e === void 0 ? function () {
3919
+ _c = _a.isIssuesPaneOpen,
3920
+ isIssuesPaneOpen = _c === void 0 ? false : _c,
3921
+ _d = _a.setIsIssuesPaneOpen,
3922
+ setIsIssuesPaneOpen = _d === void 0 ? function () {
3913
3923
  return null;
3914
- } : _e,
3915
- _f = _a.isDisabled,
3916
- isDisabled = _f === void 0 ? false : _f,
3917
- _g = _a.setIsDisabled,
3918
- setIsDisabled = _g === void 0 ? function () {
3924
+ } : _d,
3925
+ _e = _a.isDisabled,
3926
+ isDisabled = _e === void 0 ? false : _e,
3927
+ _f = _a.setIsDisabled,
3928
+ setIsDisabled = _f === void 0 ? function () {
3919
3929
  return null;
3920
- } : _g;
3930
+ } : _f;
3921
3931
  var originalTaf = tafFromBackend.taf;
3922
3932
  var isDefaultDisabled = getIsFormDefaultDisabled(tafFromBackend.taf.status);
3923
3933
  var confirmDialog = shared.useConfirmationDialog();
3924
3934
 
3925
- var _h = shared.useDraftFormHelpers(),
3926
- toggleIsDraft = _h.toggleIsDraft,
3927
- DraftFieldHelper = _h.DraftFieldHelper;
3935
+ var _g = shared.useDraftFormHelpers(true),
3936
+ toggleIsDraft = _g.toggleIsDraft,
3937
+ DraftFieldHelper = _g.DraftFieldHelper;
3928
3938
 
3929
- var _j = useTafModuleContext(),
3930
- registerValidateForm = _j.registerValidateForm,
3931
- tafAction = _j.tafAction,
3932
- setTafAction = _j.setTafAction;
3939
+ var _h = useTafModuleContext(),
3940
+ registerValidateForm = _h.registerValidateForm,
3941
+ tafAction = _h.tafAction,
3942
+ setTafAction = _h.setTafAction,
3943
+ setIsFormDirty = _h.setIsFormDirty;
3933
3944
 
3934
3945
  var api$1 = api.useApiContext().api;
3935
3946
  var isMounted = shared.useIsMounted().isMounted;
3936
3947
 
3937
- var _k = reactHookForm.useFormContext(),
3938
- control = _k.control,
3939
- handleSubmit = _k.handleSubmit,
3940
- trigger = _k.trigger,
3941
- formState = _k.formState,
3942
- getValues = _k.getValues,
3943
- setValue = _k.setValue,
3944
- reset = _k.reset;
3948
+ var _j = reactHookForm.useFormContext(),
3949
+ control = _j.control,
3950
+ handleSubmit = _j.handleSubmit,
3951
+ trigger = _j.trigger,
3952
+ formState = _j.formState,
3953
+ getValues = _j.getValues,
3954
+ setValue = _j.setValue,
3955
+ reset = _j.reset;
3945
3956
 
3946
3957
  var isFormDirty = formState.isDirty,
3947
3958
  errors = formState.errors;
3948
3959
  shared.usePreventBrowserClose(isFormDirty && !isDisabled);
3949
3960
  var hiddenInputFields = ['baseTime', 'issueDate', 'type', 'uuid', 'validDateStart', 'validDateEnd', 'status', 'previousId', 'previousValidDateStart', 'previousValidDateEnd'];
3950
3961
 
3951
- var _l = __read(React__default["default"].useState(getValues()), 2),
3952
- delayedFormValues = _l[0],
3953
- setDelayedFormValues = _l[1];
3962
+ var _k = __read(React__default["default"].useState(getValues()), 2),
3963
+ delayedFormValues = _k[0],
3964
+ setDelayedFormValues = _k[1];
3954
3965
 
3955
- var _m = __read(useTACGenerator(tafFromBackend.taf, api$1.getTAC), 2),
3956
- TAC = _m[0],
3957
- updateTAC = _m[1];
3966
+ var _l = __read(useTACGenerator(tafFromBackend.taf, api$1.getTAC), 2),
3967
+ TAC = _l[0],
3968
+ updateTAC = _l[1];
3958
3969
 
3959
3970
  var hasErrors = Object.keys(errors).length;
3960
3971
 
@@ -3978,8 +3989,8 @@
3978
3989
  }, [hasErrors]); // Needed to be able to show a confirmation dialog on switching tabs when form is edited and not saved
3979
3990
 
3980
3991
  React__default["default"].useEffect(function () {
3981
- onFormDirty(isFormDirty);
3982
- }, [isFormDirty, onFormDirty]);
3992
+ setIsFormDirty(isFormDirty);
3993
+ }, [isFormDirty, setIsFormDirty]);
3983
3994
 
3984
3995
  var onSubmit = function onSubmit(data) {
3985
3996
  // eslint-disable-next-line no-console
@@ -4098,19 +4109,19 @@
4098
4109
  }
4099
4110
  };
4100
4111
 
4101
- var _o = reactHookForm.useFieldArray({
4112
+ var _m = reactHookForm.useFieldArray({
4102
4113
  control: control,
4103
4114
  name: 'changeGroups'
4104
4115
  }),
4105
- fields = _o.fields,
4106
- insert = _o.insert,
4107
- remove = _o.remove,
4108
- move = _o.move;
4116
+ fields = _m.fields,
4117
+ insert = _m.insert,
4118
+ remove = _m.remove,
4119
+ move = _m.move;
4109
4120
 
4110
- var _p = useDragOrder(trigger, move, onFormBlur),
4111
- onChangeOrder = _p.onChangeOrder,
4112
- onStartDrag = _p.onStartDrag,
4113
- activeDraggingIndex = _p.activeDraggingIndex;
4121
+ var _o = useDragOrder(trigger, move, onFormBlur),
4122
+ onChangeOrder = _o.onChangeOrder,
4123
+ onStartDrag = _o.onStartDrag,
4124
+ activeDraggingIndex = _o.activeDraggingIndex;
4114
4125
 
4115
4126
  var onRemoverow = function onRemoverow(index) {
4116
4127
  confirmDialog({
@@ -4191,9 +4202,9 @@
4191
4202
  });
4192
4203
  };
4193
4204
 
4194
- var _q = __read(React__default["default"].useState(false), 2),
4195
- shouldValidate = _q[0],
4196
- setShouldValidate = _q[1];
4205
+ var _p = __read(React__default["default"].useState(false), 2),
4206
+ shouldValidate = _p[0],
4207
+ setShouldValidate = _p[1];
4197
4208
 
4198
4209
  React__default["default"].useEffect(function () {
4199
4210
  setIsDisabled(isDefaultDisabled);
@@ -4225,6 +4236,11 @@
4225
4236
  reset({});
4226
4237
  }; // eslint-disable-next-line react-hooks/exhaustive-deps
4227
4238
  }, []);
4239
+ React__default["default"].useEffect(function () {
4240
+ var newValues = prepareTafValues(tafFromBackend.taf, undefined, !isDefaultDisabled && !tafFromBackend.taf.changeGroups); // set new form values when tafFromBackend changed
4241
+
4242
+ reset(newValues); // eslint-disable-next-line react-hooks/exhaustive-deps
4243
+ }, [tafFromBackend]);
4228
4244
  React__default["default"].useEffect(function () {
4229
4245
  if (shouldValidate && !isDisabled) {
4230
4246
  // trigger validation on all changegroup validity times after initial load since they could be outside the new validity period
@@ -4516,21 +4532,6 @@
4516
4532
  'aria-controls': "simple-tabpanel-" + index
4517
4533
  };
4518
4534
  };
4519
- var emptyBaseForecast = {
4520
- wind: '',
4521
- visibility: '',
4522
- weather: {
4523
- weather1: '',
4524
- weather2: '',
4525
- weather3: ''
4526
- },
4527
- cloud: {
4528
- cloud1: '',
4529
- cloud2: '',
4530
- cloud3: '',
4531
- cloud4: ''
4532
- }
4533
- };
4534
4535
  var prepareTafExportValues = function prepareTafExportValues(tafToCopy, currentTaf) {
4535
4536
  var _a;
4536
4537
 
@@ -5183,6 +5184,7 @@
5183
5184
  switch (_a.label) {
5184
5185
  case 0:
5185
5186
  setLoading(true);
5187
+ setError(null);
5186
5188
  _a.label = 1;
5187
5189
 
5188
5190
  case 1:
@@ -5241,22 +5243,18 @@
5241
5243
  postTaf = _c === void 0 ? function () {
5242
5244
  return null;
5243
5245
  } : _c,
5244
- _d = _a.onFormDirty,
5245
- onFormDirty = _d === void 0 ? function () {
5246
- return null;
5247
- } : _d,
5248
- _e = _a.isIssuesPaneOpen,
5249
- isIssuesPaneOpen = _e === void 0 ? false : _e,
5250
- _f = _a.setIsIssuesPaneOpen,
5251
- setIsIssuesPaneOpen = _f === void 0 ? function () {
5246
+ _d = _a.isIssuesPaneOpen,
5247
+ isIssuesPaneOpen = _d === void 0 ? false : _d,
5248
+ _e = _a.setIsIssuesPaneOpen,
5249
+ setIsIssuesPaneOpen = _e === void 0 ? function () {
5252
5250
  return null;
5253
- } : _f,
5254
- _g = _a.isFormDisabled,
5255
- isFormDisabled = _g === void 0 ? false : _g,
5256
- _h = _a.setIsFormDisabled,
5257
- setIsFormDisabled = _h === void 0 ? function () {
5251
+ } : _e,
5252
+ _f = _a.isFormDisabled,
5253
+ isFormDisabled = _f === void 0 ? false : _f,
5254
+ _g = _a.setIsFormDisabled,
5255
+ setIsFormDisabled = _g === void 0 ? function () {
5258
5256
  return null;
5259
- } : _h,
5257
+ } : _g,
5260
5258
  error = _a.error;
5261
5259
 
5262
5260
  var onTafAction = function onTafAction(action, taf) {
@@ -5370,16 +5368,21 @@
5370
5368
  severity: "error",
5371
5369
  title: error.title,
5372
5370
  info: error.message,
5373
- dataTestId: "taf-error"
5374
- }), /*#__PURE__*/React__default["default"].createElement(TafForm, {
5371
+ dataTestId: "taf-error",
5372
+ shouldClose: true
5373
+ }), /*#__PURE__*/React__default["default"].createElement(material.Box, {
5374
+ sx: {
5375
+ marginTop: '10px',
5376
+ padding: 1
5377
+ }
5378
+ }, /*#__PURE__*/React__default["default"].createElement(TafForm, {
5375
5379
  tafFromBackend: tafFromBackend,
5376
5380
  onFormAction: onTafAction,
5377
- onFormDirty: onFormDirty,
5378
5381
  isIssuesPaneOpen: isIssuesPaneOpen,
5379
5382
  setIsIssuesPaneOpen: setIsIssuesPaneOpen,
5380
5383
  isDisabled: isFormDisabled,
5381
5384
  setIsDisabled: setIsFormDisabled
5382
- }));
5385
+ })));
5383
5386
  };
5384
5387
 
5385
5388
  var IssuesPaneWrapper = function IssuesPaneWrapper(props) {
@@ -5418,7 +5421,8 @@
5418
5421
 
5419
5422
  var _f = useTafModuleContext(),
5420
5423
  onValidateForm = _f.onValidateForm,
5421
- tafAction = _f.tafAction;
5424
+ tafAction = _f.tafAction,
5425
+ isFormDirty = _f.isFormDirty;
5422
5426
 
5423
5427
  var _g = __read(React__default["default"].useState(sortTafTimeSlots(tafList)), 2),
5424
5428
  _h = _g[0],
@@ -5443,12 +5447,8 @@
5443
5447
  setActiveTafIndex = _m[1];
5444
5448
 
5445
5449
  var _o = __read(React__default["default"].useState(false), 2),
5446
- isFormDirty = _o[0],
5447
- setIsFormDirty = _o[1];
5448
-
5449
- var _p = __read(React__default["default"].useState(false), 2),
5450
- isFormDisabled = _p[0],
5451
- setIsFormDisabled = _p[1];
5450
+ isFormDisabled = _o[0],
5451
+ setIsFormDisabled = _o[1];
5452
5452
 
5453
5453
  var postTaf = function postTaf(data) {
5454
5454
  return __awaiter(void 0, void 0, void 0, function () {
@@ -5511,6 +5511,7 @@
5511
5511
  _a.sent();
5512
5512
  confirmDialog(CONFIRM_DIALOG_OPTIONS).then(function () {
5513
5513
  action(value);
5514
+ setError(null);
5514
5515
  });
5515
5516
  return [3
5516
5517
  /*break*/
@@ -5523,6 +5524,7 @@
5523
5524
 
5524
5525
  case 6:
5525
5526
  action(value);
5527
+ setError(null);
5526
5528
  _a.label = 7;
5527
5529
 
5528
5530
  case 7:
@@ -5644,8 +5646,6 @@
5644
5646
  }, /*#__PURE__*/React__default["default"].createElement(material.Card, {
5645
5647
  variant: "outlined",
5646
5648
  sx: {
5647
- padding: 1,
5648
- paddingTop: 0,
5649
5649
  marginBottom: '12px',
5650
5650
  position: 'relative'
5651
5651
  }
@@ -5660,7 +5660,6 @@
5660
5660
  activeTafIndex: activeTafIndex,
5661
5661
  index: index,
5662
5662
  tafFromBackend: tafFromBackend,
5663
- onFormDirty: setIsFormDirty,
5664
5663
  isIssuesPaneOpen: isIssuesPaneOpen,
5665
5664
  setIsIssuesPaneOpen: onToggleIssuesPane,
5666
5665
  isFormDisabled: isFormDisabled,
@@ -5671,13 +5670,15 @@
5671
5670
  });
5672
5671
  }))), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
5673
5672
  item: true,
5674
- xs: 3,
5675
- sx: {
5676
- height: '100%'
5673
+ xs: 0,
5674
+ sm: 3,
5675
+ height: {
5676
+ xs: 0,
5677
+ sm: '100%'
5677
5678
  },
5678
- display: {
5679
- xs: 'none',
5680
- sm: 'block'
5679
+ width: {
5680
+ xs: 0,
5681
+ sm: '100%'
5681
5682
  }
5682
5683
  }, /*#__PURE__*/React__default["default"].createElement(TacOverview, {
5683
5684
  upcomingTafs: upcoming,
@@ -5692,26 +5693,11 @@
5692
5693
  }));
5693
5694
  };
5694
5695
 
5695
- /* *
5696
- * Licensed under the Apache License, Version 2.0 (the "License");
5697
- * you may not use this file except in compliance with the License.
5698
- * You may obtain a copy of the License at
5699
- *
5700
- * http://www.apache.org/licenses/LICENSE-2.0
5701
- *
5702
- * Unless required by applicable law or agreed to in writing, software
5703
- * distributed under the License is distributed on an "AS IS" BASIS,
5704
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5705
- * See the License for the specific language governing permissions and
5706
- * limitations under the License.
5707
- *
5708
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5709
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
5710
- * */
5711
-
5712
5696
  var TafWrapper = function TafWrapper(_a) {
5713
- var children = _a.children;
5714
- return /*#__PURE__*/React__namespace.createElement(TafModuleProvider, null, /*#__PURE__*/React__namespace.createElement(shared.ConfirmationServiceProvider, null, /*#__PURE__*/React__namespace.createElement(formFields.ReactHookFormProvider, {
5697
+ var children = _a.children,
5698
+ props = __rest(_a, ["children"]);
5699
+
5700
+ return /*#__PURE__*/React__namespace.createElement(TafModuleProvider, __assign({}, props), /*#__PURE__*/React__namespace.createElement(shared.ConfirmationServiceProvider, null, /*#__PURE__*/React__namespace.createElement(formFields.ReactHookFormProvider, {
5715
5701
  options: {
5716
5702
  mode: 'onTouched',
5717
5703
  reValidateMode: 'onChange',
@@ -5797,15 +5783,17 @@
5797
5783
  }), hasTafListError && /*#__PURE__*/React__namespace.createElement(shared.AlertBanner, {
5798
5784
  severity: "error",
5799
5785
  title: "An error has occurred while retrieving the list",
5800
- info: getTafListError.message
5786
+ info: getTafListError.message,
5787
+ dataTestId: "taf-list-error",
5788
+ shouldClose: true
5801
5789
  }), /*#__PURE__*/React__namespace.createElement(TafLayout, {
5802
5790
  tafList: tafList,
5803
5791
  onPostTaf: reFetchNewTafList
5804
5792
  }));
5805
5793
  };
5806
5794
 
5807
- var Wrapper = function Wrapper() {
5808
- return /*#__PURE__*/React__namespace.createElement(TafWrapper, null, /*#__PURE__*/React__namespace.createElement(TafModule, null));
5795
+ var Wrapper = function Wrapper(props) {
5796
+ return /*#__PURE__*/React__namespace.createElement(TafWrapper, __assign({}, props), /*#__PURE__*/React__namespace.createElement(TafModule, null));
5809
5797
  };
5810
5798
 
5811
5799
  var createApi$1 = function createApi(url, appUrl, auth, setAuth, authTokenUrl, authClientId) {
@@ -6788,10 +6776,100 @@
6788
6776
  };
6789
6777
  };
6790
6778
 
6779
+ /* *
6780
+ * Licensed under the Apache License, Version 2.0 (the "License");
6781
+ * you may not use this file except in compliance with the License.
6782
+ * You may obtain a copy of the License at
6783
+ *
6784
+ * http://www.apache.org/licenses/LICENSE-2.0
6785
+ *
6786
+ * Unless required by applicable law or agreed to in writing, software
6787
+ * distributed under the License is distributed on an "AS IS" BASIS,
6788
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6789
+ * See the License for the specific language governing permissions and
6790
+ * limitations under the License.
6791
+ *
6792
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
6793
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
6794
+ * */
6795
+ var tafScreenPreset = {
6796
+ id: 'screenConfigTaf',
6797
+ title: 'TAF',
6798
+ views: {
6799
+ byId: {
6800
+ taf: {
6801
+ title: 'TAF',
6802
+ componentType: 'TafModule',
6803
+ initialProps: {}
6804
+ }
6805
+ },
6806
+ allIds: ['taf']
6807
+ },
6808
+ syncGroups: [],
6809
+ mosaicNode: 'taf'
6810
+ };
6811
+ var TafApiWrapper = function TafApiWrapper(_a) {
6812
+ var config = _a.config,
6813
+ auth = _a.auth,
6814
+ onSetAuth = _a.onSetAuth,
6815
+ onPreventCloseView = _a.onPreventCloseView;
6816
+ return config ? /*#__PURE__*/React__namespace.createElement(api.ApiProvider, {
6817
+ baseURL: config.baseUrl,
6818
+ appURL: config.appUrl,
6819
+ auth: auth,
6820
+ onSetAuth: onSetAuth,
6821
+ createApi: createApi$1,
6822
+ authTokenUrl: config.authTokenUrl,
6823
+ authClientId: config.authClientId
6824
+ }, /*#__PURE__*/React__namespace.createElement(shared.ErrorBoundary, null, /*#__PURE__*/React__namespace.createElement(Wrapper, {
6825
+ onPreventCloseView: onPreventCloseView
6826
+ }))) : null;
6827
+ };
6828
+ var componentsLookUp = function componentsLookUp(payload, _a, // TODO: find a good way to type this module without the apps complaining
6829
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
6830
+ ConnectedModuleWrapper) {
6831
+ var config = _a.config,
6832
+ auth = _a.auth,
6833
+ onSetAuth = _a.onSetAuth;
6834
+
6835
+ if (ConnectedModuleWrapper === void 0) {
6836
+ ConnectedModuleWrapper = null;
6837
+ }
6838
+
6839
+ var componentType = payload.componentType;
6840
+
6841
+ switch (componentType) {
6842
+ case 'TafModule':
6843
+ if (ConnectedModuleWrapper) {
6844
+ return /*#__PURE__*/React__namespace.createElement(ConnectedModuleWrapper, {
6845
+ component: TafApiWrapper,
6846
+ payload: payload,
6847
+ "data-testid": "tafmodule",
6848
+ config: config,
6849
+ auth: auth,
6850
+ onSetAuth: onSetAuth
6851
+ });
6852
+ }
6853
+
6854
+ return /*#__PURE__*/React__namespace.createElement(TafApiWrapper, {
6855
+ "data-testid": "tafmodule",
6856
+ config: config,
6857
+ auth: auth,
6858
+ onSetAuth: onSetAuth
6859
+ });
6860
+
6861
+ default:
6862
+ return null;
6863
+ }
6864
+ };
6865
+
6866
+ exports.TafApiWrapper = TafApiWrapper;
6791
6867
  exports.TafForm = TafForm;
6792
6868
  exports.TafModule = Wrapper;
6869
+ exports.componentsLookUp = componentsLookUp;
6793
6870
  exports.createApi = createApi$1;
6794
6871
  exports.createFakeApi = createApi;
6872
+ exports.tafScreenPreset = tafScreenPreset;
6795
6873
 
6796
6874
  Object.defineProperty(exports, '__esModule', { value: true });
6797
6875
 
@@ -0,0 +1,34 @@
1
+ import * as React from 'react';
2
+ import { ApiUrls, Credentials } from '@opengeoweb/api';
3
+ export declare const tafScreenPreset: {
4
+ id: string;
5
+ title: string;
6
+ views: {
7
+ byId: {
8
+ taf: {
9
+ title: string;
10
+ componentType: string;
11
+ initialProps: {};
12
+ };
13
+ };
14
+ allIds: string[];
15
+ };
16
+ syncGroups: any[];
17
+ mosaicNode: string;
18
+ };
19
+ declare type TafComponentType = 'TafModule';
20
+ export interface ComponentsLookUpPayload {
21
+ componentType: TafComponentType;
22
+ id: string;
23
+ title?: string;
24
+ initialProps: Record<string, never>;
25
+ }
26
+ declare type ApiModuleProps = {
27
+ config: ApiUrls;
28
+ auth: Credentials;
29
+ onSetAuth: (credentias: Credentials) => void;
30
+ onPreventCloseView?: (shouldPreventClose: boolean) => void;
31
+ };
32
+ export declare const TafApiWrapper: React.FC<ApiModuleProps>;
33
+ export declare const componentsLookUp: (payload: ComponentsLookUpPayload, { config, auth, onSetAuth }: ApiModuleProps, ConnectedModuleWrapper?: any) => React.ReactElement;
34
+ export {};
@@ -0,0 +1 @@
1
+ export * from './ComponentsLookUp';