@opengeoweb/taf 9.16.0 → 9.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -17,6 +17,25 @@ import { useApiContext, createApiInstance, createFakeApiInstance, ApiProvider }
17
17
  import LinearProgress from '@mui/material/LinearProgress';
18
18
  import Box$1 from '@mui/material/Box';
19
19
 
20
+ var en = {
21
+ taf: "Taf"
22
+ };
23
+ var fi = {
24
+ taf: "Taf"
25
+ };
26
+ var no = {
27
+ taf: "Taf"
28
+ };
29
+ var nl = {
30
+ taf: "Taf"
31
+ };
32
+ var taf = {
33
+ en: en,
34
+ fi: fi,
35
+ no: no,
36
+ nl: nl
37
+ };
38
+
20
39
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
21
40
 
22
41
  var fails$p = function (exec) {
@@ -5630,11 +5649,7 @@ const validateFourthCloud = (firstCloudValue, secondCloudValue, thirdCloudValue,
5630
5649
  * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5631
5650
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
5632
5651
  * */
5633
- const DATE_FORMAT_YEAR = `yyyy-MM-dd'`;
5634
5652
  const DATE_FORMAT_ISSUE_TIME = `ddHHmm'Z`;
5635
- const DATE_FORMAT_FULL = "yyyy-MM-dd'T'HH:mm:ss'";
5636
- const DATE_FORMAT_HOURS = 'HH:mm';
5637
- const DATE_FORMAT_FULL_TIMEZONE = "yyyy-MM-dd'T'HH:mm:ss'Z";
5638
5653
  const DATE_FORMAT_BASE_TIME = 'HH:mm dd MMM';
5639
5654
 
5640
5655
  const emptyBaseForecast = {
@@ -6108,7 +6123,7 @@ const getAmendedCorrectedTafTimes = (taf, tafAction) => {
6108
6123
  const now = dateUtils.utc();
6109
6124
  const validDateStart = dateUtils.utc(taf.validDateStart);
6110
6125
  if ((tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND') && now.getTime() >= validDateStart.getTime()) {
6111
- const _now = dateUtils.dateToString(dateUtils.utc(), DATE_FORMAT_FULL_TIMEZONE);
6126
+ const _now = dateUtils.dateToString(dateUtils.utc(), dateUtils.DATE_FORMAT_UTC);
6112
6127
  const validObj = {
6113
6128
  start: _now,
6114
6129
  end: taf.baseForecast.valid.end
@@ -9165,7 +9180,7 @@ const TafWrapper = _a => {
9165
9180
  }, /*#__PURE__*/React.createElement(TafModuleProvider, Object.assign({}, props), children));
9166
9181
  };
9167
9182
 
9168
- const getCurrentDate = () => dateUtils.dateToString(dateUtils.utc(), DATE_FORMAT_HOURS);
9183
+ const getCurrentDate = () => dateUtils.dateToString(dateUtils.utc(), dateUtils.DATE_FORMAT_HOURS);
9169
9184
  const TafModule = () => {
9170
9185
  const {
9171
9186
  api
@@ -9267,10 +9282,10 @@ const createApi$1 = props => {
9267
9282
 
9268
9283
  // Used to mimic an authenticated user
9269
9284
  const MOCK_USERNAME = 'user.name';
9270
- const currentDate = dateUtils.dateToString(dateUtils.utc(), DATE_FORMAT_YEAR);
9285
+ const currentDate = dateUtils.dateToString(dateUtils.utc(), dateUtils.DATE_FORMAT_YEAR);
9271
9286
  const tomorrowDate = dateUtils.dateToString(dateUtils.add(dateUtils.utc(), {
9272
9287
  days: 1
9273
- }), DATE_FORMAT_YEAR);
9288
+ }), dateUtils.DATE_FORMAT_YEAR);
9274
9289
  const airportPeriod = 6;
9275
9290
  const airportValidity = 40;
9276
9291
  const validDateRange = (refHour, period) => {
@@ -9284,13 +9299,13 @@ const validDateRange = (refHour, period) => {
9284
9299
  const end = dateUtils.add(start, {
9285
9300
  hours: airportValidity
9286
9301
  });
9287
- return [dateUtils.dateToString(start, DATE_FORMAT_FULL, false), dateUtils.dateToString(end, DATE_FORMAT_FULL, false)];
9302
+ return [dateUtils.dateToString(start, dateUtils.DATE_FORMAT_UTC, false), dateUtils.dateToString(end, dateUtils.DATE_FORMAT_UTC, false)];
9288
9303
  };
9289
9304
  const dateAdd = (refDateAsString, hours) => {
9290
9305
  const newDate = dateUtils.add(dateUtils.utc(refDateAsString), {
9291
9306
  hours
9292
9307
  });
9293
- const formattedDate = dateUtils.dateToString(newDate, DATE_FORMAT_FULL);
9308
+ const formattedDate = dateUtils.dateToString(newDate, dateUtils.DATE_FORMAT_UTC);
9294
9309
  return formattedDate;
9295
9310
  };
9296
9311
  const [currentValidDateStart, currentValidDateEnd] = validDateRange(dateUtils.utc(), airportPeriod);
@@ -10386,4 +10401,4 @@ ConnectedModuleWrapper = null) => {
10386
10401
  }
10387
10402
  };
10388
10403
 
10389
- export { TafApiWrapper, TafForm, Wrapper as TafModule, componentsLookUp, createApi$1 as createApi, createApi as createFakeApi, tafScreenPreset };
10404
+ export { TafApiWrapper, TafForm, Wrapper as TafModule, componentsLookUp, createApi$1 as createApi, createApi as createFakeApi, tafScreenPreset, taf as tafTranslations };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/taf",
3
- "version": "9.16.0",
3
+ "version": "9.18.0",
4
4
  "description": "GeoWeb TAF library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -24,7 +24,9 @@
24
24
  "sortablejs": "^1.15.1",
25
25
  "@emotion/react": "^11.11.1",
26
26
  "lodash": "^4.17.21",
27
- "axios": "1.5.0"
27
+ "axios": "1.5.0",
28
+ "i18next": "^23.7.11",
29
+ "react-i18next": "^13.5.0"
28
30
  },
29
31
  "peerDependencies": {
30
32
  "react": "18",
package/src/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import tafTranslations from '../locales/taf.json';
1
2
  export * from './lib/components/TafForm';
2
3
  export * from './lib/components/TafModule';
3
4
  export { createApi } from './lib/utils/api';
4
5
  export { createApi as createFakeApi } from './lib/utils/fakeApi';
5
6
  export * from './lib/components/ComponentsLookUp';
7
+ export { tafTranslations };
@@ -9,6 +9,9 @@ export interface TafThemeApiProviderProps {
9
9
  theme?: Theme;
10
10
  store?: Store;
11
11
  }
12
+ interface TafTranslationWrapperProps {
13
+ children?: React.ReactNode;
14
+ }
12
15
  export declare const TafThemeApiProvider: React.FC<TafThemeApiProviderProps>;
13
16
  interface TafThemeFormProviderProps {
14
17
  children: React.ReactNode;
@@ -16,4 +19,6 @@ interface TafThemeFormProviderProps {
16
19
  theme?: Theme;
17
20
  }
18
21
  export declare const TafThemeFormProvider: React.FC<TafThemeFormProviderProps>;
22
+ export declare const TafTranslationsWrapper: React.FC<TafTranslationWrapperProps>;
23
+ export declare const TafI18nProvider: React.FC<TafTranslationWrapperProps>;
19
24
  export {};
@@ -1,6 +1,2 @@
1
- export declare const DATE_FORMAT_YEAR = "yyyy-MM-dd'";
2
1
  export declare const DATE_FORMAT_ISSUE_TIME = "ddHHmm'Z";
3
- export declare const DATE_FORMAT_FULL = "yyyy-MM-dd'T'HH:mm:ss'";
4
- export declare const DATE_FORMAT_HOURS = "HH:mm";
5
- export declare const DATE_FORMAT_FULL_TIMEZONE = "yyyy-MM-dd'T'HH:mm:ss'Z";
6
2
  export declare const DATE_FORMAT_BASE_TIME = "HH:mm dd MMM";
@@ -0,0 +1,2 @@
1
+ export declare const TAF_NAMESPACE = "taf";
2
+ export declare const initTafI18n: () => void;