@ukpc-lib/react 0.16.5-sandbox.poms-1875.patch-3 → 0.16.5

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-CnDCNrk-.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.X_AUTO_CANCEL=e.X_AUTO_CANCEL;exports.axiosInstance=e.axiosInstance;exports.color=e.color;exports.createCustomTheme=e.createCustomTheme;exports.handleErrorAxios=e.handleErrorAxios;exports.isCanceledError=e.isCanceledError;exports.login=e.login;exports.logout=e.logout;exports.requestInterceptor=e.requestInterceptor;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-B5CLzdVt.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,47 +1,47 @@
1
- import { K as d, U as p } from "../index.esm2017-CeJW_DxL.js";
2
- import { M as N, O, R as _, a5 as $, a2 as z, X as D, a as L, c as X, a3 as j, W as q, Y as K, T as V, V as W, $ as Y, Z, r as J, a4 as Q, s as b, t as oo, a0 as eo, e as so, u as to, i as ro, a1 as no } from "../index.esm2017-CeJW_DxL.js";
3
- import g from "axios";
4
- import { useState as f, useEffect as i, useMemo as h } from "react";
1
+ import { K as d, U as g } from "../index.esm2017-DedBSRLV.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, t as J, Y as Q, e as b, u as oo, i as eo, Z as so } from "../index.esm2017-DedBSRLV.js";
3
+ import p from "axios";
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";
6
- import { jsx as c, Fragment as u } from "react/jsx-runtime";
6
+ import { jsx as u, Fragment as c } from "react/jsx-runtime";
7
7
  import "@r2wc/react-to-web-component";
8
8
  import "@mui/material";
9
9
  import "react-query";
10
10
  import "react-dom";
11
11
  import "moment";
