@ukpc-lib/react 0.12.1-dev.9 → 0.13.1-dev.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.
Files changed (26) hide show
  1. package/dist/components/FavoriteMenu/components/MenuItem.d.ts +1 -1
  2. package/dist/components/FavoriteMenu/models/MenuItemDto.d.ts +1 -0
  3. package/dist/components/index.cjs +9 -9
  4. package/dist/components/index.js +8 -8
  5. package/dist/{index.esm2017-DIs_XI9p.cjs → index.esm2017-CzVNnCiI.cjs} +4 -4
  6. package/dist/{index.esm2017-D13q7k3i.js → index.esm2017-I88kEk_g.js} +21 -10
  7. package/dist/share/hooks/index.d.ts +1 -0
  8. package/dist/share/hooks/useSyncRouter.d.ts +7 -0
  9. package/dist/share/index.cjs +1 -1
  10. package/dist/share/index.js +71 -50
  11. package/package.json +1 -1
  12. package/web-components-bundle/access-denied/index.js +2 -2
  13. package/web-components-bundle/base-breadcrumbs/index.js +2 -2
  14. package/web-components-bundle/favorite-menu/index.js +4 -4
  15. package/web-components-bundle/global-menu/index.js +4 -4
  16. package/web-components-bundle/global-topbar/index.js +6 -6
  17. package/web-components-bundle/has-permission/index.js +3 -3
  18. package/web-components-bundle/{index-T58UE-6b.js → index-B2-j-GrO.js} +1 -1
  19. package/web-components-bundle/{index-BziS9Had.js → index-B8-7QZsi.js} +593 -593
  20. package/web-components-bundle/{index-DSZn86FM.js → index-CXQLVfRc.js} +30 -19
  21. package/web-components-bundle/{index-BSe1av43.js → index-Cx0zTfOC.js} +1 -1
  22. package/web-components-bundle/page-not-found/index.js +2 -2
  23. package/web-components-bundle/{react-to-web-component-CXwKHjZr.js → react-to-web-component-D7SoYMky.js} +1535 -1527
  24. package/web-components-bundle/{react-toastify.esm-CrTD7cpE.js → react-toastify.esm-Y1WvK90L.js} +1 -1
  25. package/web-components-bundle/toast-config/index.js +2 -2
  26. package/web-components-bundle/toast-config-notification/index.js +2 -2
@@ -6,8 +6,8 @@ import bI from "axios";
6
6
  import wI from "moment";
7
7
  import { createTheme as xI, ThemeProvider as SI, Grid as TI, CircularProgress as CI, Tooltip as Ld, styled as EI, Switch as kI } from "@mui/material";
8
8
  import { useQuery as zv, useQueryClient as nT } from "react-query";
9
- import "@r2wc/react-to-web-component";
10
9
  import { Link as rT, useLocation as iT } from "react-router-dom";
10
+ import "@r2wc/react-to-web-component";
11
11
  import { createPortal as Yv } from "react-dom";
