@ukpc-lib/react 0.2.37 → 0.2.39

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 r=require("../index.module-568622f9.cjs"),d=require("axios"),i=require("react/jsx-runtime"),h=require("react");require("moment");require("@r2wc/react-to-web-component");const R=require("react-router-dom");require("react-dom");require("@mui/material");function q({config:n,pushError:o=r.pushError}){const t=d.create(n);t.interceptors.request.use(async e=>(e.headers={Accept:"application/json","Content-Type":"application/json"},e),e=>Promise.reject(e)),t.interceptors.response.use(e=>e,async e=>s(e));async function s(e){var m,P,p,g;console.error("Error 🚨:",e);const a=e.config,u=(P=(m=e.response)==null?void 0:m.data)==null?void 0:P.errorMessage,l=u===r.ERROR_MESSAGE.TOKEN_EXPIRED;return((p=e.response)==null?void 0:p.status)===401?l&&!a._retry?(a._retry=!0,t.post("/authentication/api/v1/auth/refresh-token").then(()=>t(a)).catch(()=>r.login(n.baseURL))):((!u||!l)&&r.login(n.baseURL),Promise.reject("Unauthorized! Please login again.")):(((g=e.response)==null?void 0:g.status)===403?o(r.t("errorMessage.403")):o(r.t(`${u}`)||"Something went wrong!"),Promise.reject(e.response.data))}return t}const f=n=>{const[o,t]=h.useState([]);return h.useEffect(()=>{d.get(`${n}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(s=>t(s.data)).catch(s=>{console.error("Getting user permission error:",s)})},[n]),o},c=n=>(o,t)=>{const s=f(n);return t?o.every(e=>s==null?void 0:s.includes(e)):o.some(e=>s==null?void 0:s.includes(e))},j=({baseUrl:n,accessWith:o,requireAll:t,children:s})=>c(n)(o,t)?i.jsx(i.Fragment,{children:s}):null,v=({accessWith:n,requireAll:o,baseUrl:t,unAuthorizedPath:s,children:e})=>c(t)(n,o)?i.jsx(i.Fragment,{children:e}):i.jsx(R.Navigate,{to:s,replace:!0});exports.AuthProvider=r.AuthProvider;exports.TranslationProvider=r.TranslationProvider;exports.search=r.search;exports.translate=r.translate;exports.translationConfig=r.translationConfig;exports.useAuth=r.useAuth;exports.useCustomTranslation=r.useCustomTranslation;exports.useTranslation=r.useTranslation$1;exports.HasPermission=j;exports.PermissionRoute=v;exports.getAxiosInstance=q;exports.getUseHasPermission=c;exports.useGetPermission=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../index.module-dbbc618c.cjs"),d=require("axios"),i=require("react/jsx-runtime"),h=require("react");require("moment");require("@r2wc/react-to-web-component");const R=require("react-router-dom");require("react-dom");require("@mui/material");function q({config:n,pushError:o=r.pushError}){const t=d.create(n);t.interceptors.request.use(async e=>(e.headers={Accept:"application/json","Content-Type":"application/json"},e),e=>Promise.reject(e)),t.interceptors.response.use(e=>e,async e=>s(e));async function s(e){var m,P,p,g;console.error("Error 🚨:",e);const a=e.config,u=(P=(m=e.response)==null?void 0:m.data)==null?void 0:P.errorMessage,l=u===r.ERROR_MESSAGE.TOKEN_EXPIRED;return((p=e.response)==null?void 0:p.status)===401?l&&!a._retry?(a._retry=!0,t.post("/authentication/api/v1/auth/refresh-token").then(()=>t(a)).catch(()=>r.login(n.baseURL))):((!u||!l)&&r.login(n.baseURL),Promise.reject("Unauthorized! Please login again.")):(((g=e.response)==null?void 0:g.status)===403?o(r.t("errorMessage.403")):o(r.t(`${u}`)||"Something went wrong!"),Promise.reject(e.response.data))}return t}const f=n=>{const[o,t]=h.useState([]);return h.useEffect(()=>{d.get(`${n}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(s=>t(s.data)).catch(s=>{console.error("Getting user permission error:",s)})},[n]),o},c=n=>(o,t)=>{const s=f(n);return t?o.every(e=>s==null?void 0:s.includes(e)):o.some(e=>s==null?void 0:s.includes(e))},j=({baseUrl:n,accessWith:o,requireAll:t,children:s})=>c(n)(o,t)?i.jsx(i.Fragment,{children:s}):null,v=({accessWith:n,requireAll:o,baseUrl:t,unAuthorizedPath:s,children:e})=>c(t)(n,o)?i.jsx(i.Fragment,{children:e}):i.jsx(R.Navigate,{to:s,replace:!0});exports.AuthProvider=r.AuthProvider;exports.TranslationProvider=r.TranslationProvider;exports.search=r.search;exports.translate=r.translate;exports.translationConfig=r.translationConfig;exports.useAuth=r.useAuth;exports.useCustomTranslation=r.useCustomTranslation;exports.useTranslation=r.useTranslation$1;exports.HasPermission=j;exports.PermissionRoute=v;exports.getAxiosInstance=q;exports.getUseHasPermission=c;exports.useGetPermission=f;
@@ -1,5 +1,5 @@
1
- import { F as l, G as f, p as E, H as R } from "../index.module-ea1ec6c1.js";
2
- import { J as k, T as F, q as K, N as L, M as b, K as z, u as D, O as J } from "../index.module-ea1ec6c1.js";
1
+ import { F as l, G as f, p as E, H as R } from "../index.module-b4e99b4d.js";
2
+ import { J as k, T as F, q as K, N as L, M as b, K as z, u as D, O as J } from "../index.module-b4e99b4d.js";
3
3
  import P from "axios";
4
4
  import { jsx as i, Fragment as g } from "react/jsx-runtime";
5
5
  import { useState as y, useEffect as v } from "react";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.2.37",
4
+ "version": "0.2.39",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../react-to-web-component-5d347552.cjs");require("../index-01dc8163.cjs");const e=require("../index-63f15635.cjs");require("../index-5627e1e9.cjs");exports.TopBar=e.TopBar;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../react-to-web-component-5d347552.cjs");require("../index-01dc8163.cjs");const e=require("../index-ecc040cf.cjs");require("../index-5627e1e9.cjs");exports.TopBar=e.TopBar;
@@ -1,6 +1,6 @@
1
1
  import "../react-to-web-component-24d28041.js";
