@ukpc-lib/react 0.16.9 → 0.16.10-sandbox.saas-9811.patch-1

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 e=require("../index.esm2017-yIz-9T8s.cjs"),m=require("axios"),u=require("react"),d=require("react-router-dom"),a=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");require("react-query");require("react-dom");require("moment");const h=s=>{const[t,r]=u.useState([]);return u.useEffect(()=>{m.get(`${s}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(o=>r(o.data)).catch(o=>{console.error("Getting user permission error:",o)})},[s]),t},p=s=>{const t=d.useLocation();if(u.useEffect(()=>{var o,i;let r=t.pathname+t.search+t.hash;s&&!r.includes(s)&&(r=s+r),console.log("🚀 ~ PrivateLayout.tsx ~ fullPath:",r),(i=(o=window.top)==null?void 0:o.shellNavigate)==null||i.call(o,"/app"+r,{replace:!0})},[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}};function g({open:s,disabled:t}){u.useMemo(()=>{var r,o,i,n;t||(s?(o=(r=window.top)==null?void 0:r.HostBridge)==null||o.openBackdrop(!0):(n=(i=window.top)==null?void 0:i.HostBridge)==null||n.openBackdrop(!1))},[s,t])}const l=(s,t)=>(r,o)=>{const n=e.useUserPermissions({axiosInstance:t,baseUrl:s}).data;return n?o?r.every(c=>n==null?void 0:n.includes(c)):r.some(c=>n==null?void 0:n.includes(c)):!1},f=({baseUrl:s,accessWith:t,requireAll:r,children:o})=>l(s)(t,r)?a.jsx(a.Fragment,{children:o}):null,P=({accessWith:s,requireAll:t,baseUrl:r,children:o})=>l(r)(s,t)?a.jsx(a.Fragment,{children:o}):a.jsx(e.UnauthorizedPage,{});exports.AuthContext=e.AuthContext;exports.AuthProvider=e.AuthProvider;exports.ERROR_MESSAGE=e.ERROR_MESSAGE;exports.SaasThemeProvider=e.SaasThemeProvider;exports.TranslationProvider=e.TranslationProvider;exports.axiosInstance=e.axiosInstance;exports.color=e.color;exports.createCustomTheme=e.createCustomTheme;exports.handleErrorAxios=e.handleErrorAxios;exports.login=e.login;exports.logout=e.logout;exports.responseInterceptor=e.responseInterceptor;exports.search=e.search;exports.setFavicon=e.setFavicon;exports.setShellBackdrop=e.setShellBackdrop;exports.translate=e.translate;exports.translationConfig=e.translationConfig;exports.useAuth=e.useAuth;exports.useCustomTranslation=e.useCustomTranslation;exports.useTheme=e.useTheme;exports.useTranslation=e.useTranslation;exports.HasPermission=f;exports.PermissionRoute=P;exports.getUseHasPermission=l;exports.useGetPermission=h;exports.useSyncBackdrop=g;exports.useSyncRouter=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.esm2017-DWvZNt6f.cjs"),m=require("axios"),u=require("react"),d=require("react-router-dom"),a=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");require("react-query");require("react-dom");require("moment");const h=s=>{const[t,r]=u.useState([]);return u.useEffect(()=>{m.get(`${s}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(o=>r(o.data)).catch(o=>{console.error("Getting user permission error:",o)})},[s]),t},p=s=>{const t=d.useLocation();if(u.useEffect(()=>{var o,i;let r=t.pathname+t.search+t.hash;s&&!r.includes(s)&&(r=s+r),console.log("🚀 ~ PrivateLayout.tsx ~ fullPath:",r),(i=(o=window.top)==null?void 0:o.shellNavigate)==null||i.call(o,"/app"+r,{replace:!0})},[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}};function g({open:s,disabled:t}){u.useMemo(()=>{var r,o,i,n;t||(s?(o=(r=window.top)==null?void 0:r.HostBridge)==null||o.openBackdrop(!0):(n=(i=window.top)==null?void 0:i.HostBridge)==null||n.openBackdrop(!1))},[s,t])}const l=(s,t)=>(r,o)=>{const n=e.useUserPermissions({axiosInstance:t,baseUrl:s}).data;return n?o?r.every(c=>n==null?void 0:n.includes(c)):r.some(c=>n==null?void 0:n.includes(c)):!1},f=({baseUrl:s,accessWith:t,requireAll:r,children:o})=>l(s)(t,r)?a.jsx(a.Fragment,{children:o}):null,P=({accessWith:s,requireAll:t,baseUrl:r,children:o})=>l(r)(s,t)?a.jsx(a.Fragment,{children:o}):a.jsx(e.UnauthorizedPage,{});exports.AuthContext=e.AuthContext;exports.AuthProvider=e.AuthProvider;exports.ERROR_MESSAGE=e.ERROR_MESSAGE;exports.SaasThemeProvider=e.SaasThemeProvider;exports.TranslationProvider=e.TranslationProvider;exports.axiosInstance=e.axiosInstance;exports.color=e.color;exports.createCustomTheme=e.createCustomTheme;exports.handleErrorAxios=e.handleErrorAxios;exports.login=e.login;exports.logout=e.logout;exports.responseInterceptor=e.responseInterceptor;exports.search=e.search;exports.setFavicon=e.setFavicon;exports.setShellBackdrop=e.setShellBackdrop;exports.translate=e.translate;exports.translationConfig=e.translationConfig;exports.useAuth=e.useAuth;exports.useCustomTranslation=e.useCustomTranslation;exports.useTheme=e.useTheme;exports.useTranslation=e.useTranslation;exports.HasPermission=f;exports.PermissionRoute=P;exports.getUseHasPermission=l;exports.useGetPermission=h;exports.useSyncBackdrop=g;exports.useSyncRouter=p;
@@ -1,5 +1,5 @@
1
- import { K as p, U as l } from "../index.esm2017-CUkKs8g8.js";
2
- import { M as $, O as D, R as F, a2 as I, $ as L, a as N, c as O, a0 as j, W as z, T as K, V, X, r as Y, a1 as Z, s as _, t as q, Y as J, e as Q, u as W, i as b, Z as ee } from "../index.esm2017-CUkKs8g8.js";
1
+ import { K as p, U as l } from "../index.esm2017-CJnOE-Mw.js";
2
+ import { M as $, O as D, R as F, a2 as I, $ as L, a as N, c as O, a0 as j, W as z, T as K, V, X, r as Y, a1 as Z, s as _, t as q, Y as J, e as Q, u as W, i as b, Z as ee } from "../index.esm2017-CJnOE-Mw.js";
3
3
  import f from "axios";
