@ukpc-lib/react 0.12.1-dev.8 → 0.13.1-dev.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.
Files changed (24) hide show
  1. package/dist/components/index.cjs +9 -9
  2. package/dist/components/index.js +8 -8
  3. package/dist/{index.esm2017-B86w0LQi.js → index.esm2017-D3VDEGOb.js} +21 -9
  4. package/dist/{index.esm2017-DMgzbuon.cjs → index.esm2017-DtX2uFv9.cjs} +3 -3
  5. package/dist/share/hooks/index.d.ts +1 -0
  6. package/dist/share/hooks/useSyncRouter.d.ts +7 -0
  7. package/dist/share/index.cjs +1 -1
  8. package/dist/share/index.js +71 -50
  9. package/package.json +1 -1
  10. package/web-components-bundle/access-denied/index.js +2 -2
  11. package/web-components-bundle/base-breadcrumbs/index.js +2 -2
  12. package/web-components-bundle/favorite-menu/index.js +4 -4
  13. package/web-components-bundle/global-menu/index.js +4 -4
  14. package/web-components-bundle/global-topbar/index.js +6 -6
  15. package/web-components-bundle/has-permission/index.js +3 -3
  16. package/web-components-bundle/{index-T58UE-6b.js → index-B2-j-GrO.js} +1 -1
  17. package/web-components-bundle/{index-BziS9Had.js → index-B8-7QZsi.js} +593 -593
  18. package/web-components-bundle/{index-BSe1av43.js → index-Cx0zTfOC.js} +1 -1
  19. package/web-components-bundle/{index-CaxjbvSW.js → index-DkWIzRN3.js} +30 -18
  20. package/web-components-bundle/page-not-found/index.js +2 -2
  21. package/web-components-bundle/{react-to-web-component-CXwKHjZr.js → react-to-web-component-D7SoYMky.js} +1535 -1527
  22. package/web-components-bundle/{react-toastify.esm-CrTD7cpE.js → react-toastify.esm-Y1WvK90L.js} +1 -1
  23. package/web-components-bundle/toast-config/index.js +2 -2
  24. package/web-components-bundle/toast-config-notification/index.js +2 -2
@@ -1 +1,2 @@
1
1
  export * from './useGetPermission';
2
+ export * from './useSyncRouter';
@@ -0,0 +1,7 @@
1
+ declare global {
2
+ interface Window {
3
+ MicrofeBridge?: any;
4
+ HostBridge?: any;
5
+ }
6
+ }
7
+ export declare const useSyncRouter: () => void;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.esm2017-DMgzbuon.cjs"),m=require("axios"),u=require("react"),i=require("react/jsx-runtime");require("@r2wc/react-to-web-component");const l=require("react-router-dom");require("@mui/material");const c=s=>{const[t,o]=u.useState([]);return u.useEffect(()=>{m.get(`${s}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(r=>o(r.data)).catch(r=>{console.error("Getting user permission error:",r)})},[s]),t},a=s=>(t,o)=>{const r=c(s);return o?t.every(n=>r==null?void 0:r.includes(n)):t.some(n=>r==null?void 0:r.includes(n))},h=({baseUrl:s,accessWith:t,requireAll:o,children:r})=>a(s)(t,o)?i.jsx(i.Fragment,{children:r}):null,P=({accessWith:s,requireAll:t,baseUrl:o,unAuthorizedPath:r,children:n})=>a(o)(s,t)?i.jsx(i.Fragment,{children:n}):i.jsx(l.Navigate,{to:r,replace:!0});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.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=h;exports.PermissionRoute=P;exports.getUseHasPermission=a;exports.useGetPermission=c;
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,61 +1,82 @@
1
- import { M as R, N as S, O as G, a0 as y, Y as F, a as H, c as I, Z as M, U as N, R as O, T as $, V as j, v as w, $ as U, t as V, W as X, b as Y, u as Z, g as _, X as b } from "../index.esm2017-B86w0LQi.js";
2
- import u from "axios";
3
- import { useState as m, useEffect as c } from "react";
4
- import { jsx as a, Fragment as n } from "react/jsx-runtime";
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";
2
+ import c from "axios";
3
+ import { useState as m, useEffect as n } from "react";
4
+ import { useNavigate as h, useLocation as l, Navigate as g } from "react-router-dom";
5
+ import { jsx as a, Fragment as i } from "react/jsx-runtime";
5
6
  import "@r2wc/react-to-web-component";
