@ukpc-lib/react 0.16.3-dev.4 → 0.16.3-dev.41

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 (38) hide show
  1. package/dist/components/FavoriteMenu/components/MenuItem.d.ts +2 -1
  2. package/dist/components/FavoriteMenu/index.d.ts +4 -0
  3. package/dist/components/GlobalMenu/index.d.ts +5 -0
  4. package/dist/components/MenuTabs/index.d.ts +10 -0
  5. package/dist/components/Notification/Tabs/index.d.ts +1 -0
  6. package/dist/components/Topbar/icons/HamburgerIcon.d.ts +4 -0
  7. package/dist/components/Topbar/icons/SearchIcon.d.ts +7 -0
  8. package/dist/components/index.cjs +31 -19
  9. package/dist/components/index.js +2879 -2620
  10. package/dist/components/main.d.ts +1 -1
  11. package/dist/index.esm2017-C0fGDapl.cjs +1078 -0
  12. package/dist/{index.esm2017-BqpQWqJC.js → index.esm2017-hnE5oeeN.js} +12711 -12220
  13. package/dist/share/hooks/useSyncRouter.d.ts +1 -1
  14. package/dist/share/index.cjs +1 -1
  15. package/dist/share/index.js +297 -90
  16. package/dist/theme/ThemeProvider.d.ts +6 -0
  17. package/dist/theme/index.d.ts +1 -0
  18. package/dist/translations/config.d.ts +6 -0
  19. package/package.json +2 -1
  20. package/web-components-bundle/SaasThemeProvider-DUpoV8xb.js +242 -0
  21. package/web-components-bundle/access-denied/index.js +9 -3
  22. package/web-components-bundle/base-breadcrumbs/index.js +4 -3
  23. package/web-components-bundle/favorite-menu/index.js +6 -6
  24. package/web-components-bundle/global-menu/index.js +7 -6
  25. package/web-components-bundle/global-topbar/index.js +6 -6
  26. package/web-components-bundle/has-permission/index.js +2 -2
  27. package/web-components-bundle/index-DzbeN7GA.js +45084 -0
  28. package/web-components-bundle/{index-BUE-pz1x.js → index-N6zjI_u_.js} +11 -9
  29. package/web-components-bundle/{index-DzW7qqrH.js → index-pbpRN1TP.js} +1530 -1756
  30. package/web-components-bundle/page-not-found/index.js +5 -4
  31. package/web-components-bundle/{react-to-web-component-BOygDorD.js → react-to-web-component-w5r1Fs9q.js} +1527 -1535
  32. package/web-components-bundle/{react-toastify.esm-DnABvuky.js → react-toastify.esm-H_Xdunfj.js} +1 -1
  33. package/web-components-bundle/toast-config/index.js +2 -2
  34. package/web-components-bundle/toast-config-notification/index.js +2 -2
  35. package/dist/index.esm2017-C-HHU_vB.cjs +0 -1078
  36. package/web-components-bundle/index-CiYHK3Rq.js +0 -3528
  37. package/web-components-bundle/index-Jn6GHi9p.js +0 -40813
  38. package/web-components-bundle/setPrototypeOf-CP0c5ut2.js +0 -14