12
12
  const H = (e) => {
13
- const [n, s] = f([]);
14
- return i(() => {
15
- g.get(`${e}/user-management/api/v1/users/my-account/permissions`, {
13
+ const [r, s] = f([]);
14
+ return a(() => {
15
+ p.get(`${e}/user-management/api/v1/users/my-account/permissions`, {
16
16
  withCredentials: !0
17
17
  }).then((t) => s(t.data)).catch((t) => {
18
18
  console.error("Getting user permission error:", t);
19
19
  });
20
- }, [e]), n;
20
+ }, [e]), r;
21
21
  }, M = (e) => {
22
- const n = w(), s = P();
22
+ const r = w(), s = P();
23
23
  console.log(
24
24
  " useSyncRouter.tsx ~ location1:",
25
25
  s,
26
26
  window.location.pathname
27
27
  );
28
- const t = (r = s) => (e || "") + r.pathname + r.search + r.hash;
29
- if (i(() => {
30
- const r = {
28
+ const t = (n = s) => (e || "") + n.pathname + n.search + n.hash;
29
+ if (a(() => {
30
+ const n = {
31
31
  changeRoute: (o) => {
32
- const a = t();
33
- if (typeof o == "string" && a !== o) {
34
- console.log(" useSyncRouter.tsx ~ location2:", a, o);
32
+ const i = t();
33
+ if (typeof o == "string" && i !== o) {
34
+ console.log(" useSyncRouter.tsx ~ location2:", i, o);
35
35
  const m = e && o.startsWith(e) ? o.substring(e.length) : o;
36
- n(m);
36
+ r(m);
37
37
  }
38
38
  }
39
39
  };
40
- window.MicrofeBridge = r;
41
- }, [n, s]), i(() => {
42
- var o, a;
43
- const r = t();
44
- console.log("fullPath1", window.location.pathname, r), (a = (o = window.parent) == null ? void 0 : o.HostBridge) == null || a.childRouteChange(r);
40
+ window.MicrofeBridge = n;
41
+ }, [r, s]), a(() => {
42
+ var o, i;
43
+ const n = t();
44
+ console.log("fullPath1", window.location.pathname, n), (i = (o = window.parent) == null ? void 0 : o.HostBridge) == null || i.childRouteChange(n);
45
45
  }, [s]), window.self === window.top) {
46
46
  console.log("useSyncRouter: Navigate to /app path"), window.location.href = window.location.href.replace(
47
47
  window.origin,
@@ -52,63 +52,60 @@ const H = (e) => {
52
52
  };
53
53
  function k({
54
54
  open: e,
55
- disabled: n
55
+ disabled: r
56
56
  }) {
57
57
  h(() => {
58
- var s, t, r, o;
59
- n || (e ? (t = (s = window.top) == null ? void 0 : s.HostBridge) == null || t.openBackdrop(!0) : (o = (r = window.top) == null ? void 0 : r.HostBridge) == null || o.openBackdrop(!1));
60
- }, [e, n]);
58
+ var s, t, n, o;
59
+ r || (e ? (t = (s = window.top) == null ? void 0 : s.HostBridge) == null || t.openBackdrop(!0) : (o = (n = window.top) == null ? void 0 : n.HostBridge) == null || o.openBackdrop(!1));
60
+ }, [e, r]);
61
61
  }
62
- const l = (e, n) => (s, t) => {
62
+ const l = (e, r) => (s, t) => {
63
63
  const o = d({
64
- axiosInstance: n,
64
+ axiosInstance: r,
65
65
  baseUrl: e
66
66
  }).data;
67
67
  return o ? t ? s.every(
68
- (a) => o == null ? void 0 : o.includes(a)
68
+ (i) => o == null ? void 0 : o.includes(i)
69
69
  ) : s.some(
70
- (a) => o == null ? void 0 : o.includes(a)
70
+ (i) => o == null ? void 0 : o.includes(i)
71
71
  ) : !1;
72
72
  }, F = ({
73
73
  baseUrl: e,
74
- accessWith: n,
74
+ accessWith: r,
75
75
  requireAll: s,
76
76
  children: t
77
- }) => l(e)(n, s) ? /* @__PURE__ */ c(u, { children: t }) : null, U = ({
77
+ }) => l(e)(r, s) ? /* @__PURE__ */ u(c, { children: t }) : null, G = ({
78
78
  accessWith: e,
79
- requireAll: n,
79
+ requireAll: r,
80
80
  baseUrl: s,
81
81
  children: t
82
- }) => l(s)(e, n) ? /* @__PURE__ */ c(u, { children: t }) : /* @__PURE__ */ c(p, {});
82
+ }) => l(s)(e, r) ? /* @__PURE__ */ u(c, { children: t }) : /* @__PURE__ */ u(g, {});
83
83
  export {
84
- N as AuthContext,
85
- O as AuthProvider,
86
- _ as ERROR_MESSAGE,
84
+ z as AuthContext,
85
+ D as AuthProvider,
86
+ I as ERROR_MESSAGE,
87
87
  F as HasPermission,
88
- U as PermissionRoute,
89
- $ as SaasThemeProvider,
90
- z as TranslationProvider,
91
- D as X_AUTO_CANCEL,
92
- L as axiosInstance,
93
- X as color,
94
- j as createCustomTheme,
88
+ G as PermissionRoute,
89
+ N as SaasThemeProvider,
90
+ O as TranslationProvider,
91
+ j as axiosInstance,
92
+ K as color,
93
+ L as createCustomTheme,
95
94
  l as getUseHasPermission,
96
- q as handleErrorAxios,
97
- K as isCanceledError,
98
- V as login,
99
- W as logout,
100
- Y as requestInterceptor,
101
- Z as responseInterceptor,
102
- J as search,
103
- Q as setFavicon,
104
- b as setShellBackdrop,
105
- oo as translate,
106
- eo as translationConfig,
107
- so as useAuth,
108
- to as useCustomTranslation,
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,
103
+ Q as translationConfig,
104
+ b as useAuth,
105
+ oo as useCustomTranslation,
109
106
  H as useGetPermission,
110
107
  k as useSyncBackdrop,
111
108
  M as useSyncRouter,
112
- ro as useTheme,
113
- no as useTranslation
109
+ eo as useTheme,
110
+ so as useTranslation
114
111
  };
@@ -2,7 +2,6 @@ export declare const ERROR_MESSAGE: {
2
2
  TOKEN_MALFORMED: string;
3
3
  TOKEN_EXPIRED: string;
4
4
  };
5
- export declare const X_AUTO_CANCEL = "true";
6
5
  export declare const login: (baseURL: string) => void;
7
6
  export declare const logout: (baseURL: string) => void;
8
7
  declare const axiosInstance: import('axios').AxiosInstance;
@@ -12,7 +11,5 @@ export type HandleErrorOptions = {
12
11
  disabledPushNotify?: boolean;
13
12
  };
14
13
  export declare function handleErrorAxios(error: any, options?: HandleErrorOptions): void | Promise<import('axios').AxiosResponse<any, any>>;
15
- declare const requestInterceptor: number;
16
14
  declare const responseInterceptor: number;
17
- export declare function isCanceledError(error: any): boolean;
18
- export { axiosInstance, responseInterceptor, requestInterceptor };
15
+ export { axiosInstance, responseInterceptor };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.16.5-sandbox.poms-1875.patch-3",
4
+ "version": "0.16.5",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-w5r1Fs9q.js";
2
- import { F, u as v } from "../index-DCgJh3T2.js";
2
+ import { F, u as v } from "../index-CZ1XQeht.js";
3
3
  import "../index-N6zjI_u_.js";
4
4
  import "../index-BBl8HzU3.js";
5
5
  import "../react-toastify.esm-H_Xdunfj.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-w5r1Fs9q.js";
2
- import { G as e } from "../index-DCgJh3T2.js";
2
+ import { G as e } from "../index-CZ1XQeht.js";
3
3
  import "../index-N6zjI_u_.js";
4
4
  import "../index-BBl8HzU3.js";
5
5
  import "../SaasThemeProvider-DUpoV8xb.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-w5r1Fs9q.js";
2
- import { L as s, T as L } from "../index-DCgJh3T2.js";
2
+ import { L as s, T as L } from "../index-CZ1XQeht.js";
3
3
  import "../index-N6zjI_u_.js";
4
4
  import "../index-Ch-015PG.js";
5
5
  import "../index-BBl8HzU3.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-w5r1Fs9q.js";
2
- import { H as o, g as r } from "../index-DCgJh3T2.js";
2
+ import { H as o, g as r } from "../index-CZ1XQeht.js";
3
3
  export {
4
4
  o as HasPermission,
5
5
  r as getUseHasPermission