@ukpc-lib/react 0.16.3-sandbox.saas-9356-and-saas-9249.patch-8 → 0.16.3-sandbox.saas-9356-and-saas-9249.patch-9

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 o=require("../index.esm2017-Bmj_1y8w.cjs"),d=require("axios"),a=require("react"),l=require("react-router-dom"),i=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");const m=r=>{const[t,s]=a.useState([]);return a.useEffect(()=>{d.get(`${r}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(e=>s(e.data)).catch(e=>{console.error("Getting user permission error:",e)})},[r]),t},h=r=>{const t=l.useLocation();if(a.useEffect(()=>{var e,n;let s=t.pathname+t.search+t.hash;r&&!s.includes(r)&&(s=r+s),console.log("🚀 ~ PrivateLayout.tsx ~ fullPath:",s),(n=(e=window.top)==null?void 0:e.shellNavigate)==null||n.call(e,"/app"+s,{replace:!0})},[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 p({open:r,disabled:t}){a.useMemo(()=>{var s,e,n,u;t||(r?(e=(s=window.top)==null?void 0:s.HostBridge)==null||e.openBackdrop(!0):(u=(n=window.top)==null?void 0:n.HostBridge)==null||u.openBackdrop(!1))},[r,t])}const c=r=>(t,s)=>{const e=m(r);return s?t.every(n=>e==null?void 0:e.includes(n)):t.some(n=>e==null?void 0:e.includes(n))},g=({baseUrl:r,accessWith:t,requireAll:s,children:e})=>c(r)(t,s)?i.jsx(i.Fragment,{children:e}):null,f=({accessWith:r,requireAll:t,baseUrl:s,unAuthorizedPath:e,children:n})=>c(s)(r,t)?i.jsx(i.Fragment,{children:n}):i.jsx(l.Navigate,{to:e,replace:!0});exports.AuthContext=o.AuthContext;exports.AuthProvider=o.AuthProvider;exports.ERROR_MESSAGE=o.ERROR_MESSAGE;exports.SaasThemeProvider=o.SaasThemeProvider;exports.TranslationProvider=o.TranslationProvider;exports.axiosInstance=o.axiosInstance;exports.color=o.color;exports.createCustomTheme=o.createCustomTheme;exports.handleErrorAxios=o.handleErrorAxios;exports.login=o.login;exports.logout=o.logout;exports.responseInterceptor=o.responseInterceptor;exports.search=o.search;exports.setFavicon=o.setFavicon;exports.setShellBackdrop=o.setShellBackdrop;exports.translate=o.translate;exports.translationConfig=o.translationConfig;exports.useAuth=o.useAuth;exports.useCustomTranslation=o.useCustomTranslation;exports.useTheme=o.useTheme;exports.useTranslation=o.useTranslation;exports.HasPermission=g;exports.PermissionRoute=f;exports.getUseHasPermission=c;exports.useGetPermission=m;exports.useSyncBackdrop=p;exports.useSyncRouter=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index.esm2017-BoRaaxH3.cjs"),d=require("axios"),a=require("react"),l=require("react-router-dom"),i=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");const m=r=>{const[t,s]=a.useState([]);return a.useEffect(()=>{d.get(`${r}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(e=>s(e.data)).catch(e=>{console.error("Getting user permission error:",e)})},[r]),t},h=r=>{const t=l.useLocation();if(a.useEffect(()=>{var e,n;let s=t.pathname+t.search+t.hash;r&&!s.includes(r)&&(s=r+s),console.log("🚀 ~ PrivateLayout.tsx ~ fullPath:",s),(n=(e=window.top)==null?void 0:e.shellNavigate)==null||n.call(e,"/app"+s,{replace:!0})},[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 p({open:r,disabled:t}){a.useMemo(()=>{var s,e,n,u;t||(r?(e=(s=window.top)==null?void 0:s.HostBridge)==null||e.openBackdrop(!0):(u=(n=window.top)==null?void 0:n.HostBridge)==null||u.openBackdrop(!1))},[r,t])}const c=r=>(t,s)=>{const e=m(r);return s?t.every(n=>e==null?void 0:e.includes(n)):t.some(n=>e==null?void 0:e.includes(n))},g=({baseUrl:r,accessWith:t,requireAll:s,children:e})=>c(r)(t,s)?i.jsx(i.Fragment,{children:e}):null,f=({accessWith:r,requireAll:t,baseUrl:s,unAuthorizedPath:e,children:n})=>c(s)(r,t)?i.jsx(i.Fragment,{children:n}):i.jsx(l.Navigate,{to:e,replace:!0});exports.AuthContext=o.AuthContext;exports.AuthProvider=o.AuthProvider;exports.ERROR_MESSAGE=o.ERROR_MESSAGE;exports.SaasThemeProvider=o.SaasThemeProvider;exports.TranslationProvider=o.TranslationProvider;exports.axiosInstance=o.axiosInstance;exports.color=o.color;exports.createCustomTheme=o.createCustomTheme;exports.handleErrorAxios=o.handleErrorAxios;exports.login=o.login;exports.logout=o.logout;exports.responseInterceptor=o.responseInterceptor;exports.search=o.search;exports.setFavicon=o.setFavicon;exports.setShellBackdrop=o.setShellBackdrop;exports.translate=o.translate;exports.translationConfig=o.translationConfig;exports.useAuth=o.useAuth;exports.useCustomTranslation=o.useCustomTranslation;exports.useTheme=o.useTheme;exports.useTranslation=o.useTranslation;exports.HasPermission=g;exports.PermissionRoute=f;exports.getUseHasPermission=c;exports.useGetPermission=m;exports.useSyncBackdrop=p;exports.useSyncRouter=h;
@@ -1,4 +1,4 @@
1
- import { M as E, O as k, R as H, a1 as G, Z as M, a as N, c as $, $ as F, V as I, T as L, U as O, W as j, v as U, a0 as V, s as X, t as Y, X as Z, e as _, u as q, i as z, Y as D } from "../index.esm2017-YfeFmA6k.js";
1
+ import { M as E, O as k, R as H, a1 as G, Z as M, a as N, c as $, $ as F, V as I, T as L, U as O, W as j, v as U, a0 as V, s as X, t as Y, X as Z, e as _, u as q, i as z, Y as D } from "../index.esm2017-BK8RVypM.js";
2
2
  import l from "axios";
