@ukpc-lib/react 0.2.18 → 0.2.19

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.
@@ -13044,7 +13044,7 @@ const fS = {
13044
13044
  }
13045
13045
  },
13046
13046
  notificationAdmin: {
13047
- notfication: {
13047
+ notification: {
13048
13048
  errorMessage: {
13049
13049
  notificationFilterType: "Feld notificationFilterType ist ungültig. Muss einer der Werte 'gelesen', 'ungelesen' oder 'alle' sein.",
13050
13050
  userIdInvalid: "Feld userId ist ungültig. Muss eine Zahl sein.",
@@ -13054,7 +13054,7 @@ const fS = {
13054
13054
  userDeviceTokenInvalid: "Feld deviceToken ist ungültig. Muss eine Zeichenfolge sein."
13055
13055
  }
13056
13056
  },
13057
- noficationConfig: {
13057
+ notificationConfig: {
13058
13058
  errorMessage: {
13059
13059
  notificationNotFound: "Benachrichtigungskonfiguration nicht gefunden.",
13060
13060
  notificationIsExisted: "Benachrichtigungsregel existiert bereits.",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index.module-1f98fe91.cjs"),d=require("axios"),i=require("react/jsx-runtime"),g=require("react");require("moment");require("@r2wc/react-to-web-component");const f=require("react-router-dom");require("react-dom");require("@mui/material");function q({config:t,pushError:n=o.pushError}){const r=d.create(t);r.interceptors.request.use(async e=>(e.headers={Accept:"application/json","Content-Type":"application/json"},e),e=>Promise.reject(e)),r.interceptors.response.use(e=>e,async e=>s(e));async function s(e){var l,P,p,h;console.error("Error 🚨:",e);const a=e.config,u=(P=(l=e.response)==null?void 0:l.data)==null?void 0:P.errorMessage,m=u===o.ERROR_MESSAGE.TOKEN_EXPIRED;return((p=e.response)==null?void 0:p.status)===401?m&&!a._retry?(a._retry=!0,r.post("/authentication/api/v1/auth/refresh-token").then(()=>r(a)).catch(()=>o.login(t.baseURL))):((!u||!m)&&o.login(t.baseURL),Promise.reject("Unauthorized! Please login again.")):(((h=e.response)==null?void 0:h.status)===403?n(o.t("errorMessage.403")):n(o.t(`${u}`)||"Something went wrong!"),Promise.reject(e.response.data))}return r}const R=t=>{const[n,r]=g.useState([]);return g.useEffect(()=>{d.get(`${t}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(s=>r(s.data)).catch(s=>{console.error("Getting user permission error:",s)})},[t]),n},c=t=>(n,r)=>{const s=R(t);return r?n.every(e=>s==null?void 0:s.includes(e)):n.some(e=>s==null?void 0:s.includes(e))},j=({baseUrl:t,accessWith:n,requireAll:r,children:s})=>c(t)(n,r)?i.jsx(i.Fragment,{children:s}):null,v=({accessWith:t,requireAll:n,baseUrl:r,unAuthorizedPath:s,children:e})=>c(r)(t,n)?i.jsx(i.Fragment,{children:e}):i.jsx(f.Navigate,{to:s,replace:!0});exports.AuthProvider=o.AuthProvider;exports.TranslationProvider=o.TranslationProvider;exports.search=o.search;exports.useAuth=o.useAuth;exports.useCustomTranslation=o.useCustomTranslation;exports.HasPermission=j;exports.PermissionRoute=v;exports.getAxiosInstance=q;exports.getUseHasPermission=c;exports.useGetPermission=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index.module-4ccadde2.cjs"),d=require("axios"),i=require("react/jsx-runtime"),g=require("react");require("moment");require("@r2wc/react-to-web-component");const f=require("react-router-dom");require("react-dom");require("@mui/material");function q({config:t,pushError:n=o.pushError}){const r=d.create(t);r.interceptors.request.use(async e=>(e.headers={Accept:"application/json","Content-Type":"application/json"},e),e=>Promise.reject(e)),r.interceptors.response.use(e=>e,async e=>s(e));async function s(e){var l,P,p,h;console.error("Error 🚨:",e);const a=e.config,u=(P=(l=e.response)==null?void 0:l.data)==null?void 0:P.errorMessage,m=u===o.ERROR_MESSAGE.TOKEN_EXPIRED;return((p=e.response)==null?void 0:p.status)===401?m&&!a._retry?(a._retry=!0,r.post("/authentication/api/v1/auth/refresh-token").then(()=>r(a)).catch(()=>o.login(t.baseURL))):((!u||!m)&&o.login(t.baseURL),Promise.reject("Unauthorized! Please login again.")):(((h=e.response)==null?void 0:h.status)===403?n(o.t("errorMessage.403")):n(o.t(`${u}`)||"Something went wrong!"),Promise.reject(e.response.data))}return r}const R=t=>{const[n,r]=g.useState([]);return g.useEffect(()=>{d.get(`${t}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(s=>r(s.data)).catch(s=>{console.error("Getting user permission error:",s)})},[t]),n},c=t=>(n,r)=>{const s=R(t);return r?n.every(e=>s==null?void 0:s.includes(e)):n.some(e=>s==null?void 0:s.includes(e))},j=({baseUrl:t,accessWith:n,requireAll:r,children:s})=>c(t)(n,r)?i.jsx(i.Fragment,{children:s}):null,v=({accessWith:t,requireAll:n,baseUrl:r,unAuthorizedPath:s,children:e})=>c(r)(t,n)?i.jsx(i.Fragment,{children:e}):i.jsx(f.Navigate,{to:s,replace:!0});exports.AuthProvider=o.AuthProvider;exports.TranslationProvider=o.TranslationProvider;exports.search=o.search;exports.useAuth=o.useAuth;exports.useCustomTranslation=o.useCustomTranslation;exports.HasPermission=j;exports.PermissionRoute=v;exports.getAxiosInstance=q;exports.getUseHasPermission=c;exports.useGetPermission=R;
@@ -1,5 +1,5 @@
1
- import { E as f, t as l, p as E, F as R } from "../index.module-7166b9fa.js";
2
- import { G as L, T as N, m as O, H as b, u as z } from "../index.module-7166b9fa.js";
1
+ import { E as f, t as l, p as E, F as R } from "../index.module-b6c6a380.js";
2
+ import { G as L, T as N, m as O, H as b, u as z } from "../index.module-b6c6a380.js";
3
3
  import P from "axios";
4
4
  import { jsx as a, Fragment as g } from "react/jsx-runtime";
5
5
  import { useState as y, useEffect as v } from "react";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.2.18",
4
+ "version": "0.2.19",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../index-661a7bdb.cjs");const e=require("../index-c74328c1.cjs");exports.TopBar=e.TopBar;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../index-661a7bdb.cjs");const e=require("../index-d4707064.cjs");exports.TopBar=e.TopBar;
@@ -1,5 +1,5 @@
1
1
  import "../index-200424a6.js";
2
- import { T as a } from "../index-f95a0f73.js";
2
+ import { T as a } from "../index-24029b20.js";
3
3
  export {
4
4
  a as TopBar
5
5
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../index-661a7bdb.cjs");const e=require("../index-c74328c1.cjs");exports.HasPermission=e.HasPermission;exports.getUseHasPermission=e.getUseHasPermission;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../index-661a7bdb.cjs");const e=require("../index-d4707064.cjs");exports.HasPermission=e.HasPermission;exports.getUseHasPermission=e.getUseHasPermission;
@@ -1,5 +1,5 @@
1
1
  import "../index-200424a6.js";
2
- import { H as o, g as r } from "../index-f95a0f73.js";
2
+ import { H as o, g as r } from "../index-24029b20.js";
3
3
  export {
4
4
  o as HasPermission,
5
5
  r as getUseHasPermission