@@ -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: (basePath?: string) => void;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index.esm2017-C-HHU_vB.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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../index.esm2017-C0fGDapl.cjs"),R=require("axios"),y=require("react"),U=require("react-router-dom"),g=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("@mui/material");require("react-query");require("react-dom");require("moment");const D=r=>{const[t,e]=y.useState([]);return y.useEffect(()=>{R.get(`${r}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(i=>e(i.data)).catch(i=>{console.error("Getting user permission error:",i)})},[r]),t},H=r=>{const t=U.useLocation();if(y.useEffect(()=>{var i,c;let e=t.pathname+t.search+t.hash;r&&!e.includes(r)&&(e=r+e),console.log("🚀 ~ PrivateLayout.tsx ~ fullPath:",e),(c=(i=window.top)==null?void 0:i.shellNavigate)==null||c.call(i,"/app"+e,{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 $({open:r,disabled:t}){y.useMemo(()=>{var e,i,c,u;t||(r?(i=(e=window.top)==null?void 0:e.HostBridge)==null||i.openBackdrop(!0):(u=(c=window.top)==null?void 0:c.HostBridge)==null||u.openBackdrop(!1))},[r,t])}const k=(r,t)=>(e,i)=>{const u=o.useUserPermissions({axiosInstance:t,baseUrl:r}).data;return u?i?e.every(f=>u==null?void 0:u.includes(f)):e.some(f=>u==null?void 0:u.includes(f)):!1},M=({baseUrl:r,accessWith:t,requireAll:e,children:i})=>k(r)(t,e)?g.jsx(g.Fragment,{children:i}):null,q=({accessWith:r,requireAll:t,baseUrl:e,children:i})=>k(e)(r,t)?g.jsx(g.Fragment,{children:i}):g.jsx(o.UnauthorizedPage,{});var p={},I;function z(){if(I)return p;I=1,Object.defineProperty(p,"__esModule",{value:!0}),p.parse=f,p.serialize=_;const r=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,e=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,i=/^[\u0020-\u003A\u003D-\u007E]*$/,c=Object.prototype.toString,u=(()=>{const s=function(){};return s.prototype=Object.create(null),s})();function f(s,l){const n=new u,h=s.length;if(h<2)return n;const w=(l==null?void 0:l.decode)||b;let a=0;do{const d=s.indexOf("=",a);if(d===-1)break;const E=s.indexOf(";",a),S=E===-1?h:E;if(d>S){a=s.lastIndexOf(";",d-1)+1;continue}const v=m(s,a,d),j=x(s,d,v),T=s.slice(v,j);if(n[T]===void 0){let P=m(s,d+1,S),L=x(s,S,P);const N=w(s.slice(P,L));n[T]=N}a=S+1}while(a<h);return n}function m(s,l,n){do{const h=s.charCodeAt(l);if(h!==32&&h!==9)return l}while(++l<n);return n}function x(s,l,n){for(;l>n;){const h=s.charCodeAt(--l);if(h!==32&&h!==9)return l+1}return n}function _(s,l,n){const h=(n==null?void 0:n.encode)||encodeURIComponent;if(!r.test(s))throw new TypeError(`argument name is invalid: ${s}`);const w=h(l);if(!t.test(w))throw new TypeError(`argument val is invalid: ${l}`);let a=s+"="+w;if(!n)return a;if(n.maxAge!==void 0){if(!Number.isInteger(n.maxAge))throw new TypeError(`option maxAge is invalid: ${n.maxAge}`);a+="; Max-Age="+n.maxAge}if(n.domain){if(!e.test(n.domain))throw new TypeError(`option domain is invalid: ${n.domain}`);a+="; Domain="+n.domain}if(n.path){if(!i.test(n.path))throw new TypeError(`option path is invalid: ${n.path}`);a+="; Path="+n.path}if(n.expires){if(!A(n.expires)||!Number.isFinite(n.expires.valueOf()))throw new TypeError(`option expires is invalid: ${n.expires}`);a+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(a+="; HttpOnly"),n.secure&&(a+="; Secure"),n.partitioned&&(a+="; Partitioned"),n.priority)switch(typeof n.priority=="string"?n.priority.toLowerCase():void 0){case"low":a+="; Priority=Low";break;case"medium":a+="; Priority=Medium";break;case"high":a+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${n.priority}`)}if(n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:case"strict":a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"none":a+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${n.sameSite}`)}return a}function b(s){if(s.indexOf("%")===-1)return s;try{return decodeURIComponent(s)}catch{return s}}function A(s){return c.call(s)==="[object Date]"}return p}var O=z();function B(){const r=typeof global>"u"?void 0:global.TEST_HAS_DOCUMENT_COOKIE;return typeof r=="boolean"?r:typeof document=="object"&&typeof document.cookie=="string"}function K(r){return typeof r=="string"?O.parse(r):typeof r=="object"&&r!==null?r:{}}function C(r,t={}){const e=V(r);if(!t.doNotParse)try{return JSON.parse(e)}catch{}return r}function V(r){return r&&r[0]==="j"&&r[1]===":"?r.substr(2):r}class F{constructor(t,e={}){this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.update=()=>{if(!this.HAS_DOCUMENT_COOKIE)return;const c=this.cookies;this.cookies=O.parse(document.cookie),this._checkChanges(c)};const i=typeof document>"u"?"":document.cookie;this.cookies=K(t||i),this.defaultSetOptions=e,this.HAS_DOCUMENT_COOKIE=B()}_emitChange(t){for(let e=0;e<this.changeListeners.length;++e)this.changeListeners[e](t)}_checkChanges(t){new Set(Object.keys(t).concat(Object.keys(this.cookies))).forEach(i=>{t[i]!==this.cookies[i]&&this._emitChange({name:i,value:C(this.cookies[i])})})}_startPolling(){this.pollingInterval=setInterval(this.update,300)}_stopPolling(){this.pollingInterval&&clearInterval(this.pollingInterval)}get(t,e={}){return e.doNotUpdate||this.update(),C(this.cookies[t],e)}getAll(t={}){t.doNotUpdate||this.update();const e={};for(let i in this.cookies)e[i]=C(this.cookies[i],t);return e}set(t,e,i){i?i=Object.assign(Object.assign({},this.defaultSetOptions),i):i=this.defaultSetOptions;const c=typeof e=="string"?e:JSON.stringify(e);this.cookies=Object.assign(Object.assign({},this.cookies),{[t]:c}),this.HAS_DOCUMENT_COOKIE&&(document.cookie=O.serialize(t,c,i)),this._emitChange({name:t,value:e,options:i})}remove(t,e){const i=e=Object.assign(Object.assign(Object.assign({},this.defaultSetOptions),e),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=Object.assign({},this.cookies),delete this.cookies[t],this.HAS_DOCUMENT_COOKIE&&(document.cookie=O.serialize(t,"",i)),this._emitChange({name:t,value:void 0,options:e})}addChangeListener(t){this.changeListeners.push(t),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===1&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.addEventListener("change",this.update):this._startPolling())}removeChangeListener(t){const e=this.changeListeners.indexOf(t);e>=0&&this.changeListeners.splice(e,1),this.HAS_DOCUMENT_COOKIE&&this.changeListeners.length===0&&(typeof window=="object"&&"cookieStore"in window?window.cookieStore.removeEventListener("change",this.update):this._stopPolling())}removeAllChangeListeners(){for(;this.changeListeners.length>0;)this.removeChangeListener(this.changeListeners[0])}}const G=r=>{const t=new F;let i=new URLSearchParams(window.location.search).get("tenantId")||t.get("tenantId");const c=t.get("accessToken")||null;if(console.log("ThemeProvider1:tenantId",i),!i&&c){const f=atob(c.split(".")[1]),m=JSON.parse(f);i=m.tenantId?m.tenantId.toString():null}console.log("ThemeProvider2:tenantId",i);const u=r.isBrand||i!=null?r.viteThemeUrl:"";return console.log("themeUrl",u),g.jsx(o.SaasThemeProvider,{brandTheme:{enabled:!!u,url:u},children:r.children})};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=M;exports.PermissionRoute=q;exports.ThemeProvider=G;exports.getUseHasPermission=k;exports.useGetPermission=D;exports.useSyncBackdrop=$;exports.useSyncRouter=H;
@@ -1,48 +1,30 @@
1
- import { K as d, U as g } from "../index.esm2017-BqpQWqJC.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-BqpQWqJC.js";
3
- import p from "axios";
4
- import { useState as f, useEffect as a, useMemo as h } from "react";
5
- import { useNavigate as w, useLocation as P } from "react-router-dom";
6
- import { jsx as u, Fragment as c } from "react/jsx-runtime";
1
+ import { V as U, R as D, W as R } from "../index.esm2017-hnE5oeeN.js";
2
+ import { X as he, Y as de, Z as fe, a5 as ge, a as me, c as pe, a6 as we, a1 as Oe, $ as Se, a0 as ye, a2 as ke, y as Ce, a7 as xe, s as Ee, t as ve, a3 as Ie, g as Te, u as _e, m as be, a4 as Pe } from "../index.esm2017-hnE5oeeN.js";
3
+ import $ from "axios";
4
+ import { useState as H, useEffect as I, useMemo as M } from "react";
5
+ import { useLocation as z } from "react-router-dom";
6
+ import { jsx as O, Fragment as T } 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
- const H = (e) => {
13
- const [r, s] = f([]);
14
- return a(() => {
15
- p.get(`${e}/user-management/api/v1/users/my-account/permissions`, {
12
+ const ne = (r) => {
13
+ const [t, e] = H([]);
14
+ return I(() => {
15
+ $.get(`${r}/user-management/api/v1/users/my-account/permissions`, {
16
16
  withCredentials: !0
17
- }).then((t) => s(t.data)).catch((t) => {
18
- console.error("Getting user permission error:", t);
17
+ }).then((i) => e(i.data)).catch((i) => {
18
+ console.error("Getting user permission error:", i);
19
19
  });
20
- }, [e]), r;
21
- }, M = (e) => {
22
- const r = w(), s = P();
23
- console.log(
24
- " useSyncRouter.tsx ~ location1:",
25
- s,
26
- window.location.pathname
27
- );
28
- const t = (n = s) => (e || "") + n.pathname + n.search + n.hash;
29
- if (a(() => {
30
- const n = {
31
- changeRoute: (o) => {
32
- const i = t();
33
- if (typeof o == "string" && i !== o) {
34
- console.log(" useSyncRouter.tsx ~ location2:", i, o);
35
- const m = e && o.startsWith(e) ? o.substring(e.length) : o;
36
- r(m);
37
- }
38
- }
39
- };
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
- }, [s]), window.self === window.top) {
20
+ }, [r]), t;
21
+ }, re = (r) => {
22
+ const t = z();
23
+ if (I(() => {
24
+ var i, a;
25
+ let e = t.pathname + t.search + t.hash;
26
+ r && !e.includes(r) && (e = r + e), console.log("🚀 ~ PrivateLayout.tsx ~ fullPath:", e), (a = (i = window.top) == null ? void 0 : i.shellNavigate) == null || a.call(i, "/app" + e, { replace: !0 });
27
+ }, [t, r]), window.self === window.top) {
46
28
  console.log("useSyncRouter: Navigate to /app path"), window.location.href = window.location.href.replace(
47
29
  window.origin,
48
30
  `${window.origin}/app`
@@ -50,62 +32,287 @@ const H = (e) => {
50
32
  return;
51
33
  }
52
34
  };
53
- function k({
54
- open: e,
55
- disabled: r
35
+ function se({
36
+ open: r,
37
+ disabled: t
56
38
  }) {
57
- h(() => {
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]);
39
+ M(() => {
40
+ var e, i, a, c;
41
+ t || (r ? (i = (e = window.top) == null ? void 0 : e.HostBridge) == null || i.openBackdrop(!0) : (c = (a = window.top) == null ? void 0 : a.HostBridge) == null || c.openBackdrop(!1));
42
+ }, [r, t]);
61
43
  }
62
- const l = (e, r) => (s, t) => {
63
- const o = d({
64
- axiosInstance: r,
65
- baseUrl: e
44
+ const _ = (r, t) => (e, i) => {
45
+ const c = U({
46
+ axiosInstance: t,
47
+ baseUrl: r
66
48
  }).data;
67
- return o ? t ? s.every(
68
- (i) => o == null ? void 0 : o.includes(i)
69
- ) : s.some(
70
- (i) => o == null ? void 0 : o.includes(i)
49
+ return c ? i ? e.every(
50
+ (d) => c == null ? void 0 : c.includes(d)
51
+ ) : e.some(
52
+ (d) => c == null ? void 0 : c.includes(d)
71
53
  ) : !1;
72
- }, F = ({
73
- baseUrl: e,
54
+ }, oe = ({
55
+ baseUrl: r,
56
+ accessWith: t,
57
+ requireAll: e,
58
+ children: i
59
+ }) => _(r)(t, e) ? /* @__PURE__ */ O(T, { children: i }) : null, ae = ({
74
60
  accessWith: r,
75
- requireAll: s,
76
- children: t
77
- }) => l(e)(r, s) ? /* @__PURE__ */ u(c, { children: t }) : null, G = ({
78
- accessWith: e,
79
- requireAll: r,
80
- baseUrl: s,
81
- children: t
82
- }) => l(s)(e, r) ? /* @__PURE__ */ u(c, { children: t }) : /* @__PURE__ */ u(g, {});
61
+ requireAll: t,
62
+ baseUrl: e,
63
+ children: i
64
+ }) => _(e)(r, t) ? /* @__PURE__ */ O(T, { children: i }) : /* @__PURE__ */ O(D, {});
65
+ var g = {}, v;
66
+ function K() {
67
+ if (v)
68
+ return g;
69
+ v = 1, Object.defineProperty(g, "__esModule", { value: !0 }), g.parse = d, g.serialize = b;
70
+ const r = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/, t = /^[\u0021-\u003A\u003C-\u007E]*$/, e = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i, i = /^[\u0020-\u003A\u003D-\u007E]*$/, a = Object.prototype.toString, c = /* @__PURE__ */ (() => {
71
+ const s = function() {
72
+ };
73
+ return s.prototype = /* @__PURE__ */ Object.create(null), s;
74
+ })();
75
+ function d(s, u) {
76
+ const n = new c(), l = s.length;
77
+ if (l < 2)
78
+ return n;
79
+ const m = (u == null ? void 0 : u.decode) || P;
80
+ let o = 0;
81
+ do {
82
+ const h = s.indexOf("=", o);
83
+ if (h === -1)
84
+ break;
85
+ const k = s.indexOf(";", o), p = k === -1 ? l : k;
86
+ if (h > p) {
87
+ o = s.lastIndexOf(";", h - 1) + 1;
88
+ continue;
89
+ }
90
+ const C = f(s, o, h), L = y(s, h, C), x = s.slice(C, L);
91
+ if (n[x] === void 0) {
92
+ let E = f(s, h + 1, p), j = y(s, p, E);
93
+ const N = m(s.slice(E, j));
94
+ n[x] = N;
95
+ }
96
+ o = p + 1;
97
+ } while (o < l);
98
+ return n;
99
+ }
100
+ function f(s, u, n) {
101
+ do {
102
+ const l = s.charCodeAt(u);
103
+ if (l !== 32 && l !== 9)
104
+ return u;
105
+ } while (++u < n);
106
+ return n;
107
+ }
108
+ function y(s, u, n) {
109
+ for (; u > n; ) {
110
+ const l = s.charCodeAt(--u);
111
+ if (l !== 32 && l !== 9)
112
+ return u + 1;
113
+ }
114
+ return n;
115
+ }
116
+ function b(s, u, n) {
117
+ const l = (n == null ? void 0 : n.encode) || encodeURIComponent;
118
+ if (!r.test(s))
119
+ throw new TypeError(`argument name is invalid: ${s}`);
120
+ const m = l(u);
121
+ if (!t.test(m))
122
+ throw new TypeError(`argument val is invalid: ${u}`);
123
+ let o = s + "=" + m;
124
+ if (!n)
125
+ return o;
126
+ if (n.maxAge !== void 0) {
127
+ if (!Number.isInteger(n.maxAge))
128
+ throw new TypeError(`option maxAge is invalid: ${n.maxAge}`);
129
+ o += "; Max-Age=" + n.maxAge;
130
+ }
131
+ if (n.domain) {
132
+ if (!e.test(n.domain))
133
+ throw new TypeError(`option domain is invalid: ${n.domain}`);
134
+ o += "; Domain=" + n.domain;
135
+ }
136
+ if (n.path) {
137
+ if (!i.test(n.path))
138
+ throw new TypeError(`option path is invalid: ${n.path}`);
139
+ o += "; Path=" + n.path;
140
+ }
141
+ if (n.expires) {
142
+ if (!A(n.expires) || !Number.isFinite(n.expires.valueOf()))
143
+ throw new TypeError(`option expires is invalid: ${n.expires}`);
144
+ o += "; Expires=" + n.expires.toUTCString();
145
+ }
146
+ if (n.httpOnly && (o += "; HttpOnly"), n.secure && (o += "; Secure"), n.partitioned && (o += "; Partitioned"), n.priority)
147
+ switch (typeof n.priority == "string" ? n.priority.toLowerCase() : void 0) {
148
+ case "low":
149
+ o += "; Priority=Low";
150
+ break;
151
+ case "medium":
152
+ o += "; Priority=Medium";
153
+ break;
154
+ case "high":
155
+ o += "; Priority=High";
156
+ break;
157
+ default:
158
+ throw new TypeError(`option priority is invalid: ${n.priority}`);
159
+ }
160
+ if (n.sameSite)
161
+ switch (typeof n.sameSite == "string" ? n.sameSite.toLowerCase() : n.sameSite) {
162
+ case !0:
163
+ case "strict":
164
+ o += "; SameSite=Strict";
165
+ break;
166
+ case "lax":
167
+ o += "; SameSite=Lax";
168
+ break;
169
+ case "none":
170
+ o += "; SameSite=None";
171
+ break;
172
+ default:
173
+ throw new TypeError(`option sameSite is invalid: ${n.sameSite}`);
174
+ }
175
+ return o;
176
+ }
177
+ function P(s) {
178
+ if (s.indexOf("%") === -1)
179
+ return s;
180
+ try {
181
+ return decodeURIComponent(s);
182
+ } catch {
183
+ return s;
184
+ }
185
+ }
186
+ function A(s) {
187
+ return a.call(s) === "[object Date]";
188
+ }
189
+ return g;
190
+ }
191
+ var w = K();
192
+ function V() {
193
+ const r = typeof global > "u" ? void 0 : global.TEST_HAS_DOCUMENT_COOKIE;
194
+ return typeof r == "boolean" ? r : typeof document == "object" && typeof document.cookie == "string";
195
+ }
196
+ function B(r) {
197
+ return typeof r == "string" ? w.parse(r) : typeof r == "object" && r !== null ? r : {};
198
+ }
199
+ function S(r, t = {}) {
200
+ const e = q(r);
201
+ if (!t.doNotParse)
202
+ try {
203
+ return JSON.parse(e);
204
+ } catch {
205
+ }
206
+ return r;
207
+ }
208
+ function q(r) {
209
+ return r && r[0] === "j" && r[1] === ":" ? r.substr(2) : r;
210
+ }
211
+ class F {
212
+ constructor(t, e = {}) {
213
+ this.changeListeners = [], this.HAS_DOCUMENT_COOKIE = !1, this.update = () => {
214
+ if (!this.HAS_DOCUMENT_COOKIE)
215
+ return;
216
+ const a = this.cookies;
217
+ this.cookies = w.parse(document.cookie), this._checkChanges(a);
218
+ };
219
+ const i = typeof document > "u" ? "" : document.cookie;
220
+ this.cookies = B(t || i), this.defaultSetOptions = e, this.HAS_DOCUMENT_COOKIE = V();
221
+ }
222
+ _emitChange(t) {
223
+ for (let e = 0; e < this.changeListeners.length; ++e)
224
+ this.changeListeners[e](t);
225
+ }
226
+ _checkChanges(t) {
227
+ new Set(Object.keys(t).concat(Object.keys(this.cookies))).forEach((i) => {
228
+ t[i] !== this.cookies[i] && this._emitChange({
229
+ name: i,
230
+ value: S(this.cookies[i])
231
+ });
232
+ });
233
+ }
234
+ _startPolling() {
235
+ this.pollingInterval = setInterval(this.update, 300);
236
+ }
237
+ _stopPolling() {
238
+ this.pollingInterval && clearInterval(this.pollingInterval);
239
+ }
240
+ get(t, e = {}) {
241
+ return e.doNotUpdate || this.update(), S(this.cookies[t], e);
242
+ }
243
+ getAll(t = {}) {
244
+ t.doNotUpdate || this.update();
245
+ const e = {};
246
+ for (let i in this.cookies)
247
+ e[i] = S(this.cookies[i], t);
248
+ return e;
249
+ }
250
+ set(t, e, i) {
251
+ i ? i = Object.assign(Object.assign({}, this.defaultSetOptions), i) : i = this.defaultSetOptions;
252
+ const a = typeof e == "string" ? e : JSON.stringify(e);
253
+ this.cookies = Object.assign(Object.assign({}, this.cookies), { [t]: a }), this.HAS_DOCUMENT_COOKIE && (document.cookie = w.serialize(t, a, i)), this._emitChange({ name: t, value: e, options: i });
254
+ }
255
+ remove(t, e) {
256
+ const i = e = Object.assign(Object.assign(Object.assign({}, this.defaultSetOptions), e), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 });
257
+ this.cookies = Object.assign({}, this.cookies), delete this.cookies[t], this.HAS_DOCUMENT_COOKIE && (document.cookie = w.serialize(t, "", i)), this._emitChange({ name: t, value: void 0, options: e });
258
+ }
259
+ addChangeListener(t) {
260
+ this.changeListeners.push(t), this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 1 && (typeof window == "object" && "cookieStore" in window ? window.cookieStore.addEventListener("change", this.update) : this._startPolling());
261
+ }
262
+ removeChangeListener(t) {
263
+ const e = this.changeListeners.indexOf(t);
264
+ e >= 0 && this.changeListeners.splice(e, 1), this.HAS_DOCUMENT_COOKIE && this.changeListeners.length === 0 && (typeof window == "object" && "cookieStore" in window ? window.cookieStore.removeEventListener("change", this.update) : this._stopPolling());
265
+ }
266
+ removeAllChangeListeners() {
267
+ for (; this.changeListeners.length > 0; )
268
+ this.removeChangeListener(this.changeListeners[0]);
269
+ }
270
+ }
271
+ const ce = (r) => {
272
+ const t = new F();
273
+ let i = new URLSearchParams(window.location.search).get("tenantId") || t.get("tenantId");
274
+ const a = t.get("accessToken") || null;
275
+ if (console.log("ThemeProvider1:tenantId", i), !i && a) {
276
+ const d = atob(a.split(".")[1]), f = JSON.parse(d);
277
+ i = f.tenantId ? f.tenantId.toString() : null;
278
+ }
279
+ console.log("ThemeProvider2:tenantId", i);
280
+ const c = r.isBrand || i != null ? r.viteThemeUrl : "";
281
+ return console.log("themeUrl", c), /* @__PURE__ */ O(
282
+ R,
283
+ {
284
+ brandTheme: { enabled: !!c, url: c },
285
+ children: r.children
286
+ }
287
+ );
288
+ };
83
289
  export {
84
- z as AuthContext,
85
- D as AuthProvider,
86
- I as ERROR_MESSAGE,
87
- F as HasPermission,
88
- G as PermissionRoute,
89
- N as SaasThemeProvider,
90
- O as TranslationProvider,
91
- j as axiosInstance,
92
- K as color,
93
- L as createCustomTheme,
94
- l as getUseHasPermission,
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,
106
- H as useGetPermission,
107
- k as useSyncBackdrop,
108
- M as useSyncRouter,
109
- eo as useTheme,
110
- so as useTranslation
290
+ he as AuthContext,
291
+ de as AuthProvider,
292
+ fe as ERROR_MESSAGE,
293
+ oe as HasPermission,
294
+ ae as PermissionRoute,
295
+ R as SaasThemeProvider,
296
+ ce as ThemeProvider,
297
+ ge as TranslationProvider,
298
+ me as axiosInstance,
299
+ pe as color,
300
+ we as createCustomTheme,
301
+ _ as getUseHasPermission,
302
+ Oe as handleErrorAxios,
303
+ Se as login,
304
+ ye as logout,
305
+ ke as responseInterceptor,
306
+ Ce as search,
307
+ xe as setFavicon,
308
+ Ee as setShellBackdrop,
309
+ ve as translate,
310
+ Ie as translationConfig,
311
+ Te as useAuth,
312
+ _e as useCustomTranslation,
313
+ ne as useGetPermission,
314
+ se as useSyncBackdrop,
315
+ re as useSyncRouter,
316
+ be as useTheme,
317
+ Pe as useTranslation
111
318
  };
@@ -0,0 +1,6 @@
1
+ import { BrandThemeProps } from './SaasThemeProvider';
2
+
3
+ export declare const ThemeProvider: (props: BrandThemeProps & {
4
+ isBrand: boolean;
5
+ viteThemeUrl: string;
6
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -2,3 +2,4 @@ export { color } from './Colors';
2
2
  export type { ColorsType } from './Colors';
3
3
  export * from './Theme';
4
4
  export * from './SaasThemeProvider';
5
+ export * from './ThemeProvider';
@@ -1,5 +1,11 @@
1
1
  import { default as i18n } from 'i18next';
2
2
 
3
+ declare global {
4
+ interface Window {
5
+ translations?: Record<string, Record<string, any>>;
6
+ resources?: Record<string, Record<string, any>>;
7
+ }
8
+ }
3
9
  export declare enum Language {
4
10
  en = "en",
5
11
  de = "de"
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-dev.4",
4
+ "version": "0.16.3-dev.41",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -62,6 +62,7 @@
62
62
  "jquery": "^3.7.1",
63
63
  "moment": "^2.30.1",
64
64
  "react-bootstrap-daterangepicker": "^8.0.0",
65
+ "react-cookie": "^8.0.1",
65
66
  "react-dnd": "^16.0.1",
66
67
  "react-i18next": "^12.3.1",
67
68
  "react-icons": "^5.0.1",