@ukpc-lib/react 0.13.1-dev.0 → 0.13.1-dev.2

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../index.esm2017-DtX2uFv9.cjs"),h=require("axios"),a=require("react"),u=require("react-router-dom"),i=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");const l=o=>{const[s,t]=a.useState([]);return a.useEffect(()=>{h.get(`${o}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(e=>t(e.data)).catch(e=>{console.error("Getting user permission error:",e)})},[o]),s},m=()=>{const o=u.useNavigate(),s=u.useLocation();if(a.useEffect(()=>{const t={changeRoute:e=>{typeof e=="string"&&s.pathname+s.search+s.hash!==e&&o(e)}};window.MicrofeBridge=t},[o,s]),a.useEffect(()=>{var e,n;const t=s.pathname+s.search+s.hash;(n=(e=window.parent)==null?void 0:e.HostBridge)==null||n.childRouteChange(t)},[s]),window.self===window.top){console.log("useSyncRouter: Navigate to /app path"),window.location.href=window.location.href.replace(window.origin,`${window.origin}/app`);return}},c=o=>(s,t)=>{const e=l(o);return t?s.every(n=>e==null?void 0:e.includes(n)):s.some(n=>e==null?void 0:e.includes(n))},g=({baseUrl:o,accessWith:s,requireAll:t,children:e})=>c(o)(s,t)?i.jsx(i.Fragment,{children:e}):null,d=({accessWith:o,requireAll:s,baseUrl:t,unAuthorizedPath:e,children:n})=>c(t)(o,s)?i.jsx(i.Fragment,{children:n}):i.jsx(u.Navigate,{to:e,replace:!0});exports.AuthContext=r.AuthContext;exports.AuthProvider=r.AuthProvider;exports.ERROR_MESSAGE=r.ERROR_MESSAGE;exports.SaasThemeProvider=r.SaasThemeProvider;exports.TranslationProvider=r.TranslationProvider;exports.axiosInstance=r.axiosInstance;exports.color=r.color;exports.createCustomTheme=r.createCustomTheme;exports.handleErrorAxios=r.handleErrorAxios;exports.login=r.login;exports.logout=r.logout;exports.responseInterceptor=r.responseInterceptor;exports.search=r.search;exports.setFavicon=r.setFavicon;exports.translate=r.translate;exports.translationConfig=r.translationConfig;exports.useAuth=r.useAuth;exports.useCustomTranslation=r.useCustomTranslation;exports.useTheme=r.useTheme;exports.useTranslation=r.useTranslation$1;exports.HasPermission=g;exports.PermissionRoute=d;exports.getUseHasPermission=c;exports.useGetPermission=l;exports.useSyncRouter=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../index.esm2017-D_jfQoO6.cjs"),h=require("axios"),a=require("react"),u=require("react-router-dom"),i=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");const l=o=>{const[s,t]=a.useState([]);return a.useEffect(()=>{h.get(`${o}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(e=>t(e.data)).catch(e=>{console.error("Getting user permission error:",e)})},[o]),s},m=()=>{const o=u.useNavigate(),s=u.useLocation();if(a.useEffect(()=>{const t={changeRoute:e=>{typeof e=="string"&&s.pathname+s.search+s.hash!==e&&o(e)}};window.MicrofeBridge=t},[o,s]),a.useEffect(()=>{var e,n;const t=s.pathname+s.search+s.hash;(n=(e=window.parent)==null?void 0:e.HostBridge)==null||n.childRouteChange(t)},[s]),window.self===window.top){console.log("useSyncRouter: Navigate to /app path"),window.location.href=window.location.href.replace(window.origin,`${window.origin}/app`);return}},c=o=>(s,t)=>{const e=l(o);return t?s.every(n=>e==null?void 0:e.includes(n)):s.some(n=>e==null?void 0:e.includes(n))},g=({baseUrl:o,accessWith:s,requireAll:t,children:e})=>c(o)(s,t)?i.jsx(i.Fragment,{children:e}):null,d=({accessWith:o,requireAll:s,baseUrl:t,unAuthorizedPath:e,children:n})=>c(t)(o,s)?i.jsx(i.Fragment,{children:n}):i.jsx(u.Navigate,{to:e,replace:!0});exports.AuthContext=r.AuthContext;exports.AuthProvider=r.AuthProvider;exports.ERROR_MESSAGE=r.ERROR_MESSAGE;exports.SaasThemeProvider=r.SaasThemeProvider;exports.TranslationProvider=r.TranslationProvider;exports.axiosInstance=r.axiosInstance;exports.color=r.color;exports.createCustomTheme=r.createCustomTheme;exports.handleErrorAxios=r.handleErrorAxios;exports.login=r.login;exports.logout=r.logout;exports.responseInterceptor=r.responseInterceptor;exports.search=r.search;exports.setFavicon=r.setFavicon;exports.translate=r.translate;exports.translationConfig=r.translationConfig;exports.useAuth=r.useAuth;exports.useCustomTranslation=r.useCustomTranslation;exports.useTheme=r.useTheme;exports.useTranslation=r.useTranslation$1;exports.HasPermission=g;exports.PermissionRoute=d;exports.getUseHasPermission=c;exports.useGetPermission=l;exports.useSyncRouter=m;
@@ -1,4 +1,4 @@
1
- import { M as E, N as M, O as N, a0 as B, Y as G, a as H, c as $, Z as F, U as I, R as O, T as j, V as L, v as U, $ as V, t as X, W as Y, b as Z, u as _, g as b, X as k } from "../index.esm2017-D3VDEGOb.js";
1
+ import { M as E, N as M, O as N, a0 as B, Y as G, a as H, c as $, Z as F, U as I, R as O, T as j, V as L, v as U, $ as V, t as X, W as Y, b as Z, u as _, g as b, X as k } from "../index.esm2017-gn4YavpL.js";
2
2
  import c from "axios";
3
3
  import { useState as m, useEffect as n } from "react";
4
4
  import { useNavigate as h, useLocation as l, Navigate as g } from "react-router-dom";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.13.1-dev.0",
4
+ "version": "0.13.1-dev.2",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-D7SoYMky.js";
2
- import { F as i, u as m } from "../index-DkWIzRN3.js";
2
+ import { F as i, u as m } from "../index-BbpYFIqc.js";
3
3
  import "../index-Cx0zTfOC.js";
4
4
  import "../index-B8-7QZsi.js";
5
5
  export {
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-D7SoYMky.js";
2
- import { G as i } from "../index-DkWIzRN3.js";
2
+ import { G as i } from "../index-BbpYFIqc.js";
3
3
  import "../index-Cx0zTfOC.js";
4
4
  import "../index-B8-7QZsi.js";
5
5
  export {
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-D7SoYMky.js";
2
- import { L as n, T as s } from "../index-DkWIzRN3.js";
2
+ import { L as n, T as s } from "../index-BbpYFIqc.js";
3
3
  import "../index-Cx0zTfOC.js";
4
4
  import "../index-B2-j-GrO.js";
5
5
  import "../index-B8-7QZsi.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-D7SoYMky.js";
2
- import { H as e, g as m } from "../index-DkWIzRN3.js";
2
+ import { H as e, g as m } from "../index-BbpYFIqc.js";
3
3
  import "../index-B8-7QZsi.js";
4
4
  export {
5
5
  e as HasPermission,