12
12
  function DI(t, e) {
13
13
  for (var n = 0; n < e.length; n++) {
@@ -2146,13 +2146,24 @@ const A0 = (t) => {
2146
2146
  function fM(t, e) {
2147
2147
  var o, a, c, d, p, w, m, T, E;
2148
2148
  const n = t.config, r = ((a = (o = t.response) == null ? void 0 : o.data) == null ? void 0 : a.errorMessage) || ((d = (c = t.response) == null ? void 0 : c.data) == null ? void 0 : d.message), i = r === lM.TOKEN_EXPIRED;
2149
- return ((p = t.response) == null ? void 0 : p.status) === 401 && i && !n._retry ? Mg ? new Promise((I, A) => {
2150
- Bm.push({ resolve: I, reject: A });
2151
- }).then(() => da(n)).catch((I) => Promise.reject(I)) : (n._retry = !0, Mg = !0, da.post("/authentication/api/v1/auth/refresh-token", void 0, {
2152
- baseURL: window.env.AUTHEN_DOMAIN
2153
- }).then(() => (A0(null), da(n))).catch((I) => (A0(I), Promise.reject(I))).finally(() => {
2154
- Mg = !1;
2155
- })) : ((w = t.response) == null ? void 0 : w.status) === 401 && !i ? uM(window.env.AUTHEN_DOMAIN) : (((m = t.response) == null ? void 0 : m.status) === 403 ? (T = e == null ? void 0 : e.handle403) == null || T.call(e, t) : (!(e != null && e.disabledPushNotify) && Bp(fT(`${r || "Something went wrong!"}`)), (E = e == null ? void 0 : e.handleOtherError) == null || E.call(e, t)), r && t.response && t.response.data && (t.response.data.message = r), Promise.reject(t));
2149
+ if (((p = t.response) == null ? void 0 : p.status) === 401 && i && !n._retry)
2150
+ return Mg ? new Promise((I, A) => {
2151
+ Bm.push({ resolve: I, reject: A });
2152
+ }).then(() => da(n)).catch((I) => Promise.reject(I)) : (n._retry = !0, Mg = !0, da.post("/authentication/api/v1/auth/refresh-token", void 0, {
2153
+ baseURL: window.env.AUTHEN_DOMAIN
2154
+ }).then(() => (A0(null), da(n))).catch((I) => (A0(I), Promise.reject(I))).finally(() => {
2155
+ Mg = !1;
2156
+ }));
2157
+ if (((w = t.response) == null ? void 0 : w.status) === 401 && !i) {
2158
+ if (window.self !== window.top && window.top) {
2159
+ console.log("401 - IFRAME");
2160
+ const I = `${window.env.AUTHEN_DOMAIN || window.top.origin}/authentication/login`;
2161
+ window.top.location.href = I;
2162
+ return;
2163
+ }
2164
+ return uM(window.env.AUTHEN_DOMAIN);
2165
+ }
2166
+ return ((m = t.response) == null ? void 0 : m.status) === 403 ? (T = e == null ? void 0 : e.handle403) == null || T.call(e, t) : (!(e != null && e.disabledPushNotify) && Bp(fT(`${r || "Something went wrong!"}`)), (E = e == null ? void 0 : e.handleOtherError) == null || E.call(e, t)), r && t.response && t.response.data && (t.response.data.message = r), Promise.reject(t);
2156
2167
  }
2157
2168
  const LY = da.interceptors.response.use(
2158
2169
  (t) => t,
@@ -19300,7 +19311,7 @@ function UD({ ...t }) {
19300
19311
  var se, ue, He;
19301
19312
  const e = t.item, n = t.level || 0, r = !!((se = t.item.children) != null && se.length), i = `level-${n}`, o = (Ae, Me = i) => `${Ae} ${Me} `, [a, c] = tn(!1), [d, p] = tn(e.isFavorite || !1), w = un(), m = un();
19302
19313
  m != null && m.current && ((ue = m == null ? void 0 : m.current) == null ? void 0 : ue.scrollWidth) > ((He = m == null ? void 0 : m.current) == null ? void 0 : He.clientWidth);
19303
- const T = window.location.origin, E = e.path && e.path.includes("http") ? new URL(e.path) : { origin: "", pathname: "" }, I = window.location.pathname.split("/")[1], A = E.pathname.split("/")[1], L = t.ssr || !T.includes("local") && T !== E.origin || A !== I, _ = r || n === 0 ? "div" : L ? "a" : rT, U = e.path || "#", G = n + 1, ne = r && a && n > 0, K = () => {
19314
+ const T = window.location.origin, E = e.path && e.path.includes("http") ? new URL(e.path) : { origin: "", pathname: "" }, I = window.location.pathname.split("/")[1], A = E.pathname.split("/")[1], L = t.ssr || !T.includes("local") && T !== E.origin || A !== I, _ = r || n === 0 ? "div" : L ? "a" : rT, U = e.redirectUrl || e.path || "#", G = n + 1, ne = r && a && n > 0, K = () => {
19304
19315
  c(!0);
19305
19316
  }, le = () => {
19306
19317
  c(!1);
@@ -29699,7 +29710,7 @@ function ZD({ ...t }) {
29699
29710
  }, [t.item.isFavorite]);
29700
29711
  const _ = un(), U = un();
29701
29712
  U != null && U.current && ((We = U == null ? void 0 : U.current) == null ? void 0 : We.scrollWidth) > ((Qe = U == null ? void 0 : U.current) == null ? void 0 : Qe.clientWidth);
29702
- const G = window.location.origin, ne = e.path && e.path.includes("http") ? new URL(e.path) : { origin: "", pathname: "" }, K = window.location.pathname.split("/")[1], le = ne.pathname.split("/")[1], S = !t.isInternalApp || t.item.redirectUrl || t.ssr || !G.includes("local") && G !== ne.origin || le !== K, se = r ? "div" : S ? "a" : rT, ue = e.redirectUrl || e.path || "#", He = n + 1, Ae = r && o && E, Me = o || n === 0 ? void 0 : `${n + 0.25}rem`, $e = () => {
29713
+ const G = window.location.origin, ne = e.path && e.path.includes("http") ? new URL(e.path) : { origin: "", pathname: "" }, K = window.location.pathname.split("/")[1], le = ne.pathname.split("/")[1], S = t.item.redirectUrl || t.ssr || !G.includes("local") && G !== ne.origin || le !== K, se = r ? "div" : !t.isInternalApp && S ? "a" : rT, ue = e.redirectUrl || e.path || "#", He = n + 1, Ae = r && o && E, Me = o || n === 0 ? void 0 : `${n + 0.25}rem`, $e = () => {
29703
29714
  I(!0);
29704
29715
  }, Ue = () => {
29705
29716
  I(!1);
@@ -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-DIs_XI9p.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-CzVNnCiI.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-D13q7k3i.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-I88kEk_g.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.9",
4
+ "version": "0.13.1-dev.1",
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-DSZn86FM.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-CXQLVfRc.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-DSZn86FM.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-CXQLVfRc.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-DSZn86FM.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-CXQLVfRc.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-DSZn86FM.js";
3
- import "../index-BziS9Had.js";
1
+ import "../react-to-web-component-D7SoYMky.js";
2
+ import { H as e, g as m } from "../index-CXQLVfRc.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++) {