2
2
  import "../index-30758085.js";
3
- import { T as i } from "../index-0e4d0c2e.js";
3
+ import { T as i } from "../index-81cfe9d4.js";
4
4
  import "../index-c0edc305.js";
5
5
  export {
6
6
  i as TopBar
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../react-to-web-component-5d347552.cjs");const e=require("../index-63f15635.cjs");require("../index-01dc8163.cjs");require("../index-5627e1e9.cjs");exports.HasPermission=e.HasPermission;exports.getUseHasPermission=e.getUseHasPermission;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../react-to-web-component-5d347552.cjs");const e=require("../index-ecc040cf.cjs");require("../index-01dc8163.cjs");require("../index-5627e1e9.cjs");exports.HasPermission=e.HasPermission;exports.getUseHasPermission=e.getUseHasPermission;
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-24d28041.js";
2
- import { H as e, g as t } from "../index-0e4d0c2e.js";
2
+ import { H as e, g as t } from "../index-81cfe9d4.js";
3
3
  import "../index-30758085.js";
4
4
  import "../index-c0edc305.js";
5
5
  export {
@@ -18352,7 +18352,7 @@ function XR({
18352
18352
  }
18353
18353
  const JR = `.avatar-dropdown-item{padding:.5rem;font-size:.875rem;line-height:1.25rem;cursor:pointer;border-radius:.25rem}.avartarDropdownMenu{background-color:#fff;padding:.5rem;width:13rem;--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);position:absolute;left:-10rem;top:3.2rem}.avartarDropdownMenu ul{list-style:none;padding-inline-start:0;margin-block-end:0}.navbar{position:fixed;display:flex;z-index:30;background:#292929;top:0;width:100%;padding-left:2.5rem;height:64px}.navbar-container{display:flex;flex-direction:row;align-items:center;width:100%;justify-content:space-between}.logo-container{padding:16px 0;height:100%}.right-side-container{display:flex;flex-direction:row;align-items:center;text-align:center;margin-right:2.5rem;gap:1rem}.userContainer{display:flex;align-items:center;gap:.5rem}.languageDropdown{height:100%;padding:0 8px;display:flex;flex-direction:row;gap:8px;border-radius:3px;align-items:center;justify-content:center;height:41px;background-color:#ffffff1a;cursor:pointer;transition:background-color .2s ease-in-out}.languageDropdown:hover{background-color:#fff3}.userFullName{color:#fff;font-weight:400;font-size:.875rem;line-height:1.25rem}.userAvatar{width:2.5rem;height:2.5rem;cursor:pointer;-o-object-fit:cover;object-fit:cover;border-radius:9999px;border:2px solid #FFFFFF}#userAvatarNull{width:2.5rem;height:2.5rem;background:#DDDDDD;border-radius:100%;color:#fff;font-size:20px;font-weight:400;display:flex;align-items:center;justify-content:center}.relative{position:relative}.cursor-pointer{cursor:pointer}
18354
18354
  `, QR = `.tab-title{min-width:90px;padding:5px 16px;font-size:14px;font-weight:500;color:#c5c5c5;transition:all .3s ease-in-out;position:relative}.tab-title.is-active{color:#2e7d32}.tab-title.is-active:before{transition:all .3s ease-in-out;position:absolute;content:"";width:100%;height:100%;top:0;left:0;border-bottom:2px solid #2E7D32}.tab-content{padding:16px 0}
18355
- `, eP = `:root{--textPrimary: #292929;--textWhite: #fff;--primary500: #2E7D32;--grey100: #FAFAFA;--gray200: #EEEEEE;--gray600: #85858A;--link: #007BFF }.list-content{overflow-y:auto;overflow-x:hidden}.mark-all-read{text-align:right;color:#007bff;margin-bottom:12px;font-size:12px}.notification-items__wrapper{overflow:hidden}.notification-items__content{height:calc(100vh - 275px);overflow-x:hidden;overflow-y:auto}.notitification-item__container{display:flex;align-items:center;justify-content:space-between;padding:16px;border-bottom:#FAFAFA 1px solid;text-align:left;font-size:12px;position:relative;z-index:10;cursor:pointer;border-radius:4px;margin-bottom:8px}.notitification-item__container:hover{background-color:#fafafa}.notification-item__image-container{width:40px;height:40px;display:flex;justify-content:center;align-items:center;border-radius:50%;overflow:hidden;margin-right:16px}.notification-item__image-container img{width:100%;height:100%;text-align:center;-o-object-fit:cover;object-fit:cover;color:transparent;text-indent:10000px}.notification-item__context-link{color:#007bff}.notification-item__content{width:60%;padding-right:16px}.notification-item__user-name{margin-bottom:2px;font-size:14px}.notification-item__time{margin-right:15px;text-align:right}.notification-item__read-at{border-width:2px;border-style:solid;border-radius:50%;width:10px;height:10px;display:block;position:relative}.notification-item__read-at:before{position:absolute;top:-30px;right:0;width:91px;background-color:#85858a;color:#fff;border-radius:4px;font-size:10px;text-align:center;padding:4px;opacity:0;visibility:hidden;transition:all .3s cubic-bezier(.39,.575,.565,1)}.notification-item__read-at:hover:before{opacity:1;visibility:visible}.notification-item__read-at.read:before{content:"Mark as unread"}.notification-item__read-at.unread:before{content:"Mark as read"}.notification-item__read-at.read{border-color:#eee}.notification-item__read-at.unread{border-color:#2e7d32;background-color:#2e7d32}
18355
+ `, eP = `:root{--textPrimary: #292929;--textWhite: #fff;--primary500: #2E7D32;--grey100: #FAFAFA;--gray200: #EEEEEE;--gray600: #85858A;--link: #007BFF }.list-content{overflow-y:auto;overflow-x:hidden}.mark-all-read{text-align:right;color:#007bff;margin-bottom:12px;font-size:12px}.notification-items__wrapper{overflow:hidden}.notification-items__content{height:calc(100vh - 275px);overflow-x:hidden;overflow-y:auto;color:#292929}.notitification-item__container{display:flex;align-items:center;justify-content:space-between;padding:16px;border-bottom:#FAFAFA 1px solid;text-align:left;font-size:12px;position:relative;z-index:10;cursor:pointer;border-radius:4px;margin-bottom:8px}.notitification-item__container:hover{background-color:#fafafa}.notification-item__image-container{width:40px;height:40px;display:flex;justify-content:center;align-items:center;border-radius:50%;overflow:hidden;margin-right:16px}.notification-item__image-container img{width:100%;height:100%;text-align:center;-o-object-fit:cover;object-fit:cover;color:transparent;text-indent:10000px}.notification-item__context-link{color:#007bff}.notification-item__content{width:60%;padding-right:16px}.notification-item__user-name{margin-bottom:2px;font-size:14px}.notification-item__time{margin-right:15px;text-align:right}.notification-item__read-at{border-width:2px;border-style:solid;border-radius:50%;width:10px;height:10px;display:block;position:relative}.notification-item__read-at:before{position:absolute;top:-30px;right:0;width:91px;background-color:#85858a;color:#fff;border-radius:4px;font-size:10px;text-align:center;padding:4px;opacity:0;visibility:hidden;transition:all .3s cubic-bezier(.39,.575,.565,1)}.notification-item__read-at:hover:before{opacity:1;visibility:visible}.notification-item__read-at.read:before{content:"Mark as unread"}.notification-item__read-at.unread:before{content:"Mark as read"}.notification-item__read-at.read{border-color:#eee}.notification-item__read-at.unread{border-color:#2e7d32;background-color:#2e7d32}
18356
18356
  `, tP = `._notification-massage_container_ql4az_1{background:#fff;padding:0 64px 0 84px;border-radius:8px;font-family:TT Firs Neue Trl,sans-serif}._notification-massage_container_ql4az_1:before{position:absolute;content:"";width:48px;height:48px;background:url(https://ukpcsaprod.blob.core.windows.net/saas/notification-icon.svg) no-repeat center/100%;top:12px;left:24px}._notification-name_ql4az_18{font-weight:500;font-size:14px}._notification-message_service_ql4az_23{font-size:12px}._notification-message_button-close_ql4az_27{position:absolute;top:12px;right:24px;width:24px;height:24px}
18357
18357
  `, nP = `._subscription-diaglog_1gvmm_2{position:fixed;width:100vw;height:100vh;top:0;left:0;background-color:#0006;z-index:10000;display:flex;align-items:center;justify-content:center}._subscription-container_1gvmm_15{width:610px;height:222px;border-radius:8px;padding:32px 24px 40px;background:#fff;color:#292929}._subscription-title_1gvmm_25{font-size:20px;font-weight:500;text-align:center;color:#292929}._subscription-title_1gvmm_25,._subscription-text_1gvmm_34{margin-bottom:24px}._subscription-btn__container_1gvmm_38{display:flex;justify-content:space-between;align-items:center}._btn-success_1gvmm_44,._btn-cancel_1gvmm_45{width:150px;height:40px;display:flex;align-items:center;justify-content:center;padding:8px;color:#292929;border-radius:1px}._btn-cancel_1gvmm_45{background-color:#ddd}._btn-success_1gvmm_44{background-color:#93d500}
18358
18358
  `;
@@ -1060,7 +1060,7 @@ function print() { __p += __j.call(arguments, '') }
1060
1060
  * limitations under the License.
1061
1061
  */function dy(e=HA()){return SO().then(t=>{if(!t)throw nn.create("unsupported-browser")},t=>{throw nn.create("indexed-db-unsupported")}),Hd(Wd(e),"messaging").getImmediate()}async function CO(e,t){return e=Wd(e),fy(e,t)}function DO(e,t){return e=Wd(e),kO(e,t)}wO();const hy=e=>{"serviceWorker"in navigator&&navigator.serviceWorker.register(e.path).then(function(t){console.log("Registration successful, scope is:",t.scope),console.log("initialize service worker props ",e);const r=dy(Ud({apiKey:e.apiKey,authDomain:e.authDomain,projectId:e.projectId,storageBucket:e.storageBucket,messagingSenderId:e.messagingSenderId,appId:e.appId,measurementId:e.measurementId}));CO(r,{serviceWorkerRegistration:t,vapidKey:e.vapidKey}).then(async s=>{var o,c;if(s){console.log("current token for client: ",s);try{const h="/notification-management/api/v1/notifications/registrations",x=e.baseUrl+h;await ce.axios.post(x,{deviceToken:s},{withCredentials:!0})}catch(h){console.log(h),ce.pushError(((c=(o=h.response)==null?void 0:o.data)==null?void 0:c.errorMessage)||"Have error when get notification list")}}else console.log("No registration token available. Request permission to generate one.")}).catch(s=>{console.log("An error occurred while retrieving token. ",s)})}).catch(function(t){console.log("Service worker registration failed, error:",t)})},EO=e=>{const t=new BroadcastChannel("my-channel");t.onmessage=r=>{console.log("Broadcast chanel message",r),r&&e(s=>({...s,unread:{...s.unread,total:s.unread.total+1}}))}},TO=e=>new Promise(t=>{const r=dy(Ud({apiKey:e.apiKey,authDomain:e.authDomain,projectId:e.projectId,storageBucket:e.storageBucket,messagingSenderId:e.messagingSenderId,appId:e.appId,measurementId:e.measurementId}));DO(r,s=>{console.log("payload",s),t(s)})}),os={"subscription-diaglog":"_subscription-diaglog_1gvmm_2","subscription-container":"_subscription-container_1gvmm_15","subscription-title":"_subscription-title_1gvmm_25","subscription-text":"_subscription-text_1gvmm_34","subscription-btn__container":"_subscription-btn__container_1gvmm_38","btn-success":"_btn-success_1gvmm_44","btn-cancel":"_btn-cancel_1gvmm_45"},MO=["granted","denied"],RO=e=>{const[t,r]=D.reactExports.useState(!1),s=()=>{Notification.requestPermission(function(c){c==="granted"&&hy(e),MO.includes(c)&&r(!0)})},o=()=>{r(!0)};return D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:t?"":D.jsxRuntimeExports.jsx("div",{className:os["subscription-diaglog"],children:D.jsxRuntimeExports.jsxs("div",{className:os["subscription-container"],children:[D.jsxRuntimeExports.jsx("h4",{className:os["subscription-title"],children:"Notification"}),D.jsxRuntimeExports.jsx("p",{className:os["subscription-text"],children:"Option to receive notifications about the latest information. You can turn them off at any time."}),D.jsxRuntimeExports.jsxs("div",{className:os["subscription-btn__container"],children:[D.jsxRuntimeExports.jsx("button",{className:os["btn-cancel"],onClick:o,children:"Not now"}),D.jsxRuntimeExports.jsx("button",{className:os["btn-success"],onClick:s,children:"Turn on"})]})]})})})},Au={"notification-massage_container":"_notification-massage_container_ql4az_1","notification-name":"_notification-name_ql4az_18","notification-message_service":"_notification-message_service_ql4az_23","notification-message_button-close":"_notification-message_button-close_ql4az_27"},AO=e=>{const[t,r]=D.reactExports.useState({userName:"",message:"",context:""});console.log(t);const{setNotiData:s}=D.reactExports.useContext(Xs);function o(){return D.jsxRuntimeExports.jsx("div",{className:Au["notification-massage_container"],children:D.jsxRuntimeExports.jsxs("div",{className:Au["notification-massage_content"],children:[D.jsxRuntimeExports.jsx("h6",{className:Au["notification-name"],children:t==null?void 0:t.userName}),D.jsxRuntimeExports.jsxs("div",{className:Au["notification-message_service"],children:[D.jsxRuntimeExports.jsxs("span",{children:[`${t==null?void 0:t.message} `," "]}),D.jsxRuntimeExports.jsx("span",{children:t==null?void 0:t.context})]})]})})}return D.reactExports.useEffect(()=>{t&&Notification.permission==="granted"&&t.userName&&t.message&&t.context&&ce.notify(D.jsxRuntimeExports.jsx(o,{}))},[t]),D.reactExports.useEffect(()=>{Notification.permission==="granted"&&hy(e)},[Notification.permission]),D.reactExports.useEffect(()=>{EO(s)},[]),TO(e).then(c=>{var h,x,S;console.log("aaa",c),r({userName:(h=c==null?void 0:c.data)==null?void 0:h.userName,message:(x=c==null?void 0:c.data)==null?void 0:x.message,context:(S=c==null?void 0:c.data)==null?void 0:S.context}),s(E=>{var A;return{...E,unread:{...E.unread,total:((A=E.unread)==null?void 0:A.total)+1}}})}).catch(c=>console.log("failed: ",c)),D.jsxRuntimeExports.jsx("div",{children:"Notification"in window&&Notification.permission==="default"?D.jsxRuntimeExports.jsx(RO,{...e}):""})},py=({baseUrl:e,notiPath:t,setNotiData:r})=>async()=>{const c=e+(t||"/notification-management/api/v1/notifications"),h=await ce.axios.get(c,{params:{filter:{notificationFilterType:"all"}},withCredentials:!0}),x=await ce.axios.get(c,{params:{filter:{notificationFilterType:"unread"}},withCredentials:!0});Promise.all([h,x]).then(S=>{var E,A,Y,F;console.log("result: "+S),r({all:{rows:(E=S[0].data)==null?void 0:E.rows,total:(A=S[0].data)==null?void 0:A.total},unread:{rows:(Y=S[1].data)==null?void 0:Y.rows,total:(F=S[1].data)==null?void 0:F.total}})})},IO=({baseUrl:e,notiPath:t})=>{var Y,F,V,q;const{setShowModalFalse:r}=D.reactExports.useContext(Xs),{notidata:s,setNotiData:o}=D.reactExports.useContext(Xs);console.log(s);const[c,h]=D.reactExports.useState("all"),x=py({baseUrl:e,notiPath:t,setNotiData:o}),S=async()=>{var $,te;try{const pe=e+(t||"/notification-management/api/v1/notifications");await ce.axios.put(pe,{withCredentials:!0})}catch(H){console.log(H),ce.pushError(((te=($=H.response)==null?void 0:$.data)==null?void 0:te.errorMessage)||"Have error when get notification list")}await x()},E=async($,te)=>{var H,pe;try{const me=t||`/notification-management/api/v1/notifications/${$}`,ye=e+me;await ce.axios.put(ye,{isRead:te},{withCredentials:!0})}catch(me){ce.pushError(((pe=(H=me.response)==null?void 0:H.data)==null?void 0:pe.errorMessage)||"Have error when get notification list")}await x()},A=[{id:"all",tabTitle:`All (${((Y=s==null?void 0:s.all)==null?void 0:Y.total)||0})`,children:D.jsxRuntimeExports.jsx(Zp,{notidata:((F=s==null?void 0:s.all)==null?void 0:F.rows)||[],handleUpdateRead:E,handleUpdateReadAll:S})},{id:"unread",tabTitle:`Unread (${((V=s==null?void 0:s.unread)==null?void 0:V.total)||0})`,children:D.jsxRuntimeExports.jsx(Zp,{notidata:((q=s==null?void 0:s.unread)==null?void 0:q.rows)||[],handleUpdateRead:E,handleUpdateReadAll:S})}];return D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:D.jsxRuntimeExports.jsx("div",{style:{position:"absolute",backgroundColor:"#fff",width:"550px",height:"90vh",right:"100px",top:"100%",padding:"32px",boxShadow:"10px 0px 20px #999",borderRadius:"0 0 8px 8px",overflow:"hidden"},children:D.jsxRuntimeExports.jsxs("div",{className:"list-content",children:[D.jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[D.jsxRuntimeExports.jsx("h3",{style:{fontSize:"24px",fontWeight:"500"},className:"list-title",children:"Notifications"}),D.jsxRuntimeExports.jsx("button",{onClick:r,children:D.jsxRuntimeExports.jsx("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:D.jsxRuntimeExports.jsx("path",{d:"M7.05086 6.13616C6.66033 5.74563 6.02717 5.74563 5.63664 6.13616C5.24612 6.52668 5.24612 7.15984 5.63664 7.55037L10.5864 12.5001L5.63664 17.4499C5.24612 17.8404 5.24612 18.4736 5.63664 18.8641C6.02717 19.2546 6.66033 19.2546 7.05086 18.8641L12.0006 13.9143L16.9504 18.8641C17.3409 19.2546 17.974 19.2546 18.3646 18.8641C18.7551 18.4736 18.7551 17.8404 18.3646 17.4499L13.4148 12.5001L18.3646 7.55037C18.7551 7.15984 18.7551 6.52668 18.3646 6.13616C17.974 5.74563 17.3409 5.74563 16.9504 6.13616L12.0006 11.0859L7.05086 6.13616Z",fill:"#85858A"})})})]}),D.jsxRuntimeExports.jsx(ww,{tabs:A,setCurrentTab:h,currentTab:c})]})})})};function eh({childrenClass:e,action:t,childrenOpenClass:r}){const s=document.querySelector("#topbar-wrapper"),o=s==null?void 0:s.shadowRoot,c=o==null?void 0:o.querySelector(`.${e}`),h=o==null?void 0:o.querySelector(`.${r}`),x=o==null?void 0:o.querySelector("nav"),S=E=>{x==null||x.addEventListener("click",function(A){if(r&&h&&h.contains(A.target)){if(c&&!c.contains(A.target))return}else c&&!c.contains(A.target)&&t()}),s&&!s.contains(E.target)&&t()};document.addEventListener("click",S,!0)}function OO({primaryColor:e="#009d4f",baseUrl:t,notiPath:r}){var A,Y;const{isOpen:s,toggleOpen:o,setShowModalFalse:c}=D.reactExports.useContext(Xs),{notidata:h,setNotiData:x}=D.reactExports.useContext(Xs),S=py({baseUrl:t,notiPath:r,setNotiData:x}),E=async()=>{var F,V;try{await S()}catch(q){ce.pushError(((V=(F=q.response)==null?void 0:F.data)==null?void 0:V.errorMessage)||"Have error when get notification list")}};return D.reactExports.useEffect(()=>{E()},[s]),D.reactExports.useEffect(()=>{eh({childrenClass:"noti-container",childrenOpenClass:"noti-list-container",action(){c()}})}),D.jsxRuntimeExports.jsxs("div",{children:[D.jsxRuntimeExports.jsxs("div",{className:"noti-container",style:{position:"relative"},children:[D.jsxRuntimeExports.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:o,style:{cursor:"pointer"},children:[D.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.7968 17.4705C16.5901 17.4705 18.8076 16.8556 19.0218 14.3874C19.0218 11.921 17.4757 12.0796 17.4757 9.05334C17.4757 6.68952 15.2352 4 11.7968 4C8.35833 4 6.1178 6.68952 6.1178 9.05334C6.1178 12.0796 4.57178 11.921 4.57178 14.3874C4.78679 16.8649 7.00428 17.4705 11.7968 17.4705Z",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),D.jsxRuntimeExports.jsx("path",{d:"M13.8274 20.0286C12.6679 21.3161 10.8591 21.3313 9.68848 20.0286",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(h==null?void 0:h.unread)&&(h==null?void 0:h.unread.total)!=0&&D.jsxRuntimeExports.jsx("span",{style:{position:"absolute",top:"-9px",right:"-6px",background:`${ce.color.dangerDark}`,width:"20px",height:"20px",border:"1px solid #fff",borderRadius:"50%",color:"#fff",fontSize:"12px",display:"flex",alignItems:"center",justifyContent:"center"},className:"notification-badge",children:((A=h==null?void 0:h.unread)==null?void 0:A.total)>9?"9+":`${(Y=h==null?void 0:h.unread)==null?void 0:Y.total}`})]}),D.jsxRuntimeExports.jsx("div",{className:"noti-list-container",children:!s&&D.jsxRuntimeExports.jsx(IO,{baseUrl:t,notiPath:r})})]})}const PO=`.avatar-dropdown-item{padding:.5rem;font-size:.875rem;line-height:1.25rem;cursor:pointer;border-radius:.25rem}.avartarDropdownMenu{background-color:#fff;padding:.5rem;width:13rem;--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);position:absolute;left:-10rem;top:3.2rem}.avartarDropdownMenu ul{list-style:none;padding-inline-start:0;margin-block-end:0}.navbar{position:fixed;display:flex;z-index:30;background:#292929;top:0;width:100%;padding-left:2.5rem;height:64px}.navbar-container{display:flex;flex-direction:row;align-items:center;width:100%;justify-content:space-between}.logo-container{padding:16px 0;height:100%}.right-side-container{display:flex;flex-direction:row;align-items:center;text-align:center;margin-right:2.5rem;gap:1rem}.userContainer{display:flex;align-items:center;gap:.5rem}.languageDropdown{height:100%;padding:0 8px;display:flex;flex-direction:row;gap:8px;border-radius:3px;align-items:center;justify-content:center;height:41px;background-color:#ffffff1a;cursor:pointer;transition:background-color .2s ease-in-out}.languageDropdown:hover{background-color:#fff3}.userFullName{color:#fff;font-weight:400;font-size:.875rem;line-height:1.25rem}.userAvatar{width:2.5rem;height:2.5rem;cursor:pointer;-o-object-fit:cover;object-fit:cover;border-radius:9999px;border:2px solid #FFFFFF}#userAvatarNull{width:2.5rem;height:2.5rem;background:#DDDDDD;border-radius:100%;color:#fff;font-size:20px;font-weight:400;display:flex;align-items:center;justify-content:center}.relative{position:relative}.cursor-pointer{cursor:pointer}
1062
1062
  `,NO=`.tab-title{min-width:90px;padding:5px 16px;font-size:14px;font-weight:500;color:#c5c5c5;transition:all .3s ease-in-out;position:relative}.tab-title.is-active{color:#2e7d32}.tab-title.is-active:before{transition:all .3s ease-in-out;position:absolute;content:"";width:100%;height:100%;top:0;left:0;border-bottom:2px solid #2E7D32}.tab-content{padding:16px 0}
1063
- `,LO=`:root{--textPrimary: #292929;--textWhite: #fff;--primary500: #2E7D32;--grey100: #FAFAFA;--gray200: #EEEEEE;--gray600: #85858A;--link: #007BFF }.list-content{overflow-y:auto;overflow-x:hidden}.mark-all-read{text-align:right;color:#007bff;margin-bottom:12px;font-size:12px}.notification-items__wrapper{overflow:hidden}.notification-items__content{height:calc(100vh - 275px);overflow-x:hidden;overflow-y:auto}.notitification-item__container{display:flex;align-items:center;justify-content:space-between;padding:16px;border-bottom:#FAFAFA 1px solid;text-align:left;font-size:12px;position:relative;z-index:10;cursor:pointer;border-radius:4px;margin-bottom:8px}.notitification-item__container:hover{background-color:#fafafa}.notification-item__image-container{width:40px;height:40px;display:flex;justify-content:center;align-items:center;border-radius:50%;overflow:hidden;margin-right:16px}.notification-item__image-container img{width:100%;height:100%;text-align:center;-o-object-fit:cover;object-fit:cover;color:transparent;text-indent:10000px}.notification-item__context-link{color:#007bff}.notification-item__content{width:60%;padding-right:16px}.notification-item__user-name{margin-bottom:2px;font-size:14px}.notification-item__time{margin-right:15px;text-align:right}.notification-item__read-at{border-width:2px;border-style:solid;border-radius:50%;width:10px;height:10px;display:block;position:relative}.notification-item__read-at:before{position:absolute;top:-30px;right:0;width:91px;background-color:#85858a;color:#fff;border-radius:4px;font-size:10px;text-align:center;padding:4px;opacity:0;visibility:hidden;transition:all .3s cubic-bezier(.39,.575,.565,1)}.notification-item__read-at:hover:before{opacity:1;visibility:visible}.notification-item__read-at.read:before{content:"Mark as unread"}.notification-item__read-at.unread:before{content:"Mark as read"}.notification-item__read-at.read{border-color:#eee}.notification-item__read-at.unread{border-color:#2e7d32;background-color:#2e7d32}
1063
+ `,LO=`:root{--textPrimary: #292929;--textWhite: #fff;--primary500: #2E7D32;--grey100: #FAFAFA;--gray200: #EEEEEE;--gray600: #85858A;--link: #007BFF }.list-content{overflow-y:auto;overflow-x:hidden}.mark-all-read{text-align:right;color:#007bff;margin-bottom:12px;font-size:12px}.notification-items__wrapper{overflow:hidden}.notification-items__content{height:calc(100vh - 275px);overflow-x:hidden;overflow-y:auto;color:#292929}.notitification-item__container{display:flex;align-items:center;justify-content:space-between;padding:16px;border-bottom:#FAFAFA 1px solid;text-align:left;font-size:12px;position:relative;z-index:10;cursor:pointer;border-radius:4px;margin-bottom:8px}.notitification-item__container:hover{background-color:#fafafa}.notification-item__image-container{width:40px;height:40px;display:flex;justify-content:center;align-items:center;border-radius:50%;overflow:hidden;margin-right:16px}.notification-item__image-container img{width:100%;height:100%;text-align:center;-o-object-fit:cover;object-fit:cover;color:transparent;text-indent:10000px}.notification-item__context-link{color:#007bff}.notification-item__content{width:60%;padding-right:16px}.notification-item__user-name{margin-bottom:2px;font-size:14px}.notification-item__time{margin-right:15px;text-align:right}.notification-item__read-at{border-width:2px;border-style:solid;border-radius:50%;width:10px;height:10px;display:block;position:relative}.notification-item__read-at:before{position:absolute;top:-30px;right:0;width:91px;background-color:#85858a;color:#fff;border-radius:4px;font-size:10px;text-align:center;padding:4px;opacity:0;visibility:hidden;transition:all .3s cubic-bezier(.39,.575,.565,1)}.notification-item__read-at:hover:before{opacity:1;visibility:visible}.notification-item__read-at.read:before{content:"Mark as unread"}.notification-item__read-at.unread:before{content:"Mark as read"}.notification-item__read-at.read{border-color:#eee}.notification-item__read-at.unread{border-color:#2e7d32;background-color:#2e7d32}
1064
1064
  `,jO=`._notification-massage_container_ql4az_1{background:#fff;padding:0 64px 0 84px;border-radius:8px;font-family:TT Firs Neue Trl,sans-serif}._notification-massage_container_ql4az_1:before{position:absolute;content:"";width:48px;height:48px;background:url(https://ukpcsaprod.blob.core.windows.net/saas/notification-icon.svg) no-repeat center/100%;top:12px;left:24px}._notification-name_ql4az_18{font-weight:500;font-size:14px}._notification-message_service_ql4az_23{font-size:12px}._notification-message_button-close_ql4az_27{position:absolute;top:12px;right:24px;width:24px;height:24px}
1065
1065
  `,$O=`._subscription-diaglog_1gvmm_2{position:fixed;width:100vw;height:100vh;top:0;left:0;background-color:#0006;z-index:10000;display:flex;align-items:center;justify-content:center}._subscription-container_1gvmm_15{width:610px;height:222px;border-radius:8px;padding:32px 24px 40px;background:#fff;color:#292929}._subscription-title_1gvmm_25{font-size:20px;font-weight:500;text-align:center;color:#292929}._subscription-title_1gvmm_25,._subscription-text_1gvmm_34{margin-bottom:24px}._subscription-btn__container_1gvmm_38{display:flex;justify-content:space-between;align-items:center}._btn-success_1gvmm_44,._btn-cancel_1gvmm_45{width:150px;height:40px;display:flex;align-items:center;justify-content:center;padding:8px;color:#292929;border-radius:1px}._btn-cancel_1gvmm_45{background-color:#ddd}._btn-success_1gvmm_44{background-color:#93d500}
1066
1066
  `;function FO(e){return D.jsxRuntimeExports.jsxs("svg",{width:"34",height:"25",viewBox:"0 0 34 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[D.jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_16865_28134)",children:[D.jsxRuntimeExports.jsx("rect",{y:"0.5",width:"34",height:"24",rx:"3",fill:"#1A47B8"}),D.jsxRuntimeExports.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.61691 0.5H0V4.5L30.3635 24.5L34 24.5V20.5L3.61691 0.5Z",fill:"white"}),D.jsxRuntimeExports.jsx("path",{d:"M1.20635 0.5L34 22.1567V24.5H32.8219L0 2.82089V0.5H1.20635Z",fill:"#F93939"}),D.jsxRuntimeExports.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M30.7619 0.5H34V4.5C34 4.5 12.9683 17.8249 3.2381 24.5H0V20.5L30.7619 0.5Z",fill:"white"}),D.jsxRuntimeExports.jsx("path",{d:"M34 0.5H32.9019L0 22.1753V24.5H1.20635L34 2.83842V0.5Z",fill:"#F93939"}),D.jsxRuntimeExports.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.3648 0.5H21.6635V7.90291H34V17.0922H21.6635V24.5H12.3648V17.0922H0V7.90291H12.3648V0.5Z",fill:"white"}),D.jsxRuntimeExports.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M14.3158 0.5H19.6842V9.73077H34V15.2692H19.6842V24.5H14.3158V15.2692H0V9.73077H14.3158V0.5Z",fill:"#F93939"})]}),D.jsxRuntimeExports.jsx("defs",{children:D.jsxRuntimeExports.jsx("clipPath",{id:"clip0_16865_28134",children:D.jsxRuntimeExports.jsx("rect",{y:"0.5",width:"34",height:"24",rx:"3",fill:"white"})})})]})}function YO(e){return D.jsxRuntimeExports.jsxs("svg",{width:"34",height:"24",viewBox:"0 0 34 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[D.jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_16886_62505)",children:[D.jsxRuntimeExports.jsx("rect",{width:"34",height:"24",rx:"3",fill:"#F93939"}),D.jsxRuntimeExports.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0 16H34V24H0V16Z",fill:"#FFDA2C"}),D.jsxRuntimeExports.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0 0H34V8H0V0Z",fill:"#151515"})]}),D.jsxRuntimeExports.jsx("defs",{children:D.jsxRuntimeExports.jsx("clipPath",{id:"clip0_16886_62505",children:D.jsxRuntimeExports.jsx("rect",{width:"34",height:"24",rx:"3",fill:"white"})})})]})}function gy({logo:e,user:t,baseUrl:r,notiPath:s,style:o,classNames:c="",customColors:h,notiprops:x}){const S=e||"/public/assets/icons/logo-header.png",E={...o,color:(h==null?void 0:h.color)||"black",backgroundColor:(h==null?void 0:h.bgColor)||"black"},[A,Y]=D.reactExports.useState(!1),F=()=>{window.location.href=`${r}/authentication/logout?callbackUrl=${window.location.href}`};return D.jsxRuntimeExports.jsxs(ce.ShadowDomWrapper,{styles:[PO,NO,LO,jO,$O],style:{zIndex:1202},id:"topbar-wrapper",children:[D.jsxRuntimeExports.jsx("nav",{className:`navbar ${c}`,style:h?E:o,children:D.jsxRuntimeExports.jsxs("div",{className:"navbar-container",children:[D.jsxRuntimeExports.jsx("div",{className:"logo-container",children:D.jsxRuntimeExports.jsx("img",{src:S,alt:"logo-header"})}),D.jsxRuntimeExports.jsxs("div",{className:"right-side-container",children:[D.jsxRuntimeExports.jsx("span",{children:D.jsxRuntimeExports.jsxs(CD,{children:[D.jsxRuntimeExports.jsx(AO,{baseUrl:x.baseUrl,path:x.path,apiKey:x.apiKey,authDomain:x.authDomain,projectId:x.projectId,storageBucket:x.storageBucket,messagingSenderId:x.messagingSenderId,appId:x.appId,measurementId:x.measurementId,vapidKey:x.vapidKey}),D.jsxRuntimeExports.jsx(OO,{primaryColor:h==null?void 0:h.primaryColor,baseUrl:r,notiPath:s})]})}),D.jsxRuntimeExports.jsx("span",{className:"cursor-pointer",children:D.jsxRuntimeExports.jsx(_w,{primaryColor:h==null?void 0:h.primaryColor})}),D.jsxRuntimeExports.jsx(WO,{primaryColor:h==null?void 0:h.primaryColor}),D.jsxRuntimeExports.jsxs("div",{className:"userContainer",children:[D.jsxRuntimeExports.jsx(BO,{primaryColor:h==null?void 0:h.primaryColor,avatarUrl:t==null?void 0:t.avatarUrl,userName:t==null?void 0:t.firstName,setShowConfirmModal:Y}),D.jsxRuntimeExports.jsx("p",{className:"userFullName",children:`${(t==null?void 0:t.firstName)||"Unknown"} ${(t==null?void 0:t.lastName)||"User"}`})]})]})]})}),D.jsxRuntimeExports.jsx(ce.LogoutConfirmModal,{isOpen:A,onClose:()=>Y(!1),onConfirm:F})]})}function WO({primaryColor:e="#009d4f"}){var Y;const t=[{value:Iu.Language.en,element:D.jsxRuntimeExports.jsx(FO,{})},{value:Iu.Language.de,element:D.jsxRuntimeExports.jsx(YO,{})}],[r,s]=D.reactExports.useState(!1),[o,c]=D.reactExports.useState(new Array(t.length).fill(!1)),h={width:"100px",padding:"8px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",transition:"background-color 0.2s ease-in-out"},{language:x,setLanguage:S}=MR();D.reactExports.useEffect(()=>{eh({childrenClass:"languageDropdown",action(){s(!1)}})},[]);const E=F=>{c(V=>V.map((q,$)=>$===F))},A=F=>{c(V=>V.map((q,$)=>!1))};return D.jsxRuntimeExports.jsxs("div",{className:"languageDropdownContainer",style:{position:"relative"},children:[D.jsxRuntimeExports.jsxs("div",{className:"languageDropdown",onClick:()=>{s(!r)},children:[(Y=t.find(F=>F.value==x))==null?void 0:Y.element,D.jsxRuntimeExports.jsx("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:D.jsxRuntimeExports.jsx("path",{d:"M4.42724 7.92678L7.82372 11.3232C7.92135 11.4209 8.07964 11.4209 8.17727 11.3232L11.5737 7.92678C11.7312 7.76928 11.6197 7.5 11.3969 7.5H4.60402C4.38129 7.5 4.26975 7.76929 4.42724 7.92678Z",fill:"#85858A"})})]}),D.jsxRuntimeExports.jsx("div",{className:"dropdownListLanguage",style:{display:r?"block":"none",position:"absolute",top:"53px",right:"0px",padding:"8px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",backgroundColor:"#fafafa"},children:t.filter(F=>F.value!==x).map((F,V)=>D.jsxRuntimeExports.jsx("div",{className:"languageItem",style:{...h,backgroundColor:o[V]?e:"transparent"},onMouseEnter:()=>E(V),onMouseLeave:()=>A(V),onClick:()=>{S(F.value),localStorage.setItem("language",F.value),Iu.instance.changeLanguage(F.value),s(!1),A(V)},children:F.element}))})]})}function BO({avatarUrl:e,userName:t,setShowConfirmModal:r,primaryColor:s="#009d4f"}){const[o,c]=D.reactExports.useState(!1),h=D.reactExports.useRef(null),x=D.reactExports.useRef(null),[S,E]=D.reactExports.useState(!1),[A,Y]=D.reactExports.useState(!1),F={backgroundColor:S?s:"transparent"},V={backgroundColor:A?s:"transparent"};return D.reactExports.useEffect(()=>{eh({childrenClass:"userAvatar",action(){c(!1)}})},[]),D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:D.jsxRuntimeExports.jsxs("div",{style:{position:"relative"},children:[e?D.jsxRuntimeExports.jsx("img",{onClick:()=>c(!o),ref:h,alt:"user avatar",className:"userAvatar",src:e}):D.jsxRuntimeExports.jsx("div",{onClick:()=>c(!o),ref:h,className:"userAvatar",id:"userAvatarNull",children:(t==null?void 0:t.charAt(0))??""}),D.jsxRuntimeExports.jsx("div",{style:{display:o?"block":"none"},className:"avartarDropdownMenu",ref:x,children:D.jsxRuntimeExports.jsxs("ul",{children:[D.jsxRuntimeExports.jsx("li",{onMouseEnter:()=>Y(!0),onMouseLeave:()=>Y(!1),style:V,className:"avatar-dropdown-item",children:"Profile"}),D.jsxRuntimeExports.jsx("li",{onMouseEnter:()=>E(!0),onMouseLeave:()=>E(!1),style:F,onClick:()=>r(!0),className:"avatar-dropdown-item",children:"Logout"})]})})]})})}{const e=D.s(gy,{props:{logo:"string",user:"json",baseUrl:"string",notiPath:"string",classNames:"string",style:"json",customColors:"json",notiprops:"json"},shadow:"open"});customElements.define("global-topbar",e)}exports.HasPermission=T0;exports.TopBar=gy;exports.getUseHasPermission=E0;