@ukpc-lib/react 0.15.9-sandbox.saas-9249.patch-3 → 0.15.9-sandbox.saas-9249.patch-4

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.
@@ -4,4 +4,4 @@ declare global {
4
4
  HostBridge?: any;
5
5
  }
6
6
  }
7
- export declare const useSyncRouter: (basepath?: string) => void;
7
+ export declare const useSyncRouter: (prefix?: string) => void;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.esm2017-qAWyt7zI.cjs"),h=require("axios"),c=require("react"),l=require("react-router-dom"),u=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");const m=n=>{const[s,r]=c.useState([]);return c.useEffect(()=>{h.get(`${n}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(o=>r(o.data)).catch(o=>{console.error("Getting user permission error:",o)})},[n]),s},f=n=>{const s=l.useNavigate(),r=l.useLocation();console.log(" useSyncRouter.tsx ~ location1:",r,window.location.pathname);const o=(t=r)=>(n||"")+t.pathname+t.search+t.hash;if(c.useEffect(()=>{const t={changeRoute:i=>{const a=o();if(typeof i=="string"&&a!==i){console.log(" useSyncRouter.tsx ~ location2:",a,i);const g=n&&i.startsWith(n)?i.substring(n.length):i;s(g)}}};window.MicrofeBridge=t},[s,r]),c.useEffect(()=>{var i,a;const t=o();console.log("fullPath1",window.location.pathname,t),(a=(i=window.parent)==null?void 0:i.HostBridge)==null||a.childRouteChange(t)},[r]),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 w({open:n,disabled:s}){c.useMemo(()=>{var r,o,t,i;s||(n?(o=(r=window.top)==null?void 0:r.HostBridge)==null||o.openBackdrop(!0):(i=(t=window.top)==null?void 0:t.HostBridge)==null||i.openBackdrop(!1))},[n,s])}const d=n=>(s,r)=>{const o=m(n);return r?s.every(t=>o==null?void 0:o.includes(t)):s.some(t=>o==null?void 0:o.includes(t))},P=({baseUrl:n,accessWith:s,requireAll:r,children:o})=>d(n)(s,r)?u.jsx(u.Fragment,{children:o}):null,p=({accessWith:n,requireAll:s,baseUrl:r,unAuthorizedPath:o,children:t})=>d(r)(n,s)?u.jsx(u.Fragment,{children:t}):u.jsx(l.Navigate,{to:o,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.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=P;exports.PermissionRoute=p;exports.getUseHasPermission=d;exports.useGetPermission=m;exports.useSyncBackdrop=w;exports.useSyncRouter=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../index.esm2017-qAWyt7zI.cjs"),m=require("axios"),u=require("react"),c=require("react-router-dom"),i=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");const h=o=>{const[n,s]=u.useState([]);return u.useEffect(()=>{m.get(`${o}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(e=>s(e.data)).catch(e=>{console.error("Getting user permission error:",e)})},[o]),n},d=(o="/app")=>{const n=c.useNavigate(),s=c.useLocation();u.useEffect(()=>(window.hostNavigate=(e,t)=>{const a=s.pathname+s.search+s.hash;e!==a&&n(e,{replace:(t==null?void 0:t.replace)??!0})},()=>{delete window.hostNavigate}),[n,s]),u.useEffect(()=>{var t,a;const e=s.pathname+s.search+s.hash;(a=(t=window.top)==null?void 0:t.shellNavigate)==null||a.call(t,o+e,{replace:!0})},[s,o])};function g({open:o,disabled:n}){u.useMemo(()=>{var s,e,t,a;n||(o?(e=(s=window.top)==null?void 0:s.HostBridge)==null||e.openBackdrop(!0):(a=(t=window.top)==null?void 0:t.HostBridge)==null||a.openBackdrop(!1))},[o,n])}const l=o=>(n,s)=>{const e=h(o);return s?n.every(t=>e==null?void 0:e.includes(t)):n.some(t=>e==null?void 0:e.includes(t))},P=({baseUrl:o,accessWith:n,requireAll:s,children:e})=>l(o)(n,s)?i.jsx(i.Fragment,{children:e}):null,p=({accessWith:o,requireAll:n,baseUrl:s,unAuthorizedPath:e,children:t})=>l(s)(o,n)?i.jsx(i.Fragment,{children:t}):i.jsx(c.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.setShellBackdrop=r.setShellBackdrop;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=P;exports.PermissionRoute=p;exports.getUseHasPermission=l;exports.useGetPermission=h;exports.useSyncBackdrop=g;exports.useSyncRouter=d;
@@ -1,105 +1,86 @@
1
- import { O as F, R as M, T as G, a2 as N, $, a as I, c as O, a0 as j, W as z, U as L, V as U, X as V, w as W, a1 as X, s as Y, t as Z, Y as _, e as q, u as D, i as J, Z as K } from "../index.esm2017-tcuviKS1.js";
2
- import d from "axios";
3
- import { useState as g, useEffect as i, useMemo as h } from "react";
4
- import { useNavigate as w, useLocation as f, Navigate as p } from "react-router-dom";
5
- import { jsx as c, Fragment as u } from "react/jsx-runtime";
1
+ import { O as k, R as y, T as H, a2 as G, $ as F, a as I, c as M, a0 as O, W as $, U as j, V as L, X as U, w as V, a1 as X, s as Y, t as Z, Y as _, e as q, u as z, i as D, Z as J } from "../index.esm2017-tcuviKS1.js";
2
+ import m from "axios";
3
+ import { useState as l, useEffect as n, useMemo as h } from "react";
4
+ import { useNavigate as p, useLocation as d, Navigate as f } from "react-router-dom";
5
+ import { jsx as i, Fragment as u } from "react/jsx-runtime";
6
6
  import "@r2wc/react-to-web-component";
7
7
  import "@mui/material";
8
- const P = (s) => {
9
- const [n, t] = g([]);
10
- return i(() => {
11
- d.get(`${s}/user-management/api/v1/users/my-account/permissions`, {
8
+ const g = (r) => {
9
+ const [a, s] = l([]);
10
+ return n(() => {
11
+ m.get(`${r}/user-management/api/v1/users/my-account/permissions`, {
12
12
  withCredentials: !0
13
- }).then((o) => t(o.data)).catch((o) => {
14
- console.error("Getting user permission error:", o);
13
+ }).then((e) => s(e.data)).catch((e) => {
14
+ console.error("Getting user permission error:", e);
15
15
  });
16
- }, [s]), n;
17
- }, T = (s) => {
18
- const n = w(), t = f();
19
- console.log(
20
- " useSyncRouter.tsx ~ location1:",
21
- t,
22
- window.location.pathname
23
- );
24
- const o = (e = t) => (s || "") + e.pathname + e.search + e.hash;
25
- if (i(() => {
26
- const e = {
27
- changeRoute: (r) => {
28
- const a = o();
29
- if (typeof r == "string" && a !== r) {
30
- console.log(" useSyncRouter.tsx ~ location2:", a, r);
31
- const m = s && r.startsWith(s) ? r.substring(s.length) : r;
32
- n(m);
33
- }
34
- }
35
- };
36
- window.MicrofeBridge = e;
37
- }, [n, t]), i(() => {
38
- var r, a;
39
- const e = o();
40
- console.log("fullPath1", window.location.pathname, e), (a = (r = window.parent) == null ? void 0 : r.HostBridge) == null || a.childRouteChange(e);
41
- }, [t]), window.self === window.top) {
42
- console.log("useSyncRouter: Navigate to /app path"), window.location.href = window.location.href.replace(
43
- window.origin,
44
- `${window.origin}/app`
45
- );
46
- return;
47
- }
16
+ }, [r]), a;
17
+ }, B = (r = "/app") => {
18
+ const a = p(), s = d();
19
+ n(() => (window.hostNavigate = (e, t) => {
20
+ const o = s.pathname + s.search + s.hash;
21
+ e !== o && a(e, { replace: (t == null ? void 0 : t.replace) ?? !0 });
22
+ }, () => {
23
+ delete window.hostNavigate;
24
+ }), [a, s]), n(() => {
25
+ var t, o;
26
+ const e = s.pathname + s.search + s.hash;
27
+ (o = (t = window.top) == null ? void 0 : t.shellNavigate) == null || o.call(t, r + e, { replace: !0 });
28
+ }, [s, r]);
48
29
  };
49
- function C({
50
- open: s,
51
- disabled: n
30
+ function R({
31
+ open: r,
32
+ disabled: a
52
33
  }) {
53
34
  h(() => {
54
- var t, o, e, r;
55
- n || (s ? (o = (t = window.top) == null ? void 0 : t.HostBridge) == null || o.openBackdrop(!0) : (r = (e = window.top) == null ? void 0 : e.HostBridge) == null || r.openBackdrop(!1));
56
- }, [s, n]);
35
+ var s, e, t, o;
36
+ a || (r ? (e = (s = window.top) == null ? void 0 : s.HostBridge) == null || e.openBackdrop(!0) : (o = (t = window.top) == null ? void 0 : t.HostBridge) == null || o.openBackdrop(!1));
37
+ }, [r, a]);
57
38
  }
58
- const l = (s) => (n, t) => {
59
- const o = P(s);
60
- return t ? n.every(
61
- (e) => o == null ? void 0 : o.includes(e)
62
- ) : n.some(
63
- (e) => o == null ? void 0 : o.includes(e)
39
+ const c = (r) => (a, s) => {
40
+ const e = g(r);
41
+ return s ? a.every(
42
+ (t) => e == null ? void 0 : e.includes(t)
43
+ ) : a.some(
44
+ (t) => e == null ? void 0 : e.includes(t)
64
45
  );
65
46
  }, A = ({
66
- baseUrl: s,
67
- accessWith: n,
68
- requireAll: t,
69
- children: o
70
- }) => l(s)(n, t) ? /* @__PURE__ */ c(u, { children: o }) : null, E = ({
71
- accessWith: s,
72
- requireAll: n,
73
- baseUrl: t,
74
- unAuthorizedPath: o,
47
+ baseUrl: r,
48
+ accessWith: a,
49
+ requireAll: s,
75
50
  children: e
76
- }) => l(t)(s, n) ? /* @__PURE__ */ c(u, { children: e }) : /* @__PURE__ */ c(p, { to: o, replace: !0 });
51
+ }) => c(r)(a, s) ? /* @__PURE__ */ i(u, { children: e }) : null, C = ({
52
+ accessWith: r,
53
+ requireAll: a,
54
+ baseUrl: s,
55
+ unAuthorizedPath: e,
56
+ children: t
57
+ }) => c(s)(r, a) ? /* @__PURE__ */ i(u, { children: t }) : /* @__PURE__ */ i(f, { to: e, replace: !0 });
77
58
  export {
78
- F as AuthContext,
79
- M as AuthProvider,
80
- G as ERROR_MESSAGE,
59
+ k as AuthContext,
60
+ y as AuthProvider,
61
+ H as ERROR_MESSAGE,
81
62
  A as HasPermission,
82
- E as PermissionRoute,
83
- N as SaasThemeProvider,
84
- $ as TranslationProvider,
63
+ C as PermissionRoute,
64
+ G as SaasThemeProvider,
65
+ F as TranslationProvider,
85
66
  I as axiosInstance,
86
- O as color,
87
- j as createCustomTheme,
88
- l as getUseHasPermission,
89
- z as handleErrorAxios,
90
- L as login,
91
- U as logout,
92
- V as responseInterceptor,
93
- W as search,
67
+ M as color,
68
+ O as createCustomTheme,
69
+ c as getUseHasPermission,
70
+ $ as handleErrorAxios,
71
+ j as login,
72
+ L as logout,
73
+ U as responseInterceptor,
74
+ V as search,
94
75
  X as setFavicon,
95
76
  Y as setShellBackdrop,
96
77
  Z as translate,
97
78
  _ as translationConfig,
98
79
  q as useAuth,
99
- D as useCustomTranslation,
100
- P as useGetPermission,
101
- C as useSyncBackdrop,
102
- T as useSyncRouter,
103
- J as useTheme,
104
- K as useTranslation
80
+ z as useCustomTranslation,
81
+ g as useGetPermission,
82
+ R as useSyncBackdrop,
83
+ B as useSyncRouter,
84
+ D as useTheme,
85
+ J as useTranslation
105
86
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.15.9-sandbox.saas-9249.patch-3",
4
+ "version": "0.15.9-sandbox.saas-9249.patch-4",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1,5 +1,5 @@
1
- import "../react-to-web-component-BOygDorD.js";
2
- import { U as e } from "../index-CiYHK3Rq.js";
1
+ import "../react-to-web-component-w5r1Fs9q.js";
2
+ import { U as e } from "../index-Ch-015PG.js";
3
3
  export {
4
4
  e as UnauthorizedPage
5
5
  };
@@ -1,5 +1,5 @@
1
- import "../react-to-web-component-BOygDorD.js";
2
- import { ae as m } from "../index-DzW7qqrH.js";
1
+ import "../react-to-web-component-w5r1Fs9q.js";
2
+ import { ae as m } from "../index-BU5SX9Tl.js";
3
3
  export {
4
4
  m as BaseBreadcrumbs
5
5
  };
@@ -1,7 +1,7 @@
1
- import "../react-to-web-component-BOygDorD.js";
2
- import { F as i, u as m } from "../index-CsRO9vuw.js";
3
- import "../index-BUE-pz1x.js";
4
- import "../index-DzW7qqrH.js";
1
+ import "../react-to-web-component-w5r1Fs9q.js";
2
+ import { F as i, u as m } from "../index-CkNwqMnZ.js";
3
+ import "../index-DqxmsDJs.js";
4
+ import "../index-BU5SX9Tl.js";
5
5
  export {
6
6
  i as FavoriteMenu,
7
7
  m as updateFavoriteItems
@@ -1,7 +1,7 @@
1
- import "../react-to-web-component-BOygDorD.js";
2
- import { G as i } from "../index-CsRO9vuw.js";
3
- import "../index-BUE-pz1x.js";
4
- import "../index-DzW7qqrH.js";
1
+ import "../react-to-web-component-w5r1Fs9q.js";
2
+ import { G as i } from "../index-CkNwqMnZ.js";
3
+ import "../index-DqxmsDJs.js";
4
+ import "../index-BU5SX9Tl.js";
5
5
  export {
6
6
  i as GlobalMenu
7
7
  };
@@ -1,9 +1,9 @@
1
- import "../react-to-web-component-BOygDorD.js";
2
- import { L as n, T as s } from "../index-CsRO9vuw.js";
3
- import "../index-BUE-pz1x.js";
4
- import "../index-CiYHK3Rq.js";
5
- import "../index-DzW7qqrH.js";
6
- import "../react-toastify.esm-DnABvuky.js";
1
+ import "../react-to-web-component-w5r1Fs9q.js";
2
+ import { L as n, T as s } from "../index-CkNwqMnZ.js";
3
+ import "../index-DqxmsDJs.js";
4
+ import "../index-Ch-015PG.js";
5
+ import "../index-BU5SX9Tl.js";
6
+ import "../react-toastify.esm-H_Xdunfj.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-BOygDorD.js";
2
- import { H as e, g as m } from "../index-CsRO9vuw.js";
3
- import "../index-DzW7qqrH.js";
1
+ import "../react-to-web-component-w5r1Fs9q.js";
2
+ import { H as e, g as m } from "../index-CkNwqMnZ.js";
3
+ import "../index-BU5SX9Tl.js";
4
4
  export {
5
5
  e as HasPermission,
6
6
  m as getUseHasPermission