@ukpc-lib/react 0.13.1-dev.22 → 0.13.1-dev.24

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-Ck_qm_fd.cjs"),g=require("axios"),c=require("react"),d=require("react-router-dom"),u=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");require("react-query");require("react-dom");require("moment");const h=r=>{const[i,t]=c.useState([]);return c.useEffect(()=>{g.get(`${r}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(s=>t(s.data)).catch(s=>{console.error("Getting user permission error:",s)})},[r]),i},f=r=>{const i=d.useNavigate(),t=d.useLocation();console.log(" useSyncRouter.tsx ~ location1:",t,window.location.pathname);const s=(n=t)=>(r||"")+n.pathname+n.search+n.hash;if(c.useEffect(()=>{const n={changeRoute:o=>{const a=s();if(typeof o=="string"&&a!==o){console.log(" useSyncRouter.tsx ~ location2:",a,o);const m=r&&o.startsWith(r)?o.substring(r.length):o;i(m)}}};window.MicrofeBridge=n},[i,t]),c.useEffect(()=>{var o,a;const n=s();console.log("fullPath1",window.location.pathname,n),(a=(o=window.parent)==null?void 0:o.HostBridge)==null||a.childRouteChange(n)},[t]),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 P({open:r,disabled:i}){c.useMemo(()=>{var t,s,n,o;i||(r?(s=(t=window.top)==null?void 0:t.HostBridge)==null||s.openBackdrop(!0):(o=(n=window.top)==null?void 0:n.HostBridge)==null||o.openBackdrop(!1))},[r,i])}const l=(r,i)=>(t,s)=>{const o=e.useUserPermissions({axiosInstance:i,baseUrl:r}).data;return o?s?t.every(a=>o==null?void 0:o.includes(a)):t.some(a=>o==null?void 0:o.includes(a)):!1},w=({baseUrl:r,accessWith:i,requireAll:t,children:s})=>l(r)(i,t)?u.jsx(u.Fragment,{children:s}):null,p=({accessWith:r,requireAll:i,baseUrl:t,children:s})=>l(t)(r,i)?u.jsx(u.Fragment,{children:s}):u.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=w;exports.PermissionRoute=p;exports.getUseHasPermission=l;exports.useGetPermission=h;exports.useSyncBackdrop=P;exports.useSyncRouter=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.esm2017-B6pR8zNp.cjs"),g=require("axios"),c=require("react"),d=require("react-router-dom"),u=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");require("react-query");require("react-dom");require("moment");const h=r=>{const[i,t]=c.useState([]);return c.useEffect(()=>{g.get(`${r}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(s=>t(s.data)).catch(s=>{console.error("Getting user permission error:",s)})},[r]),i},f=r=>{const i=d.useNavigate(),t=d.useLocation();console.log(" useSyncRouter.tsx ~ location1:",t,window.location.pathname);const s=(n=t)=>(r||"")+n.pathname+n.search+n.hash;if(c.useEffect(()=>{const n={changeRoute:o=>{const a=s();if(typeof o=="string"&&a!==o){console.log(" useSyncRouter.tsx ~ location2:",a,o);const m=r&&o.startsWith(r)?o.substring(r.length):o;i(m)}}};window.MicrofeBridge=n},[i,t]),c.useEffect(()=>{var o,a;const n=s();console.log("fullPath1",window.location.pathname,n),(a=(o=window.parent)==null?void 0:o.HostBridge)==null||a.childRouteChange(n)},[t]),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 P({open:r,disabled:i}){c.useMemo(()=>{var t,s,n,o;i||(r?(s=(t=window.top)==null?void 0:t.HostBridge)==null||s.openBackdrop(!0):(o=(n=window.top)==null?void 0:n.HostBridge)==null||o.openBackdrop(!1))},[r,i])}const l=(r,i)=>(t,s)=>{const o=e.useUserPermissions({axiosInstance:i,baseUrl:r}).data;return o?s?t.every(a=>o==null?void 0:o.includes(a)):t.some(a=>o==null?void 0:o.includes(a)):!1},w=({baseUrl:r,accessWith:i,requireAll:t,children:s})=>l(r)(i,t)?u.jsx(u.Fragment,{children:s}):null,p=({accessWith:r,requireAll:i,baseUrl:t,children:s})=>l(t)(r,i)?u.jsx(u.Fragment,{children:s}):u.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$1;exports.HasPermission=w;exports.PermissionRoute=p;exports.getUseHasPermission=l;exports.useGetPermission=h;exports.useSyncBackdrop=P;exports.useSyncRouter=f;
@@ -1,5 +1,5 @@
1
- import { K as d, U as g } from "../index.esm2017-DhUKCOpT.js";
2
- import { M as z, O as D, R as I, a2 as N, $ as O, a as j, c as K, a0 as L, W as V, T as W, V as X, X as Y, r as Z, a1 as _, s as q, A as J, Y as Q, e as b, u as oo, i as eo, Z as so } from "../index.esm2017-DhUKCOpT.js";
1
+ import { M as d, U as g } from "../index.esm2017-DcnQ8dZu.js";
2
+ import { O as z, R as D, T as I, a3 as N, a0 as O, a as j, c as L, a1 as V, X as W, V as X, W as Y, Y as Z, r as _, a2 as q, s as J, t as K, Z as Q, e as b, u as oo, i as eo, $ as so } from "../index.esm2017-DcnQ8dZu.js";
3
3
  import p from "axios";
4
4
  import { useState as f, useEffect as a, useMemo as h } from "react";
5
5
  import { useNavigate as w, useLocation as P } from "react-router-dom";
@@ -89,17 +89,17 @@ export {
89
89
  N as SaasThemeProvider,
90
90
  O as TranslationProvider,
91
91
  j as axiosInstance,
92
- K as color,
93
- L as createCustomTheme,
92
+ L as color,
93
+ V as createCustomTheme,
94
94
  l as getUseHasPermission,
95
- V as handleErrorAxios,
96
- W as login,
97
- X as logout,
98
- Y as responseInterceptor,
99
- Z as search,
100
- _ as setFavicon,
101
- q as setShellBackdrop,
102
- J as translate,
95
+ W as handleErrorAxios,
96
+ X as login,
97
+ Y as logout,
98
+ Z as responseInterceptor,
99
+ _ as search,
100
+ q as setFavicon,
101
+ J as setShellBackdrop,
102
+ K as translate,
103
103
  Q as translationConfig,
104
104
  b as useAuth,
105
105
  oo as useCustomTranslation,
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.22",
4
+ "version": "0.13.1-dev.24",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -75,8 +75,7 @@
75
75
  "react-window-infinite-loader": "^1.0.9",
76
76
  "simplebar-react": "^3.2.4",
77
77
  "styled-components": "^5.3.3",
78
- "usehooks-ts": "^2.15.1",
79
- "vite-plugin-css-injected-by-js": "^3.3.1"
78
+ "usehooks-ts": "^2.15.1"
80
79
  },
81
80
  "devDependencies": {
82
81
  "@types/node": "^20.8.10",
@@ -98,7 +97,7 @@
98
97
  "tailwindcss": "^3.4.1",
99
98
  "typescript": "^5.0.2",
100
99
  "vite": "5.1.7",
101
- "vite-plugin-css-injected-by-js": "^3.3.1",
100
+ "vite-plugin-css-injected-by-js": "^3.5.2",
102
101
  "vite-plugin-dts": "^3.7.0",
103
102
  "vite-plugin-lib-inject-css": "^1.3.0"
104
103
  },
@@ -1,5 +1,6 @@
1
1
  import "../react-to-web-component-D7SoYMky.js";
2
- import { U as e } from "../index-FXzGvU4f.js";
2
+ import { U as e } from "../index-fKv-tqw7.js";
3
+ import "../useTranslation-yFulP-g8.js";
3
4
  export {
4
5
  e as UnauthorizedPage
5
6
  };
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-D7SoYMky.js";
2
- import { V as e } from "../index-DMIeyivH.js";
2
+ import { V as e } from "../index-DVbeHRGT.js";
3
3
  import "../SaasThemeProvider-ffEVXQF_.js";
4
4
  export {
5
5
  e as BaseBreadcrumbs
@@ -1,12 +1,12 @@
1
1
  import "../react-to-web-component-D7SoYMky.js";
2
- import { F, u as v } from "../index-Bykcegxp.js";
3
- import "../index-CyHNU5OG.js";
4
- import "../index-DMIeyivH.js";
2
+ import { F, u as v } from "../index-DVyPTlxG.js";
3
+ import "../index-dx6s22iA.js";
4
+ import "../index-DVbeHRGT.js";
5
5
  import "../react-toastify.esm-Y1WvK90L.js";
6
6
  import "../toast-config/index.js";
7
7
  import "../toast-config-notification/index.js";
8
8
  import "../SaasThemeProvider-ffEVXQF_.js";
9
- import "../index-FXzGvU4f.js";
9
+ import "../index-fKv-tqw7.js";
10
10
  export {
11
11
  F as FavoriteMenu,
12
12
  v as updateFavoriteItems
@@ -1,9 +1,9 @@
1
1
  import "../react-to-web-component-D7SoYMky.js";
2
- import { G as e } from "../index-Bykcegxp.js";
3
- import "../index-CyHNU5OG.js";
4
- import "../index-DMIeyivH.js";
2
+ import { G as e } from "../index-DVyPTlxG.js";
3
+ import "../index-dx6s22iA.js";
4
+ import "../index-DVbeHRGT.js";
5
5
  import "../SaasThemeProvider-ffEVXQF_.js";
6
- import "../index-FXzGvU4f.js";
6
+ import "../index-fKv-tqw7.js";
7
7
  export {
8
8
  e as GlobalMenu
9
9
  };
@@ -1,8 +1,8 @@
1
1
  import "../react-to-web-component-D7SoYMky.js";
2
- import { L as s, T as L } from "../index-Bykcegxp.js";
3
- import "../index-CyHNU5OG.js";
4
- import "../index-FXzGvU4f.js";
5
- import "../index-DMIeyivH.js";
2
+ import { L as s, T as L } from "../index-DVyPTlxG.js";
3
+ import "../index-dx6s22iA.js";
4
+ import "../index-fKv-tqw7.js";
5
+ import "../index-DVbeHRGT.js";
6
6
  import "../SaasThemeProvider-ffEVXQF_.js";
7
7
  import "../react-toastify.esm-Y1WvK90L.js";
8
8
  import "../toast-config/index.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-D7SoYMky.js";
2
- import { H as o, g as r } from "../index-Bykcegxp.js";
2
+ import { H as o, g as r } from "../index-DVyPTlxG.js";
3
3
  export {
4
4
  o as HasPermission,
5
5
  r as getUseHasPermission
@@ -2,7 +2,22 @@ import { e as pt, r as d, j as _, d as ce, a as J, f as pi, s as hi } from "./re
2
2
  import { _ as w, q as mi } from "./SaasThemeProvider-ffEVXQF_.js";
3
3
  import { c as q } from "./clsx-DB4S2d7J.js";
4
4
  import { a as gi, _ as yi } from "./setPrototypeOf-CP0c5ut2.js";
5
- const Ce = {
5
+ function V(e, t) {
6
+ if (e == null)
7
+ return {};
8
+ var r = {};
9
+ for (var n in e)
10
+ if ({}.hasOwnProperty.call(e, n)) {
11
+ if (t.indexOf(n) !== -1)
12
+ continue;
13
+ r[n] = e[n];
14
+ }
15
+ return r;
16
+ }
17
+ const bi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18
+ __proto__: null,
19
+ default: V
20
+ }, Symbol.toStringTag, { value: "Module" })), Ce = {
6
21
  primary: "#93D500",
7
22
  primary100: "#F0F6E1",
8
23
  primary200: "#E5F5ED",
@@ -73,7 +88,7 @@ const Ce = {
73
88
  500: "#ff9800",
74
89
  700: "#f57c00",
75
90
  900: "#e65100"
76
- }, bi = {
91
+ }, vi = {
77
92
  50: "#fafafa",
78
93
  100: "#f5f5f5",
79
94
  200: "#eeeeee",
@@ -95,26 +110,10 @@ function Ke(e) {
95
110
  t += "&args[]=" + encodeURIComponent(arguments[r]);
96
111
  return "Minified MUI error #" + e + "; visit " + t + " for the full message.";
97
112
  }
98
- const vi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
113
+ const xi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
99
114
  __proto__: null,
100
115
  default: Ke
101
- }, Symbol.toStringTag, { value: "Module" })), xi = "$$material";
102
- function V(e, t) {
103
- if (e == null)
104
- return {};
105
- var r = {};
106
- for (var n in e)
107
- if ({}.hasOwnProperty.call(e, n)) {
108
- if (t.indexOf(n) !== -1)
109
- continue;
110
- r[n] = e[n];
111
- }
112
- return r;
113
- }
114
- const Si = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
115
- __proto__: null,
116
- default: V
117
- }, Symbol.toStringTag, { value: "Module" }));
116
+ }, Symbol.toStringTag, { value: "Module" })), Si = "$$material";
118
117
  function Ci(e) {
119
118
  if (e.sheet)
120
119
  return e.sheet;
@@ -2747,7 +2746,7 @@ var L = {}, Po = { exports: {} };
2747
2746
  e.exports = t, e.exports.__esModule = !0, e.exports.default = e.exports;
2748
2747
  })(Po);
