@opengeoweb/authentication 9.15.0 → 9.16.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
@@ -8,6 +8,29 @@ import { ThemeWrapper } from '@opengeoweb/theme';
8
8
  import { useTranslation, Trans } from 'react-i18next';
9
9
  import 'i18next';
10
10
 
11
+ var en = {
12
+ "auth-logout-go-back-to-home-page": "Go back to the <1>Home Page</1>",
13
+ "auth-logout-you-are-logged-out": "You are logged out."
14
+ };
15
+ var fi = {
16
+ "auth-logout-go-back-to-home-page": "🚧 ei käännetty. Go back to the <1>Home Page</1>",
17
+ "auth-logout-you-are-logged-out": "🚧 ei käännetty"
18
+ };
19
+ var no = {
20
+ "auth-logout-go-back-to-home-page": "🚧 ikke oversatt. Go back to the <1>Home Page</1>",
21
+ "auth-logout-you-are-logged-out": "🚧 ikke oversatt"
22
+ };
23
+ var nl = {
24
+ "auth-logout-go-back-to-home-page": "🚧 niet vertaald. Go back to the <1>Home Page</1>",
25
+ "auth-logout-you-are-logged-out": "🚧 niet vertaald"
26
+ };
27
+ var authTranslations = {
28
+ en: en,
29
+ fi: fi,
30
+ no: no,
31
+ nl: nl
32
+ };
33
+
11
34
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
12
35
 
13
36
  var check = function (it) {
@@ -5832,29 +5855,6 @@ const OAuth2Login = () => {
5832
5855
  return null;
5833
5856
  };
5834
5857
 
5835
- var en = {
5836
- "auth-logout-go-back-to-home-page": "Go back to the <1>Home Page</1>",
5837
- "auth-logout-you-are-logged-out": "You are logged out."
5838
- };
5839
- var fi = {
5840
- "auth-logout-go-back-to-home-page": "🚧 ei käännetty. Go back to the <1>Home Page</1>",
5841
- "auth-logout-you-are-logged-out": "🚧 ei käännetty"
5842
- };
5843
- var no = {
5844
- "auth-logout-go-back-to-home-page": "🚧 ikke oversatt. Go back to the <1>Home Page</1>",
5845
- "auth-logout-you-are-logged-out": "🚧 ikke oversatt"
5846
- };
5847
- var nl = {
5848
- "auth-logout-go-back-to-home-page": "🚧 niet vertaald. Go back to the <1>Home Page</1>",
5849
- "auth-logout-you-are-logged-out": "🚧 niet vertaald"
5850
- };
5851
- var authTrans = {
5852
- en: en,
5853
- fi: fi,
5854
- no: no,
5855
- nl: nl
5856
- };
5857
-
5858
5858
  /* *
5859
5859
  * Licensed under the Apache License, Version 2.0 (the "License");
5860
5860
  * you may not use this file except in compliance with the License.
@@ -5873,21 +5873,6 @@ var authTrans = {
5873
5873
  * */
5874
5874
  const AUTH_NAMESPACE = 'auth';
5875
5875
 
5876
- const AuthTranslationsWrapper = ({
5877
- children
5878
- }) => {
5879
- const {
5880
- i18n
5881
- } = useTranslation();
5882
- React.useEffect(() => {
5883
- i18n.addResourceBundle('en', AUTH_NAMESPACE, authTrans.en);
5884
- i18n.addResourceBundle('fi', AUTH_NAMESPACE, authTrans.fi);
5885
- i18n.addResourceBundle('no', AUTH_NAMESPACE, authTrans.no);
5886
- i18n.addResourceBundle('nl', AUTH_NAMESPACE, authTrans.nl);
5887
- }, [i18n]);
5888
- return children;
5889
- };
5890
-
5891
5876
  const OAuth2Logout = () => {
5892
5877
  const {
5893
5878
  onSetAuth,
@@ -5909,23 +5894,21 @@ const OAuth2Logout = () => {
5909
5894
  window.location.assign(authConfig.GW_AUTH_LOGOUT_URL);
5910
5895
  }
5911
5896
  }, [isLoggedIn, onSetAuth, onLogin, sessionStorageProvider, authConfig.GW_AUTH_LOGOUT_URL]);
5912
- return showAlert ? jsx(AuthTranslationsWrapper, {
5913
- children: jsx(ThemeWrapper, {
5914
- children: jsx(AlertBanner, {
5915
- severity: "info",
5916
- title: t('auth-logout-you-are-logged-out'),
5917
- info: jsx("p", {
5918
- children: jsxs(Trans, Object.assign({
5919
- i18nKey: "auth-logout-go-back-to-home-page",
5920
- ns: AUTH_NAMESPACE
5897
+ return showAlert ? jsx(ThemeWrapper, {
5898
+ children: jsx(AlertBanner, {
5899
+ severity: "info",
5900
+ title: t('auth-logout-you-are-logged-out'),
5901
+ info: jsx("p", {
5902
+ children: jsxs(Trans, Object.assign({
5903
+ i18nKey: "auth-logout-go-back-to-home-page",
5904
+ ns: AUTH_NAMESPACE
5905
+ }, {
5906
+ children: ["Go back to the ", jsx(Link, Object.assign({
5907
+ to: "/"
5921
5908
  }, {
5922
- children: ["Go back to the ", jsx(Link, Object.assign({
5923
- to: "/"
5924
- }, {
5925
- children: "Home Page"
5926
- }))]
5927
- }))
5928
- })
5909
+ children: "Home Page"
5910
+ }))]
5911
+ }))
5929
5912
  })
5930
5913
  })
5931
5914
  }) : null;
@@ -5945,4 +5928,4 @@ const RequireAuth = ({
5945
5928
  });
5946
5929
  };
5947
5930
 
5948
- export { AuthenticationContext, AuthenticationProvider, HandleOAuth2Code as Code, OAuth2Login as Login, OAuth2Logout as Logout, RequireAuth, SessionStorageKey, getAuthConfig, getCodeChallenge, getCurrentUrlLocation, getRandomString, getSessionStorageProvider, useAuthenticationContext, useAuthenticationDefaultProps };
5931
+ export { AuthenticationContext, AuthenticationProvider, HandleOAuth2Code as Code, OAuth2Login as Login, OAuth2Logout as Logout, RequireAuth, SessionStorageKey, authTranslations, getAuthConfig, getCodeChallenge, getCurrentUrlLocation, getRandomString, getSessionStorageProvider, useAuthenticationContext, useAuthenticationDefaultProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/authentication",
3
- "version": "9.15.0",
3
+ "version": "9.16.0",
4
4
  "description": "GeoWeb authentication library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/src/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import authTranslations from '../locales/authentication.json';
1
2
  export { default as Code } from './lib/pages/Code';
2
3
  export { default as Login } from './lib/pages/Login';
3
4
  export { default as Logout } from './lib/pages/Logout';
@@ -5,3 +6,4 @@ export * from './lib/AuthenticationContext';
5
6
  export * from './lib/PrivateRoute';
6
7
  export * from './lib/utils/session';
7
8
  export * from './lib/utils/utils';
9
+ export { authTranslations };
@@ -2,6 +2,5 @@ import React from 'react';
2
2
  interface AuthTranslationWrapperProps {
3
3
  children?: React.ReactNode;
4
4
  }
5
- export declare const AuthTranslationsWrapper: React.FC<AuthTranslationWrapperProps>;
6
5
  export declare const AuthI18nProvider: React.FC<AuthTranslationWrapperProps>;
7
6
  export {};