4
4
  import { useState as d, useEffect as u, useMemo as h } from "react";
5
5
  import { useLocation as w } 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.16.9",
4
+ "version": "0.16.10-sandbox.saas-9811.patch-1",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-BOygDorD.js";
2
- import { F, u as v } from "../index-D11feQm-.js";
2
+ import { F, u as v } from "../index-BNsTGyIl.js";
3
3
  import "../index-BwEhsh9S.js";
4
4
  import "../index-760z9lEs.js";
5
5
  import "../react-toastify.esm-DnABvuky.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-BOygDorD.js";
2
- import { G as e } from "../index-D11feQm-.js";
2
+ import { G as e } from "../index-BNsTGyIl.js";
3
3
  import "../index-BwEhsh9S.js";
4
4
  import "../index-760z9lEs.js";
5
5
  import "../SaasThemeProvider-A_eMJWqw.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-BOygDorD.js";
2
- import { L as s, T as L } from "../index-D11feQm-.js";
2
+ import { L as s, T as L } from "../index-BNsTGyIl.js";
3
3
  import "../index-BwEhsh9S.js";
4
4
  import "../index-CiYHK3Rq.js";
5
5
  import "../index-760z9lEs.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-BOygDorD.js";
2
- import { H as o, g as r } from "../index-D11feQm-.js";
2
+ import { H as o, g as r } from "../index-BNsTGyIl.js";
3
3
  export {
4
4
  o as HasPermission,
5
5
  r as getUseHasPermission