@ukpc-lib/react 0.16.9 → 0.16.10

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 +1 -1
  2. package/dist/components/index.js +2 -2
  3. package/dist/{index.esm2017-yIz-9T8s.cjs → index.esm2017-C_jhc-uY.cjs} +105 -105
  4. package/dist/{index.esm2017-CUkKs8g8.js → index.esm2017-DmaL4yoT.js} +6054 -6017
  5. package/dist/share/index.cjs +1 -1
  6. package/dist/share/index.js +54 -51
  7. package/dist/share/interceptor/index.d.ts +4 -1
  8. package/package.json +1 -1
  9. package/web-components-bundle/{SaasThemeProvider-A_eMJWqw.js → SaasThemeProvider-DUpoV8xb.js} +1 -1
  10. package/web-components-bundle/access-denied/index.js +2 -2
  11. package/web-components-bundle/base-breadcrumbs/index.js +3 -3
  12. package/web-components-bundle/favorite-menu/index.js +7 -7
  13. package/web-components-bundle/global-menu/index.js +6 -6
  14. package/web-components-bundle/global-topbar/index.js +7 -7
  15. package/web-components-bundle/has-permission/index.js +2 -2
  16. package/web-components-bundle/{index-760z9lEs.js → index-BBl8HzU3.js} +565 -565
  17. package/web-components-bundle/{index-CiYHK3Rq.js → index-Ch-015PG.js} +1 -1
  18. package/web-components-bundle/{index-BwEhsh9S.js → index-N6zjI_u_.js} +2 -2
  19. package/web-components-bundle/{index-D11feQm-.js → index-sOLfUmht.js} +7367 -7336
  20. package/web-components-bundle/page-not-found/index.js +3 -3
  21. package/web-components-bundle/{react-to-web-component-BOygDorD.js → react-to-web-component-w5r1Fs9q.js} +1527 -1535
  22. package/web-components-bundle/{react-toastify.esm-DnABvuky.js → react-toastify.esm-H_Xdunfj.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 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.esm2017-yIz-9T8s.cjs"),m=require("axios"),u=require("react"),d=require("react-router-dom"),a=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");require("react-query");require("react-dom");require("moment");const h=s=>{const[t,r]=u.useState([]);return u.useEffect(()=>{m.get(`${s}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(o=>r(o.data)).catch(o=>{console.error("Getting user permission error:",o)})},[s]),t},p=s=>{const t=d.useLocation();if(u.useEffect(()=>{var o,i;let r=t.pathname+t.search+t.hash;s&&!r.includes(s)&&(r=s+r),console.log("🚀 ~ PrivateLayout.tsx ~ fullPath:",r),(i=(o=window.top)==null?void 0:o.shellNavigate)==null||i.call(o,"/app"+r,{replace:!0})},[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}};function g({open:s,disabled:t}){u.useMemo(()=>{var r,o,i,n;t||(s?(o=(r=window.top)==null?void 0:r.HostBridge)==null||o.openBackdrop(!0):(n=(i=window.top)==null?void 0:i.HostBridge)==null||n.openBackdrop(!1))},[s,t])}const l=(s,t)=>(r,o)=>{const n=e.useUserPermissions({axiosInstance:t,baseUrl:s}).data;return n?o?r.every(c=>n==null?void 0:n.includes(c)):r.some(c=>n==null?void 0:n.includes(c)):!1},f=({baseUrl:s,accessWith:t,requireAll:r,children:o})=>l(s)(t,r)?a.jsx(a.Fragment,{children:o}):null,P=({accessWith:s,requireAll:t,baseUrl:r,children:o})=>l(r)(s,t)?a.jsx(a.Fragment,{children:o}):a.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=f;exports.PermissionRoute=P;exports.getUseHasPermission=l;exports.useGetPermission=h;exports.useSyncBackdrop=g;exports.useSyncRouter=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.esm2017-C_jhc-uY.cjs"),m=require("axios"),u=require("react"),d=require("react-router-dom"),a=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");require("react-query");require("react-dom");require("moment");const h=s=>{const[t,r]=u.useState([]);return u.useEffect(()=>{m.get(`${s}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(o=>r(o.data)).catch(o=>{console.error("Getting user permission error:",o)})},[s]),t},p=s=>{const t=d.useLocation();if(u.useEffect(()=>{var o,i;let r=t.pathname+t.search+t.hash;s&&!r.includes(s)&&(r=s+r),console.log("🚀 ~ PrivateLayout.tsx ~ fullPath:",r),(i=(o=window.top)==null?void 0:o.shellNavigate)==null||i.call(o,"/app"+r,{replace:!0})},[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}};function g({open:s,disabled:t}){u.useMemo(()=>{var r,o,i,n;t||(s?(o=(r=window.top)==null?void 0:r.HostBridge)==null||o.openBackdrop(!0):(n=(i=window.top)==null?void 0:i.HostBridge)==null||n.openBackdrop(!1))},[s,t])}const l=(s,t)=>(r,o)=>{const n=e.useUserPermissions({axiosInstance:t,baseUrl:s}).data;return n?o?r.every(c=>n==null?void 0:n.includes(c)):r.some(c=>n==null?void 0:n.includes(c)):!1},f=({baseUrl:s,accessWith:t,requireAll:r,children:o})=>l(s)(t,r)?a.jsx(a.Fragment,{children:o}):null,P=({accessWith:s,requireAll:t,baseUrl:r,children:o})=>l(r)(s,t)?a.jsx(a.Fragment,{children:o}):a.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=f;exports.PermissionRoute=P;exports.getUseHasPermission=l;exports.useGetPermission=h;exports.useSyncBackdrop=g;exports.useSyncRouter=p;
@@ -1,7 +1,7 @@
1
- import { K as p, U as l } from "../index.esm2017-CUkKs8g8.js";
2
- import { M as $, O as D, R as F, a2 as I, $ as L, a as N, c as O, a0 as j, W as z, T as K, V, X, r as Y, a1 as Z, s as _, t as q, Y as J, e as Q, u as W, i as b, Z as ee } from "../index.esm2017-CUkKs8g8.js";
3
- import f from "axios";
4
- import { useState as d, useEffect as u, useMemo as h } from "react";
1
+ import { K as p, U as l } from "../index.esm2017-DmaL4yoT.js";
2
+ import { M as L, O as M, R as N, a5 as O, a2 as _, X as $, a as D, c as F, a3 as X, W as j, Y as q, T as z, V as K, $ as V, Z as Y, r as Z, a4 as J, s as Q, t as W, a0 as b, e as ee, u as se, i as oe, a1 as re } from "../index.esm2017-DmaL4yoT.js";
3
+ import d from "axios";
4
+ import { useState as f, useEffect as u, useMemo as h } from "react";
5
5
  import { useLocation as w } from "react-router-dom";
6
6
  import { jsx as i, Fragment as c } from "react/jsx-runtime";
7
7
  import "@r2wc/react-to-web-component";
@@ -9,22 +9,22 @@ import "@mui/material";
9
9
  import "react-query";
10
10
  import "react-dom";
11
11
  import "moment";
12
- const C = (s) => {
13
- const [r, e] = d([]);
12
+ const y = (o) => {
13
+ const [r, e] = f([]);
14
14
  return u(() => {
15
- f.get(`${s}/user-management/api/v1/users/my-account/permissions`, {
15
+ d.get(`${o}/user-management/api/v1/users/my-account/permissions`, {
16
16
  withCredentials: !0
17
- }).then((o) => e(o.data)).catch((o) => {
18
- console.error("Getting user permission error:", o);
17
+ }).then((s) => e(s.data)).catch((s) => {
18
+ console.error("Getting user permission error:", s);
19
19
  });
20
- }, [s]), r;
21
- }, E = (s) => {
20
+ }, [o]), r;
21
+ }, B = (o) => {
22
22
  const r = w();
23
23
  if (u(() => {
24
- var o, a;
24
+ var s, a;
25
25
  let e = r.pathname + r.search + r.hash;
26
- s && !e.includes(s) && (e = s + e), console.log("🚀 ~ PrivateLayout.tsx ~ fullPath:", e), (a = (o = window.top) == null ? void 0 : o.shellNavigate) == null || a.call(o, "/app" + e, { replace: !0 });
27
- }, [r, s]), window.self === window.top) {
26
+ o && !e.includes(o) && (e = o + e), console.log("🚀 ~ PrivateLayout.tsx ~ fullPath:", e), (a = (s = window.top) == null ? void 0 : s.shellNavigate) == null || a.call(s, "/app" + e, { replace: !0 });
27
+ }, [r, o]), window.self === window.top) {
28
28
  console.log("useSyncRouter: Navigate to /app path"), window.location.href = window.location.href.replace(
29
29
  window.origin,
30
30
  `${window.origin}/app`
@@ -33,61 +33,64 @@ const C = (s) => {
33
33
  }
34
34
  };
35
35
  function k({
36
- open: s,
36
+ open: o,
37
37
  disabled: r
38
38
  }) {
39
39
  h(() => {
40
- var e, o, a, t;
41
- r || (s ? (o = (e = window.top) == null ? void 0 : e.HostBridge) == null || o.openBackdrop(!0) : (t = (a = window.top) == null ? void 0 : a.HostBridge) == null || t.openBackdrop(!1));
42
- }, [s, r]);
40
+ var e, s, a, t;
41
+ r || (o ? (s = (e = window.top) == null ? void 0 : e.HostBridge) == null || s.openBackdrop(!0) : (t = (a = window.top) == null ? void 0 : a.HostBridge) == null || t.openBackdrop(!1));
42
+ }, [o, r]);
43
43
  }
44
- const m = (s, r) => (e, o) => {
44
+ const m = (o, r) => (e, s) => {
45
45
  const t = p({
46
46
  axiosInstance: r,
47
- baseUrl: s
47
+ baseUrl: o
48
48
  }).data;
49
- return t ? o ? e.every(
49
+ return t ? s ? e.every(
50
50
  (n) => t == null ? void 0 : t.includes(n)
51
51
  ) : e.some(
52
52
  (n) => t == null ? void 0 : t.includes(n)
53
53
  ) : !1;
54
54
  }, H = ({
55
- baseUrl: s,
55
+ baseUrl: o,
56
56
  accessWith: r,
57
57
  requireAll: e,
58
- children: o
59
- }) => m(s)(r, e) ? /* @__PURE__ */ i(c, { children: o }) : null, G = ({
60
- accessWith: s,
58
+ children: s
59
+ }) => m(o)(r, e) ? /* @__PURE__ */ i(c, { children: s }) : null, U = ({
60
+ accessWith: o,
61
61
  requireAll: r,
62
62
  baseUrl: e,
63
- children: o
64
- }) => m(e)(s, r) ? /* @__PURE__ */ i(c, { children: o }) : /* @__PURE__ */ i(l, {});
63
+ children: s
64
+ }) => m(e)(o, r) ? /* @__PURE__ */ i(c, { children: s }) : /* @__PURE__ */ i(l, {});
65
65
  export {
66
- $ as AuthContext,
67
- D as AuthProvider,
68
- F as ERROR_MESSAGE,
66
+ L as AuthContext,
67
+ M as AuthProvider,
68
+ N as ERROR_MESSAGE,
69
69
  H as HasPermission,
70
- G as PermissionRoute,
71
- I as SaasThemeProvider,
72
- L as TranslationProvider,
73
- N as axiosInstance,
74
- O as color,
75
- j as createCustomTheme,
70
+ U as PermissionRoute,
71
+ O as SaasThemeProvider,
72
+ _ as TranslationProvider,
73
+ $ as X_AUTO_CANCEL,
74
+ D as axiosInstance,
75
+ F as color,
76
+ X as createCustomTheme,
76
77
  m as getUseHasPermission,
77
- z as handleErrorAxios,
78
- K as login,
79
- V as logout,
80
- X as responseInterceptor,
81
- Y as search,
82
- Z as setFavicon,
83
- _ as setShellBackdrop,
84
- q as translate,
85
- J as translationConfig,
86
- Q as useAuth,
87
- W as useCustomTranslation,
88
- C as useGetPermission,
78
+ j as handleErrorAxios,
79
+ q as isCanceledError,
80
+ z as login,
81
+ K as logout,
82
+ V as requestInterceptor,
83
+ Y as responseInterceptor,
84
+ Z as search,
85
+ J as setFavicon,
86
+ Q as setShellBackdrop,
87
+ W as translate,
88
+ b as translationConfig,
89
+ ee as useAuth,
90
+ se as useCustomTranslation,
91
+ y as useGetPermission,
89
92
  k as useSyncBackdrop,
90
- E as useSyncRouter,
91
- b as useTheme,
92
- ee as useTranslation
93
+ B as useSyncRouter,
94
+ oe as useTheme,
95
+ re as useTranslation
93
96
  };
@@ -2,6 +2,7 @@ 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";
5
6
  export declare const login: (baseURL: string) => void;
6
7
  export declare const logout: (baseURL: string) => void;
7
8
  declare const axiosInstance: import('axios').AxiosInstance;
@@ -11,5 +12,7 @@ export type HandleErrorOptions = {
11
12
  disabledPushNotify?: boolean;
12
13
  };
13
14
  export declare function handleErrorAxios(error: any, options?: HandleErrorOptions): void | Promise<import('axios').AxiosResponse<any, any>>;
15
+ declare const requestInterceptor: number;
14
16
  declare const responseInterceptor: number;
15
- export { axiosInstance, responseInterceptor };
17
+ export declare function isCanceledError(error: any): boolean;
18
+ export { axiosInstance, responseInterceptor, requestInterceptor };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.16.9",
4
+ "version": "0.16.10",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1,4 +1,4 @@
1
- import { a as j, r as b } from "./react-to-web-component-BOygDorD.js";
1
+ import { a as j, r as b } from "./react-to-web-component-w5r1Fs9q.js";
2
2
  function c() {
3
3
  return c = Object.assign ? Object.assign.bind() : function(t) {
4
4
  for (var e = 1; e < arguments.length; e++) {
@@ -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,6 +1,6 @@
1
- import "../react-to-web-component-BOygDorD.js";
2
- import { V as e } from "../index-760z9lEs.js";
3
- import "../SaasThemeProvider-A_eMJWqw.js";
1
+ import "../react-to-web-component-w5r1Fs9q.js";
2
+ import { V as e } from "../index-BBl8HzU3.js";
3
+ import "../SaasThemeProvider-DUpoV8xb.js";
4
4
  export {
5
5
  e as BaseBreadcrumbs
6
6
  };
@@ -1,12 +1,12 @@
1
- import "../react-to-web-component-BOygDorD.js";
2
- import { F, u as v } from "../index-D11feQm-.js";
3
- import "../index-BwEhsh9S.js";
4
- import "../index-760z9lEs.js";
5
- import "../react-toastify.esm-DnABvuky.js";
1
+ import "../react-to-web-component-w5r1Fs9q.js";
2
+ import { F, u as v } from "../index-sOLfUmht.js";
3
+ import "../index-N6zjI_u_.js";
4
+ import "../index-BBl8HzU3.js";
5
+ import "../react-toastify.esm-H_Xdunfj.js";
6
6
  import "../toast-config/index.js";
7
7
  import "../toast-config-notification/index.js";
8
- import "../SaasThemeProvider-A_eMJWqw.js";
9
- import "../index-CiYHK3Rq.js";
8
+ import "../SaasThemeProvider-DUpoV8xb.js";
9
+ import "../index-Ch-015PG.js";
10
10
  export {
11
11
  F as FavoriteMenu,
12
12
  v as updateFavoriteItems
@@ -1,9 +1,9 @@
1
- import "../react-to-web-component-BOygDorD.js";
2
- import { G as e } from "../index-D11feQm-.js";
3
- import "../index-BwEhsh9S.js";
4
- import "../index-760z9lEs.js";
5
- import "../SaasThemeProvider-A_eMJWqw.js";
6
- import "../index-CiYHK3Rq.js";
1
+ import "../react-to-web-component-w5r1Fs9q.js";
2
+ import { G as e } from "../index-sOLfUmht.js";
3
+ import "../index-N6zjI_u_.js";
4
+ import "../index-BBl8HzU3.js";
5
+ import "../SaasThemeProvider-DUpoV8xb.js";
6
+ import "../index-Ch-015PG.js";
7
7
  export {
8
8
  e as GlobalMenu
9
9
  };
@@ -1,10 +1,10 @@
1
- import "../react-to-web-component-BOygDorD.js";
2
- import { L as s, T as L } from "../index-D11feQm-.js";
3
- import "../index-BwEhsh9S.js";
4
- import "../index-CiYHK3Rq.js";
5
- import "../index-760z9lEs.js";
6
- import "../SaasThemeProvider-A_eMJWqw.js";
7
- import "../react-toastify.esm-DnABvuky.js";
1
+ import "../react-to-web-component-w5r1Fs9q.js";
2
+ import { L as s, T as L } from "../index-sOLfUmht.js";
3
+ import "../index-N6zjI_u_.js";
4
+ import "../index-Ch-015PG.js";
5
+ import "../index-BBl8HzU3.js";
6
+ import "../SaasThemeProvider-DUpoV8xb.js";
7
+ import "../react-toastify.esm-H_Xdunfj.js";
8
8
  import "../toast-config/index.js";
9
9
  import "../toast-config-notification/index.js";
10
10
  export {
@@ -1,5 +1,5 @@
1
- import "../react-to-web-component-BOygDorD.js";
2
- import { H as o, g as r } from "../index-D11feQm-.js";
1
+ import "../react-to-web-component-w5r1Fs9q.js";
2
+ import { H as o, g as r } from "../index-sOLfUmht.js";
3
3
  export {
4
4
  o as HasPermission,
5
5
  r as getUseHasPermission