@ukpc-lib/react 0.16.14-sandbox.saas-10034.patch-1 → 0.16.14-sandbox.saas-11110.patch-2

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-Dw3tgMVc.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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.esm2017-CqhBudvU.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,5 +1,5 @@
1
- import { K as p, U as l } from "../index.esm2017-Cy32VkfF.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-Cy32VkfF.js";
1
+ import { M as p, U as l } from "../index.esm2017-CT0l1W0e.js";
2
+ import { O as L, R as M, T as N, a6 as O, a3 as _, X as $, a as j, c as D, a4 as F, Y as X, Z as q, V as z, W as V, a0 as Y, $ as Z, v as J, a5 as K, s as Q, t as W, a1 as b, e as ee, u as se, j as oe, a2 as re } from "../index.esm2017-CT0l1W0e.js";
3
3
  import d from "axios";
4
4
  import { useState as f, useEffect as u, useMemo as h } from "react";
5
5
  import { useLocation as w } from "react-router-dom";
@@ -71,18 +71,18 @@ export {
71
71
  O as SaasThemeProvider,
72
72
  _ as TranslationProvider,
73
73
  $ as X_AUTO_CANCEL,
74
- D as axiosInstance,
75
- F as color,
76
- X as createCustomTheme,
74
+ j as axiosInstance,
75
+ D as color,
76
+ F as createCustomTheme,
77
77
  m as getUseHasPermission,
78
- j as handleErrorAxios,
78
+ X as handleErrorAxios,
79
79
  q as isCanceledError,
80
80
  z as login,
81
- K as logout,
82
- V as requestInterceptor,
83
- Y as responseInterceptor,
84
- Z as search,
85
- J as setFavicon,
81
+ V as logout,
82
+ Y as requestInterceptor,
83
+ Z as responseInterceptor,
84
+ J as search,
85
+ K as setFavicon,
86
86
  Q as setShellBackdrop,
87
87
  W as translate,
88
88
  b as translationConfig,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.16.14-sandbox.saas-10034.patch-1",
4
+ "version": "0.16.14-sandbox.saas-11110.patch-2",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -113,4 +113,4 @@
113
113
  "author": "Thinh Phung",
114
114
  "description": "React components library",
115
115
  "license": "ISC"
116
- }
116
+ }
@@ -1,6 +1,6 @@
1
1
  import "../react-to-web-component-BOygDorD.js";
2
- import { F, u as v } from "../index-c4xbjALW.js";
3
- import "../index-DFUmn1bB.js";
2
+ import { F, u as v } from "../index-CZ3ghcEr.js";
3
+ import "../index-BwEhsh9S.js";
4
4
  import "../index-760z9lEs.js";
5
5
  import "../react-toastify.esm-DnABvuky.js";
6
6
  import "../toast-config/index.js";
@@ -1,6 +1,6 @@
1
1
  import "../react-to-web-component-BOygDorD.js";
2
- import { G as e } from "../index-c4xbjALW.js";
3
- import "../index-DFUmn1bB.js";
2
+ import { G as e } from "../index-CZ3ghcEr.js";
3
+ import "../index-BwEhsh9S.js";
4
4
  import "../index-760z9lEs.js";
5
5
  import "../SaasThemeProvider-A_eMJWqw.js";
6
6
  import "../index-CiYHK3Rq.js";
@@ -1,6 +1,6 @@
1
1
  import "../react-to-web-component-BOygDorD.js";
2
- import { L as s, T as L } from "../index-c4xbjALW.js";
3
- import "../index-DFUmn1bB.js";
2
+ import { L as s, T as L } from "../index-CZ3ghcEr.js";
3
+ import "../index-BwEhsh9S.js";
4
4
  import "../index-CiYHK3Rq.js";
5
5
  import "../index-760z9lEs.js";
6
6
  import "../SaasThemeProvider-A_eMJWqw.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-BOygDorD.js";
2
- import { H as o, g as r } from "../index-c4xbjALW.js";
2
+ import { H as o, g as r } from "../index-CZ3ghcEr.js";
3
3
  export {
4
4
  o as HasPermission,
5
5
  r as getUseHasPermission
@@ -9,7 +9,7 @@ function d({ children: t, styles: o = [], ...i }) {
9
9
  }
10
10
  const c = ".pnf-button-primary{font-size:14px;background-color:var(--primary300);color:var(--buttonText);padding:8px 24px;border-radius:4px;border:none;cursor:pointer;transition:background-color .25s cubic-bezier(.4,0,.2,1),box-shadow .25s cubic-bezier(.4,0,.2,1),border-color .25s cubic-bezier(.4,0,.2,1),color .25s cubic-bezier(.4,0,.2,1)}.pnf-button-primary:hover{background-color:var(--buttonHover)}.pnf-container{padding-top:16px;padding-bottom:16px;gap:16px;display:flex;flex-direction:column;align-items:center;font-family:inherit}.pnf-content-wrapper{display:flex;flex-direction:column;gap:8px;align-items:center}.pnf-title{text-align:center;font-size:1.25rem;font-weight:500;margin:0}.pnf-description{text-align:center;color:#85858a;font-size:.875rem;font-weight:400;margin:0}", p = () => {
11
11
  const t = () => {
12
- window.location.href = `${window.location.origin}/home`;
12
+ window.top && (window.top.location.href = "/app/home");
13
13
  }, { colors: o } = s();
14
14
  return /* @__PURE__ */ e.jsx(d, { styles: [c], children: /* @__PURE__ */ e.jsxs("div", { className: "pnf-container", children: [
15
15
  /* @__PURE__ */ e.jsx(