2749
2748
  var Ur = Po.exports;
2750
- const hl = /* @__PURE__ */ ce(vi), ml = /* @__PURE__ */ ce(Bs);
2749
+ const hl = /* @__PURE__ */ ce(xi), ml = /* @__PURE__ */ ce(Bs);
2751
2750
  var Ro = Ur;
2752
2751
  Object.defineProperty(L, "__esModule", {
2753
2752
  value: !0
@@ -3114,7 +3113,7 @@ function Bl(e) {
3114
3113
  name: "success"
3115
3114
  }),
3116
3115
  // The grey colors.
3117
- grey: bi,
3116
+ grey: vi,
3118
3117
  // Used by `getContrastText()` to maximize the contrast between
3119
3118
  // the background and the text.
3120
3119
  contrastThreshold: r,
@@ -3289,7 +3288,7 @@ function Jl(e = {}, ...t) {
3289
3288
  }
3290
3289
  const Zl = Jl();
3291
3290
  var tt = {};
3292
- const Ql = /* @__PURE__ */ ce(mi), ec = /* @__PURE__ */ ce(Si), tc = /* @__PURE__ */ ce(Ta), rc = /* @__PURE__ */ ce(ka), nc = /* @__PURE__ */ ce(ja), oc = /* @__PURE__ */ ce(Is), ic = /* @__PURE__ */ ce(Es), ac = /* @__PURE__ */ ce(_s);
3291
+ const Ql = /* @__PURE__ */ ce(mi), ec = /* @__PURE__ */ ce(bi), tc = /* @__PURE__ */ ce(Ta), rc = /* @__PURE__ */ ce(ka), nc = /* @__PURE__ */ ce(ja), oc = /* @__PURE__ */ ce(Is), ic = /* @__PURE__ */ ce(Es), ac = /* @__PURE__ */ ce(_s);
3293
3292
  var Fe = Ur;
3294
3293
  Object.defineProperty(tt, "__esModule", {
3295
3294
  value: !0
@@ -3459,7 +3458,7 @@ function Sc(e) {
3459
3458
  return e !== "ownerState" && e !== "theme" && e !== "sx" && e !== "as";
3460
3459
  }
3461
3460
  const Cc = (e) => Sc(e) && e !== "classes", ge = sc({
3462
- themeId: xi,
3461
+ themeId: Si,
3463
3462
  defaultTheme: Zl,
3464
3463
  rootShouldForwardProp: Cc
3465
3464
  });
@@ -5152,7 +5151,7 @@ export {
5152
5151
  ho as a,
5153
5152
  Ut as b,
5154
5153
  Ce as c,
5155
- xi as d,
5154
+ Si as d,
5156
5155
  mo as e,
5157
5156
  Zl as f,
5158
5157
  Tc as g,