6
- import { Navigate as l } from "react-router-dom";
7
7
  import "@mui/material";
8
- const h = (e) => {
9
- const [r, t] = m([]);
10
- return c(() => {
11
- u.get(`${e}/user-management/api/v1/users/my-account/permissions`, {
8
+ const p = (o) => {
9
+ const [s, t] = m([]);
10
+ return n(() => {
11
+ c.get(`${o}/user-management/api/v1/users/my-account/permissions`, {
12
12
  withCredentials: !0
13
- }).then((s) => t(s.data)).catch((s) => {
14
- console.error("Getting user permission error:", s);
13
+ }).then((e) => t(e.data)).catch((e) => {
14
+ console.error("Getting user permission error:", e);
15
15
  });
16
- }, [e]), r;
17
- }, i = (e) => (r, t) => {
18
- const s = h(e);
19
- return t ? r.every(
20
- (o) => s == null ? void 0 : s.includes(o)
21
- ) : r.some(
22
- (o) => s == null ? void 0 : s.includes(o)
16
+ }, [o]), s;
17
+ }, T = () => {
18
+ const o = h(), s = l();
19
+ if (n(() => {
20
+ const t = {
21
+ changeRoute: (e) => {
22
+ typeof e == "string" && s.pathname + s.search + s.hash !== e && o(e);
23
+ }
24
+ };
25
+ window.MicrofeBridge = t;
26
+ }, [o, s]), n(() => {
27
+ var e, r;
28
+ const t = s.pathname + s.search + s.hash;
29
+ (r = (e = window.parent) == null ? void 0 : e.HostBridge) == null || r.childRouteChange(t);
30
+ }, [s]), window.self === window.top) {
31
+ console.log("useSyncRouter: Navigate to /app path"), window.location.href = window.location.href.replace(
32
+ window.origin,
33
+ `${window.origin}/app`
34
+ );
35
+ return;
36
+ }
37
+ }, u = (o) => (s, t) => {
38
+ const e = p(o);
39
+ return t ? s.every(
40
+ (r) => e == null ? void 0 : e.includes(r)
41
+ ) : s.some(
42
+ (r) => e == null ? void 0 : e.includes(r)
23
43
  );
24
- }, T = ({
25
- baseUrl: e,
26
- accessWith: r,
44
+ }, C = ({
45
+ baseUrl: o,
46
+ accessWith: s,
27
47
  requireAll: t,
28
- children: s
29
- }) => i(e)(r, t) ? /* @__PURE__ */ a(n, { children: s }) : null, A = ({
30
- accessWith: e,
31
- requireAll: r,
48
+ children: e
49
+ }) => u(o)(s, t) ? /* @__PURE__ */ a(i, { children: e }) : null, S = ({
50
+ accessWith: o,
51
+ requireAll: s,
32
52
  baseUrl: t,
33
- unAuthorizedPath: s,
34
- children: o
35
- }) => i(t)(e, r) ? /* @__PURE__ */ a(n, { children: o }) : /* @__PURE__ */ a(l, { to: s, replace: !0 });
53
+ unAuthorizedPath: e,
54
+ children: r
55
+ }) => u(t)(o, s) ? /* @__PURE__ */ a(i, { children: r }) : /* @__PURE__ */ a(g, { to: e, replace: !0 });
36
56
  export {
37
- R as AuthContext,
38
- S as AuthProvider,
39
- G as ERROR_MESSAGE,
40
- T as HasPermission,
41
- A as PermissionRoute,
42
- y as SaasThemeProvider,
43
- F as TranslationProvider,
57
+ E as AuthContext,
58
+ M as AuthProvider,
59
+ N as ERROR_MESSAGE,
60
+ C as HasPermission,
61
+ S as PermissionRoute,
62
+ B as SaasThemeProvider,
63
+ G as TranslationProvider,
44
64
  H as axiosInstance,
45
- I as color,
46
- M as createCustomTheme,
47
- i as getUseHasPermission,
48
- N as handleErrorAxios,
65
+ $ as color,
66
+ F as createCustomTheme,
67
+ u as getUseHasPermission,
68
+ I as handleErrorAxios,
49
69
  O as login,
50
- $ as logout,
51
- j as responseInterceptor,
52
- w as search,
53
- U as setFavicon,
54
- V as translate,
55
- X as translationConfig,
56
- Y as useAuth,
57
- Z as useCustomTranslation,
58
- h as useGetPermission,
59
- _ as useTheme,
60
- b as useTranslation
70
+ j as logout,
71
+ L as responseInterceptor,
72
+ U as search,
73
+ V as setFavicon,
74
+ X as translate,
75
+ Y as translationConfig,
76
+ Z as useAuth,
77
+ _ as useCustomTranslation,
78
+ p as useGetPermission,
79
+ T as useSyncRouter,
80
+ b as useTheme,
81
+ k as useTranslation
61
82
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.12.1-dev.8",
4
+ "version": "0.13.1-dev.0",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1,5 +1,5 @@
1
- import "../react-to-web-component-CXwKHjZr.js";
2
- import { U as e } from "../index-T58UE-6b.js";
1
+ import "../react-to-web-component-D7SoYMky.js";
2
+ import { U as e } from "../index-B2-j-GrO.js";
3
3
  export {
4
4
  e as UnauthorizedPage
5
5
  };
@@ -1,5 +1,5 @@
1
- import "../react-to-web-component-CXwKHjZr.js";
2
- import { aa as m } from "../index-BziS9Had.js";
1
+ import "../react-to-web-component-D7SoYMky.js";
2
+ import { aa as m } from "../index-B8-7QZsi.js";
3
3
  export {
4
4
  m as BaseBreadcrumbs
5
5
  };
@@ -1,7 +1,7 @@
1
- import "../react-to-web-component-CXwKHjZr.js";
2
- import { F as i, u as m } from "../index-CaxjbvSW.js";
3
- import "../index-BSe1av43.js";
4
- import "../index-BziS9Had.js";
1
+ import "../react-to-web-component-D7SoYMky.js";
2
+ import { F as i, u as m } from "../index-DkWIzRN3.js";
3
+ import "../index-Cx0zTfOC.js";
4
+ import "../index-B8-7QZsi.js";
5
5
  export {
6
6
  i as FavoriteMenu,
7
7
  m as updateFavoriteItems
@@ -1,7 +1,7 @@
1
- import "../react-to-web-component-CXwKHjZr.js";
2
- import { G as i } from "../index-CaxjbvSW.js";
3
- import "../index-BSe1av43.js";
4
- import "../index-BziS9Had.js";
1
+ import "../react-to-web-component-D7SoYMky.js";
2
+ import { G as i } from "../index-DkWIzRN3.js";
3
+ import "../index-Cx0zTfOC.js";
4
+ import "../index-B8-7QZsi.js";
5
5
  export {
6
6
  i as GlobalMenu
7
7
  };
@@ -1,9 +1,9 @@
1
- import "../react-to-web-component-CXwKHjZr.js";
2
- import { L as n, T as s } from "../index-CaxjbvSW.js";
3
- import "../index-BSe1av43.js";
4
- import "../index-T58UE-6b.js";
5
- import "../index-BziS9Had.js";
6
- import "../react-toastify.esm-CrTD7cpE.js";
1
+ import "../react-to-web-component-D7SoYMky.js";
2
+ import { L as n, T as s } from "../index-DkWIzRN3.js";
3
+ import "../index-Cx0zTfOC.js";
4
+ import "../index-B2-j-GrO.js";
5
+ import "../index-B8-7QZsi.js";
6
+ import "../react-toastify.esm-Y1WvK90L.js";
7
7
  import "../toast-config/index.js";
8
8
  import "../toast-config-notification/index.js";
9
9
  export {
@@ -1,6 +1,6 @@
1
- import "../react-to-web-component-CXwKHjZr.js";
2
- import { H as e, g as m } from "../index-CaxjbvSW.js";
3
- import "../index-BziS9Had.js";
1
+ import "../react-to-web-component-D7SoYMky.js";
2
+ import { H as e, g as m } from "../index-DkWIzRN3.js";
3
+ import "../index-B8-7QZsi.js";
4
4
  export {
5
5
  e as HasPermission,
6
6
  m as getUseHasPermission
@@ -1,4 +1,4 @@
1
- import { r as $, c as ce, g as Jt, s as Xt, j as E } from "./react-to-web-component-CXwKHjZr.js";
1
+ import { r as $, c as ce, g as Jt, s as Xt, j as E } from "./react-to-web-component-D7SoYMky.js";
2
2
  import { _ as Wt, a as Y } from "./setPrototypeOf-BVKdEITT.js";
3
3
  function Gt(i, e) {
4
4
  for (var t = 0; t < e.length; t++) {