3
3
  import { useState as m, useEffect as i, useMemo as p } from "react";
4
4
  import { useLocation as d, Navigate as f } from "react-router-dom";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.16.3-sandbox.saas-9356-and-saas-9249.patch-8",
4
+ "version": "0.16.3-sandbox.saas-9356-and-saas-9249.patch-9",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-BOygDorD.js";
2
- import { U as e } from "../index-Giq9sshx.js";
2
+ import { U as e } from "../index-AkYRIjMa.js";
3
3
  import "../index-omnj2VPv.js";
4
4
  export {
5
5
  e as UnauthorizedPage
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-BOygDorD.js";
2
- import { F as i, u as m } from "../index-Giq9sshx.js";
2
+ import { F as i, u as m } from "../index-AkYRIjMa.js";
3
3
  import "../index-BUE-pz1x.js";
4
4
  import "../index-omnj2VPv.js";
5
5
  export {
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-BOygDorD.js";
2
- import { G as i } from "../index-Giq9sshx.js";
2
+ import { G as i } from "../index-AkYRIjMa.js";
3
3
  import "../index-BUE-pz1x.js";
4
4
  import "../index-omnj2VPv.js";
5
5
  export {
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-BOygDorD.js";
2
- import { L as g, T as n } from "../index-Giq9sshx.js";
2
+ import { L as g, T as n } from "../index-AkYRIjMa.js";
3
3
  import "../index-BUE-pz1x.js";
4
4
  import "../index-omnj2VPv.js";
5
5
  import "../react-toastify.esm-DnABvuky.js";
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-BOygDorD.js";
2
- import { H as e, g as m } from "../index-Giq9sshx.js";
2
+ import { H as e, g as m } from "../index-AkYRIjMa.js";
3
3
  import "../index-omnj2VPv.js";
4
4
  export {
5
5
  e as HasPermission,
@@ -9345,7 +9345,7 @@ class x8 {
9345
9345
  read(t, n, r) {
9346
9346
  var s, o;
9347
9347
  let i;
9348
- console.log("🚀 ~ ParentCacheBackend ~ read ~ resources:", i), window != null && window.parent && (i = (o = (s = window == null ? void 0 : window.parent.translations) == null ? void 0 : s[t]) == null ? void 0 : o[n], console.log("🚀 ~ ParentCacheBackend ~ add window", i)), i ? (console.log("🚀 ~ ParentCacheBackend ~ read ~ resources:", i), r(null, i)) : (r(new Error("No local or parent translation found"), null), console.log("🚀 ~ ParentCacheBackend ~ read ~ Error:", Error));
9348
+ console.log("🚀 ~ ParentCacheBackend ~ read ~ resources:", i), window != null && window.parent && (i = (o = (s = window == null ? void 0 : window.parent.translations) == null ? void 0 : s[t]) == null ? void 0 : o[n], console.log("🚀 ~ ParentCacheBackend ~ add window", i)), i ? (console.log("🚀 ~ ParentCacheBackend ~ read ~ resources:", i), r(null, i)) : (r(new Error("No local or parent translation found"), null), console.log("🚀 ~ ParentCacheBackend ~ read ~ Error:"));
9349
9349
  }
9350
9350
  }
9351
9351
  Cn.use(BP).use(HP).use(Jz).init({
@@ -9374,6 +9374,9 @@ Cn.use(BP).use(HP).use(Jz).init({
9374
9374
  backend: {
9375
9375
  backends: [x8, KP],
9376
9376
  backendOptions: [
9377
+ // Option for ParentCacheBackend
9378
+ {},
9379
+ // Option for HttpBackend
9377
9380
  {
9378
9381
  // ✅ FIX 1: Revert loadPath to exclude {{ns}}.json
9379
9382
  // The API returns ALL namespaces for a given language at this single endpoint.
@@ -9382,8 +9385,6 @@ Cn.use(BP).use(HP).use(Jz).init({
9382
9385
  const n = (Array.isArray(e) ? e[0] : e || "en").split("-")[0];
9383
9386
  return `${((i = window == null ? void 0 : window.env) == null ? void 0 : i.TRANSLATION_URL) ?? ((s = window == null ? void 0 : window.env) == null ? void 0 : s.VITE_BASE_URL) ?? ((o = window == null ? void 0 : window.env) == null ? void 0 : o.REACT_APP_BASE_URL) ?? `${location.protocol}//${location.host}`}/translations/${n}`;
9384
9387
  },
9385
- crossDomain: !0,
9386
- cacheHitMode: "refresh",
9387
9388
  request: async (e, t) => {
9388
9389
  try {
9389
9390
  console.log("🚀 ~ LoadTranslation URL:", e);