@ukpc-lib/react 0.3.42 → 0.3.44

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 s=require("../index.module-06bf4d76.cjs"),c=require("axios"),u=require("react"),i=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("moment");require("@mui/material");const l=require("react-router-dom"),m=r=>{const[t,n]=u.useState([]);return u.useEffect(()=>{c.get(`${r}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(e=>n(e.data)).catch(e=>{console.error("Getting user permission error:",e)})},[r]),t},a=r=>(t,n)=>{const e=m(r);return n?t.every(o=>e==null?void 0:e.includes(o)):t.some(o=>e==null?void 0:e.includes(o))},P=({baseUrl:r,accessWith:t,requireAll:n,children:e})=>a(r)(t,n)?i.jsx(i.Fragment,{children:e}):null,h=({accessWith:r,requireAll:t,baseUrl:n,unAuthorizedPath:e,children:o})=>a(n)(r,t)?i.jsx(i.Fragment,{children:o}):i.jsx(l.Navigate,{to:e,replace:!0});exports.AuthProvider=s.AuthProvider;exports.SaasThemeProvider=s.SaasThemeProvider;exports.TranslationProvider=s.TranslationProvider;exports.color=s.color;exports.createCustomTheme=s.createCustomTheme;exports.getAxiosInstance=s.getAxiosInstance;exports.search=s.search;exports.translate=s.translate;exports.translationConfig=s.translationConfig;exports.useAuth=s.useAuth;exports.useCustomTranslation=s.useCustomTranslation;exports.useTheme=s.useTheme;exports.useTranslation=s.useTranslation$1;exports.HasPermission=P;exports.PermissionRoute=h;exports.getUseHasPermission=a;exports.useGetPermission=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../index.module-31b7b1cb.cjs"),c=require("axios"),u=require("react"),i=require("react/jsx-runtime");require("@r2wc/react-to-web-component");require("moment");require("@mui/material");const l=require("react-router-dom"),m=r=>{const[t,n]=u.useState([]);return u.useEffect(()=>{c.get(`${r}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(e=>n(e.data)).catch(e=>{console.error("Getting user permission error:",e)})},[r]),t},a=r=>(t,n)=>{const e=m(r);return n?t.every(o=>e==null?void 0:e.includes(o)):t.some(o=>e==null?void 0:e.includes(o))},P=({baseUrl:r,accessWith:t,requireAll:n,children:e})=>a(r)(t,n)?i.jsx(i.Fragment,{children:e}):null,h=({accessWith:r,requireAll:t,baseUrl:n,unAuthorizedPath:e,children:o})=>a(n)(r,t)?i.jsx(i.Fragment,{children:o}):i.jsx(l.Navigate,{to:e,replace:!0});exports.AuthProvider=s.AuthProvider;exports.SaasThemeProvider=s.SaasThemeProvider;exports.TranslationProvider=s.TranslationProvider;exports.color=s.color;exports.createCustomTheme=s.createCustomTheme;exports.getAxiosInstance=s.getAxiosInstance;exports.search=s.search;exports.translate=s.translate;exports.translationConfig=s.translationConfig;exports.useAuth=s.useAuth;exports.useCustomTranslation=s.useCustomTranslation;exports.useTheme=s.useTheme;exports.useTranslation=s.useTranslation$1;exports.HasPermission=P;exports.PermissionRoute=h;exports.getUseHasPermission=a;exports.useGetPermission=m;
@@ -1,4 +1,4 @@
1
- import { H as G, R as N, T as R, c as S, O as j, g as w, r as E, M as F, K as I, J, u as K, m as M, N as O } from "../index.module-0f5e9fad.js";
1
+ import { H as G, R as N, T as R, c as S, O as j, g as w, r as E, M as F, K as I, J, u as K, m as M, N as O } from "../index.module-bc09f930.js";
2
2
  import m from "axios";
3
3
  import { useState as u, useEffect as c } from "react";
4
4
  import { jsx as n, Fragment as a } from "react/jsx-runtime";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.3.42",
4
+ "version": "0.3.44",
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-3847ebf5.cjs");const e=require("../index-60a9bd54.cjs");exports.GlobalMenu=e.GlobalMenu;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../react-to-web-component-3847ebf5.cjs");const e=require("../index-727d1ad7.cjs");exports.GlobalMenu=e.GlobalMenu;
@@ -1,5 +1,5 @@
1
1
  import "../react-to-web-component-469d91d4.js";
2
- import { G as e } from "../index-db308fb2.js";
2
+ import { G as e } from "../index-979dc08c.js";
3
3
  export {
4
4
  e as GlobalMenu
5
5
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../react-to-web-component-3847ebf5.cjs");require("../index-60a9bd54.cjs");const e=require("../index-a3fc049e.cjs");require("../index-4327002b.cjs");exports.TopBar=e.TopBar;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../react-to-web-component-3847ebf5.cjs");require("../index-727d1ad7.cjs");const e=require("../index-0bff620d.cjs");require("../index-4327002b.cjs");exports.TopBar=e.TopBar;
@@ -1,6 +1,6 @@
1
1
  import "../react-to-web-component-469d91d4.js";
2
- import "../index-db308fb2.js";
3
- import { T as i } from "../index-981f4a42.js";
2
+ import "../index-979dc08c.js";
3
+ import { T as i } from "../index-2a2590c9.js";
4
4
  import "../index-b3659f2e.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-3847ebf5.cjs");const e=require("../index-a3fc049e.cjs");require("../index-60a9bd54.cjs");require("../index-4327002b.cjs");exports.HasPermission=e.HasPermission;exports.getUseHasPermission=e.getUseHasPermission;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../react-to-web-component-3847ebf5.cjs");const e=require("../index-0bff620d.cjs");require("../index-727d1ad7.cjs");require("../index-4327002b.cjs");exports.HasPermission=e.HasPermission;exports.getUseHasPermission=e.getUseHasPermission;
@@ -1,6 +1,6 @@
1
1
  import "../react-to-web-component-469d91d4.js";
2
- import { H as e, g as t } from "../index-981f4a42.js";
3
- import "../index-db308fb2.js";
2
+ import { H as e, g as t } from "../index-2a2590c9.js";
3
+ import "../index-979dc08c.js";
4
4
  import "../index-b3659f2e.js";
5
5
  export {
6
6
  e as HasPermission,
@@ -1,4 +1,4 @@
1
- "use strict";const D=require("./react-to-web-component-3847ebf5.cjs"),se=require("./index-60a9bd54.cjs"),ps=require("./index-4327002b.cjs");function qg(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=qg(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function Zn(){for(var e,t,r=0,s="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=qg(e))&&(s&&(s+=" "),s+=t);return s}const Sw=e=>{var s,o;const{tabs:t}=e,r=c=>{e.setCurrentTab(c.target.id)};return console.log("🚀 ~ brandColors:",e.currentTab),D.jsxRuntimeExports.jsxs(D.jsxRuntimeExports.Fragment,{children:[D.jsxRuntimeExports.jsx("style",{children:`
1
+ "use strict";const D=require("./react-to-web-component-3847ebf5.cjs"),se=require("./index-727d1ad7.cjs"),ps=require("./index-4327002b.cjs");function qg(e){var t,r,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=qg(e[t]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function Zn(){for(var e,t,r=0,s="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=qg(e))&&(s&&(s+=" "),s+=t);return s}const Sw=e=>{var s,o;const{tabs:t}=e,r=c=>{e.setCurrentTab(c.target.id)};return console.log("🚀 ~ brandColors:",e.currentTab),D.jsxRuntimeExports.jsxs(D.jsxRuntimeExports.Fragment,{children:[D.jsxRuntimeExports.jsx("style",{children:`
2
2
  .tab-title {
3
3
  min-width: 90px;
4
4
  padding: 5px 16px;
@@ -1089,8 +1089,8 @@ function print() { __p += __j.call(arguments, '') }
1089
1089
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1090
1090
  * See the License for the specific language governing permissions and
1091
1091
  * limitations under the License.
1092
- */function dy(e=BA()){return wI().then(t=>{if(!t)throw nn.create("unsupported-browser")},t=>{throw nn.create("indexed-db-unsupported")}),Hd(Wd(e),"messaging").getImmediate()}async function kI(e,t){return e=Wd(e),fy(e,t)}function CI(e,t){return e=Wd(e),SI(e,t)}_I();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}));kI(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 se.axios.post(x,{deviceToken:s},{withCredentials:!0})}catch(h){console.log(h),se.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)})},DI=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}}))}},EI=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}));CI(r,s=>{console.log("payload",s),t(s)})}),us={"subscription-diaglog":"_subscription-diaglog_1bysb_2","subscription-container":"_subscription-container_1bysb_15","subscription-title":"_subscription-title_1bysb_25","subscription-text":"_subscription-text_1bysb_34","subscription-btn__container":"_subscription-btn__container_1bysb_38","btn-success":"_btn-success_1bysb_44","btn-cancel":"_btn-cancel_1bysb_45"},TI=["granted","denied"],RI=e=>{const[t,r]=D.reactExports.useState(!1),s=()=>{Notification.requestPermission(function(c){c==="granted"&&hy(e),TI.includes(c)&&r(!0)})},o=()=>{r(!0)};return D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:t?"":D.jsxRuntimeExports.jsx("div",{className:us["subscription-diaglog"],children:D.jsxRuntimeExports.jsxs("div",{className:us["subscription-container"],children:[D.jsxRuntimeExports.jsx("h4",{className:us["subscription-title"],children:"Notification"}),D.jsxRuntimeExports.jsx("p",{className:us["subscription-text"],children:"Choice to receive notifications for the most recent updates. You have the flexibility to disable them whenever you prefer."}),D.jsxRuntimeExports.jsxs("div",{className:us["subscription-btn__container"],children:[D.jsxRuntimeExports.jsx("button",{className:us["btn-cancel"],onClick:o,children:"Not now"}),D.jsxRuntimeExports.jsx("button",{className:us["btn-success"],onClick:s,children:"Turn on"})]})]})})})},Ou={"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"},Hi=D.reactExports.createContext({}),MI=({children:e})=>{const[t,r]=D.reactExports.useState(!0),[s,o]=D.reactExports.useState({all:{rows:[],total:0},unread:{rows:[],total:0}}),c=()=>{r(!t)},h=()=>{r(!0)};return D.jsxRuntimeExports.jsx(Hi.Provider,{value:{isOpen:t,toggleOpen:c,setShowModalFalse:h,notidata:s,setNotiData:o},children:e})},AI=e=>{const[t,r]=D.reactExports.useState({actorName:"",message:"",context:""});console.log(t);const{setNotiData:s}=D.reactExports.useContext(Hi);function o(){return D.jsxRuntimeExports.jsx("div",{className:Ou["notification-massage_container"],children:D.jsxRuntimeExports.jsxs("div",{className:Ou["notification-massage_content"],children:[D.jsxRuntimeExports.jsx("h6",{className:Ou["notification-name"],children:t==null?void 0:t.actorName}),D.jsxRuntimeExports.jsxs("div",{className:Ou["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.actorName||t.message||t.context)&&se.notify(D.jsxRuntimeExports.jsx(o,{}))},[t]),D.reactExports.useEffect(()=>{Notification.permission==="granted"&&hy(e)},[Notification.permission]),D.reactExports.useEffect(()=>{DI(s)},[]),EI(e).then(c=>{var h,x,S;console.log("aaa",c),r({actorName:(h=c==null?void 0:c.data)==null?void 0:h.actorName,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(RI,{...e}):""})};function OI({config:e,pushError:t=se.pushError}){const r=se.axios.create(e);r.interceptors.request.use(async o=>(o.headers={Accept:"application/json","Content-Type":"application/json"},o),o=>Promise.reject(o)),r.interceptors.response.use(o=>o,async o=>s(o));async function s(o){var S,E,A,$;console.error("Error 🚨:",o);const c=o.config,h=(E=(S=o.response)==null?void 0:S.data)==null?void 0:E.errorMessage,x=h===se.ERROR_MESSAGE.TOKEN_EXPIRED;return((A=o.response)==null?void 0:A.status)===401?x&&!c._retry?(c._retry=!0,r.post("/authentication/api/v1/auth/refresh-token").then(()=>r(c)).catch(()=>se.login(e.baseURL))):((!h||!x)&&se.login(e.baseURL),Promise.reject("Unauthorized! Please login again.")):((($=o.response)==null?void 0:$.status)===403||t(ps.t(`${h||"Something went wrong!"}`)),Promise.reject(o.response.data))}return r}const II=e=>{const[t,r]=D.reactExports.useState([]);return D.reactExports.useEffect(()=>{se.axios.get(`${e}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(s=>r(s.data)).catch(s=>{console.error("Getting user permission error:",s)})},[e]),t},py=e=>(t,r)=>{const s=II(e);return r?t.every(o=>s==null?void 0:s.includes(o)):t.some(o=>s==null?void 0:s.includes(o))},gy=({baseUrl:e,accessWith:t,requireAll:r,children:s})=>py(e)(t,r)?D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:s}):null;{const e=D.s(gy,{props:{baseUrl:"string",accessWith:"json",requireAll:"boolean",children:"json"},shadow:"open"});customElements.define("has-permission",e)}function PI(){const[e,t]=D.reactExports.useState();return D.reactExports.useEffect(()=>{const r=localStorage.getItem("language");t(r||ps.Language.en)},[]),{language:e,setLanguage:t}}const my=D.reactExports.createContext({}),NI=()=>D.reactExports.useContext(my),LI=({children:e})=>{const t=PI();return D.jsxRuntimeExports.jsx(my.Provider,{value:t,children:D.jsxRuntimeExports.jsx(ps.I18nextProvider,{i18n:ps.instance,children:e})})},eh=({baseUrl:e,notiPath:t,setNotiData:r})=>{const s=OI({config:{withCredentials:!0,baseURL:e}});return async()=>{var A;const h=e+(t||"/notification-management/api/v1/notifications"),S=(A=(await s.get(h,{params:{filter:{notificationFilterType:"all"}},withCredentials:!0})).data)==null?void 0:A.rows,E=S==null?void 0:S.filter($=>$.isRead===!1);r({all:{rows:S??[],total:(S==null?void 0:S.length)??0},unread:{rows:E??[],total:(E==null?void 0:E.length)??0}})}},jI=({notification:e,baseUrl:t,notiPath:r,markAllAsReadState:s,brandColors:o})=>{var H;const[c,h]=D.reactExports.useState(!1),[x,S]=D.reactExports.useState({id:e.id,isRead:e.isRead}),E=x.isRead===!1?"unread":"read",A={borderColor:x.isRead?"#c5c5c5":(o==null?void 0:o.primary500)||se.color.primary500,backgroundColor:x.isRead?"#c5c5c5":(o==null?void 0:o.primary500)||se.color.primary500},{setNotiData:$}=D.reactExports.useContext(Hi),B=eh({baseUrl:t,notiPath:r,setNotiData:$}),K=async(ae,de)=>{var he,te;try{const ie=r||`/notification-management/api/v1/notifications/${ae}`,d=t+ie;await se.axios.put(d,{isRead:de},{withCredentials:!0})}catch(ie){S({id:e.id,isRead:e.isRead}),se.pushError(((te=(he=ie.response)==null?void 0:he.data)==null?void 0:te.errorMessage)||"Have error when get notification list")}await B()},q=(ae,de)=>{console.log("specificNotificationID",ae);const he=!de;S(te=>({...te,isRead:he})),console.log("newIsReadState",he),K(ae,he)};D.reactExports.useEffect(()=>{S(s?ae=>({...ae,isRead:!0}):{id:e.id,isRead:e.isRead})},[s,e.id,e.isRead]);const F=()=>{h(!c)},re=ae=>{const de=le(),he=le(ae),te=de.diff(he,"days"),ie=de.diff(he,"minutes"),d=de.diff(he,"months"),Me=de.diff(he,"years");if(console.log("diffInMonths",d),ie<1)return"Just now";if(te===0){if(ie<=60)return`${ie} minute${ie>1?"s":""} ago`;const oe=Math.floor(ie/60);return console.log("diffIhours",oe),`${oe} hour${oe>1?"s":""} ago`}if(te===1)return"Yesterday";if(te>=2&&te<7)return`${te} days ago`;if(te<30){const oe=Math.floor(te/7);return`${oe} week${oe>1?"s":""} ago`}return d===0||d===1?"1 month ago":d<12?`${d} months ago`:Me===0||Me===1?"1 year ago":"Over 1 year ago"};return D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:D.jsxRuntimeExports.jsxs("div",{className:"notitification-item__container",children:[D.jsxRuntimeExports.jsx("div",{className:"notification-item__image-container",children:D.jsxRuntimeExports.jsx("img",{src:!e.actorAvatarUrl||e.actorName==="System"?"https://ukpcsaprod.blob.core.windows.net/account/logo.png":e.actorAvatarUrl,onError:({currentTarget:ae})=>{console.log("img on error",ae),ae.onerror=null,ae.src="https://ukpcsaprod.blob.core.windows.net/account/logo.png"},alt:e.actorName})}),D.jsxRuntimeExports.jsxs("div",{style:{width:"100%"},children:[D.jsxRuntimeExports.jsxs("div",{className:"notification-item__content-wrapper",children:[D.jsxRuntimeExports.jsxs("div",{className:"notification-item__content",children:[D.jsxRuntimeExports.jsx("p",{className:"notification-item__user-name",children:e.actorName}),D.jsxRuntimeExports.jsxs("p",{children:[`${e.message} `,D.jsxRuntimeExports.jsx("span",{children:e==null?void 0:e.context})]}),(e==null?void 0:e.notificationType)==="deleteMultiple"&&D.jsxRuntimeExports.jsxs("button",{style:{color:se.color.primary400,textDecoration:"underline"},onClick:F,children:[c?"Hide":"Show "," details"]})]}),D.jsxRuntimeExports.jsx("div",{className:"notification-item__time",children:D.jsxRuntimeExports.jsx("p",{children:re(e.createdAt)})}),D.jsxRuntimeExports.jsx("button",{className:`${E} notification-item__read-at`,"aria-label":"Mark as read",style:A,onClick:()=>q(e.id,e.isRead)})]}),c&&D.jsxRuntimeExports.jsx("div",{style:{background:"#fff",width:"100%",padding:"8px",fontSize:"12px",marginTop:"8px"},children:D.jsxRuntimeExports.jsx("ul",{children:(H=e==null?void 0:e.data)==null?void 0:H.map((ae,de)=>D.jsxRuntimeExports.jsxs("li",{style:{display:"flex",alignItems:"center",marginBottom:"4px"},children:[D.jsxRuntimeExports.jsx("span",{style:{backgroundColor:se.color.primary400},className:"list-dot"}),D.jsxRuntimeExports.jsx("span",{style:{width:"calc(100% - 12px)"},children:ae.name})]},de))})})]})]})})},Ug=({notidata:e,baseUrl:t,notiPath:r,brandColors:s,notiUnreadNumber:o})=>{const[c,h]=D.reactExports.useState(!1);console.log(c);const{setNotiData:x}=D.reactExports.useContext(Hi),S=eh({baseUrl:t,notiPath:r,setNotiData:x}),E=async()=>{var $,B;try{const q=t+(r||"/notification-management/api/v1/notifications");await se.axios.put(q,{withCredentials:!0})}catch(K){console.log(K),h(!1),se.pushError(((B=($=K.response)==null?void 0:$.data)==null?void 0:B.errorMessage)||"Have error when get notification list")}await S(),h(!1)},A=()=>{h(!0),E()};return console.log("notiUnreadNumber",o),D.jsxRuntimeExports.jsxs("div",{children:[D.jsxRuntimeExports.jsx("div",{className:"mark-all-read",children:D.jsxRuntimeExports.jsx("button",{onClick:A,style:{visibility:o===0?"hidden":"visible"},children:"Mark all as read"})}),D.jsxRuntimeExports.jsx("div",{className:"notification-items__wrapper",children:D.jsxRuntimeExports.jsx("div",{className:"notification-items__content",children:Object.values(e).map(($,B)=>D.jsxRuntimeExports.jsx(jI,{notification:$,baseUrl:t,notiPath:r,markAllAsReadState:c,brandColors:s},B))})})]})},$I=({baseUrl:e,notiPath:t,brandColors:r})=>{var S,E,A,$;const{setShowModalFalse:s}=D.reactExports.useContext(Hi),{notidata:o}=D.reactExports.useContext(Hi);console.log(o);const[c,h]=D.reactExports.useState("all"),x=[{id:"all",tabTitle:`All (${((S=o==null?void 0:o.all)==null?void 0:S.total)||0})`,children:D.jsxRuntimeExports.jsx(Ug,{notidata:((E=o==null?void 0:o.all)==null?void 0:E.rows)||[],baseUrl:e,notiPath:t,brandColors:r,notiUnreadNumber:o.unread.total})},{id:"unread",tabTitle:`Unread (${((A=o==null?void 0:o.unread)==null?void 0:A.total)||0})`,children:D.jsxRuntimeExports.jsx(Ug,{notidata:(($=o==null?void 0:o.unread)==null?void 0:$.rows)||[],baseUrl:e,notiPath:t,brandColors:r,notiUnreadNumber:o.unread.total})}];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",color:se.color.textPrimary},className:"list-title",children:"Notifications"}),D.jsxRuntimeExports.jsx("button",{onClick:s,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(Sw,{tabs:x,setCurrentTab:h,currentTab:c,brandColors:r})]})})})};function th({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 FI({iconColor:e="#fff",baseUrl:t,notiPath:r,brandColors:s}){var $,B;const{isOpen:o,toggleOpen:c,setShowModalFalse:h}=D.reactExports.useContext(Hi),{notidata:x,setNotiData:S}=D.reactExports.useContext(Hi),E=eh({baseUrl:t,notiPath:r,setNotiData:S}),A=async()=>{var K,q;try{await E()}catch(F){se.pushError(((q=(K=F.response)==null?void 0:K.data)==null?void 0:q.errorMessage)||"Have error when get notification list")}};return D.reactExports.useEffect(()=>{A()},[o]),D.reactExports.useEffect(()=>{th({childrenClass:"noti-container",childrenOpenClass:"noti-list-container",action(){h()}})}),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:c,style:{cursor:"pointer",color:e},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:"currentColor",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:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(x==null?void 0:x.unread)&&(x==null?void 0:x.unread.total)!=0&&D.jsxRuntimeExports.jsx("span",{style:{position:"absolute",top:"-9px",right:"-6px",width:"20px",height:"20px",border:"1px solid #fff",borderRadius:"50%",color:"#fff",fontSize:"12px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:se.color.danger},className:"notification-badge",children:(($=x==null?void 0:x.unread)==null?void 0:$.total)>9?"9+":`${(B=x==null?void 0:x.unread)==null?void 0:B.total}`})]}),D.jsxRuntimeExports.jsx("div",{className:"noti-list-container",children:!o&&D.jsxRuntimeExports.jsx($I,{baseUrl:t,notiPath:r,brandColors:s})})]})}const YI=`.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{height:100%;display:flex;align-items:center}.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;-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}
1092
+ */function dy(e=BA()){return wI().then(t=>{if(!t)throw nn.create("unsupported-browser")},t=>{throw nn.create("indexed-db-unsupported")}),Hd(Wd(e),"messaging").getImmediate()}async function kI(e,t){return e=Wd(e),fy(e,t)}function CI(e,t){return e=Wd(e),SI(e,t)}_I();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}));kI(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 se.axios.post(x,{deviceToken:s},{withCredentials:!0})}catch(h){console.log(h),se.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)})},DI=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}}))}},EI=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}));CI(r,s=>{console.log("payload",s),t(s)})}),us={"subscription-diaglog":"_subscription-diaglog_1bysb_2","subscription-container":"_subscription-container_1bysb_15","subscription-title":"_subscription-title_1bysb_25","subscription-text":"_subscription-text_1bysb_34","subscription-btn__container":"_subscription-btn__container_1bysb_38","btn-success":"_btn-success_1bysb_44","btn-cancel":"_btn-cancel_1bysb_45"},TI=["granted","denied"],RI=e=>{const[t,r]=D.reactExports.useState(!1),s=()=>{Notification.requestPermission(function(c){c==="granted"&&hy(e),TI.includes(c)&&r(!0)})},o=()=>{r(!0)};return D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:t?"":D.jsxRuntimeExports.jsx("div",{className:us["subscription-diaglog"],children:D.jsxRuntimeExports.jsxs("div",{className:us["subscription-container"],children:[D.jsxRuntimeExports.jsx("h4",{className:us["subscription-title"],children:"Notification"}),D.jsxRuntimeExports.jsx("p",{className:us["subscription-text"],children:"Choice to receive notifications for the most recent updates. You have the flexibility to disable them whenever you prefer."}),D.jsxRuntimeExports.jsxs("div",{className:us["subscription-btn__container"],children:[D.jsxRuntimeExports.jsx("button",{className:us["btn-cancel"],onClick:o,children:"Not now"}),D.jsxRuntimeExports.jsx("button",{className:us["btn-success"],onClick:s,children:"Turn on"})]})]})})})},Ou={"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"},Hi=D.reactExports.createContext({}),MI=({children:e})=>{const[t,r]=D.reactExports.useState(!0),[s,o]=D.reactExports.useState({all:{rows:[],total:0},unread:{rows:[],total:0}}),c=()=>{r(!t)},h=()=>{r(!0)};return D.jsxRuntimeExports.jsx(Hi.Provider,{value:{isOpen:t,toggleOpen:c,setShowModalFalse:h,notidata:s,setNotiData:o},children:e})},AI=e=>{const[t,r]=D.reactExports.useState({actorName:"",message:"",context:""});console.log(t);const{setNotiData:s}=D.reactExports.useContext(Hi);function o(){return D.jsxRuntimeExports.jsx("div",{className:Ou["notification-massage_container"],children:D.jsxRuntimeExports.jsxs("div",{className:Ou["notification-massage_content"],children:[D.jsxRuntimeExports.jsx("h6",{className:Ou["notification-name"],children:t==null?void 0:t.actorName}),D.jsxRuntimeExports.jsxs("div",{className:Ou["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.actorName||t.message||t.context)&&se.notify(D.jsxRuntimeExports.jsx(o,{}))},[t]),D.reactExports.useEffect(()=>{Notification.permission==="granted"&&hy(e)},[Notification.permission]),D.reactExports.useEffect(()=>{DI(s)},[]),EI(e).then(c=>{var h,x,S;console.log("aaa",c),r({actorName:(h=c==null?void 0:c.data)==null?void 0:h.actorName,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(RI,{...e}):""})};function OI({config:e,pushError:t=se.pushError}){const r=se.axios.create(e);r.interceptors.request.use(async o=>(o.headers={Accept:"application/json","Content-Type":"application/json"},o),o=>Promise.reject(o)),r.interceptors.response.use(o=>o,async o=>s(o));async function s(o){var S,E,A,$;console.error("Error 🚨:",o);const c=o.config,h=(E=(S=o.response)==null?void 0:S.data)==null?void 0:E.errorMessage,x=h===se.ERROR_MESSAGE.TOKEN_EXPIRED;return((A=o.response)==null?void 0:A.status)===401?x&&!c._retry?(c._retry=!0,r.post("/authentication/api/v1/auth/refresh-token").then(()=>r(c)).catch(()=>se.login(e.baseURL))):((!h||!x)&&se.login(e.baseURL),Promise.reject("Unauthorized! Please login again.")):((($=o.response)==null?void 0:$.status)===403||t(ps.t(`${h||"Something went wrong!"}`)),Promise.reject(o.response.data))}return r}const II=e=>{const[t,r]=D.reactExports.useState([]);return D.reactExports.useEffect(()=>{se.axios.get(`${e}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(s=>r(s.data)).catch(s=>{console.error("Getting user permission error:",s)})},[e]),t},py=e=>(t,r)=>{const s=II(e);return r?t.every(o=>s==null?void 0:s.includes(o)):t.some(o=>s==null?void 0:s.includes(o))},gy=({baseUrl:e,accessWith:t,requireAll:r,children:s})=>py(e)(t,r)?D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:s}):null;{const e=D.s(gy,{props:{baseUrl:"string",accessWith:"json",requireAll:"boolean",children:"json"},shadow:"open"});customElements.define("has-permission",e)}function PI(){const[e,t]=D.reactExports.useState();return D.reactExports.useEffect(()=>{const r=localStorage.getItem("language");t(r||ps.Language.en)},[]),{language:e,setLanguage:t}}const my=D.reactExports.createContext({}),NI=()=>D.reactExports.useContext(my),LI=({children:e})=>{const t=PI();return D.jsxRuntimeExports.jsx(my.Provider,{value:t,children:D.jsxRuntimeExports.jsx(ps.I18nextProvider,{i18n:ps.instance,children:e})})},eh=({baseUrl:e,notiPath:t,setNotiData:r})=>{const s=OI({config:{withCredentials:!0,baseURL:e}});return async()=>{var A;const h=e+(t||"/notification-management/api/v1/notifications"),S=(A=(await s.get(h,{params:{filter:{notificationFilterType:"all"}},withCredentials:!0})).data)==null?void 0:A.rows,E=S==null?void 0:S.filter($=>$.isRead===!1);r({all:{rows:S??[],total:(S==null?void 0:S.length)??0},unread:{rows:E??[],total:(E==null?void 0:E.length)??0}})}},jI=({notification:e,baseUrl:t,notiPath:r,markAllAsReadState:s,brandColors:o})=>{var H;const[c,h]=D.reactExports.useState(!1),[x,S]=D.reactExports.useState({id:e.id,isRead:e.isRead}),E=x.isRead===!1?"unread":"read",A={borderColor:x.isRead?"#c5c5c5":(o==null?void 0:o.primary500)||se.color.primary500,backgroundColor:x.isRead?"#c5c5c5":(o==null?void 0:o.primary500)||se.color.primary500},{setNotiData:$}=D.reactExports.useContext(Hi),B=eh({baseUrl:t,notiPath:r,setNotiData:$}),K=async(ae,de)=>{var he,te;try{const ie=r||`/notification-management/api/v1/notifications/${ae}`,d=t+ie;await se.axios.put(d,{isRead:de},{withCredentials:!0})}catch(ie){S({id:e.id,isRead:e.isRead}),se.pushError(((te=(he=ie.response)==null?void 0:he.data)==null?void 0:te.errorMessage)||"Have error when get notification list")}await B()},q=(ae,de)=>{console.log("specificNotificationID",ae);const he=!de;S(te=>({...te,isRead:he})),console.log("newIsReadState",he),K(ae,he)};D.reactExports.useEffect(()=>{S(s?ae=>({...ae,isRead:!0}):{id:e.id,isRead:e.isRead})},[s,e.id,e.isRead]);const F=()=>{h(!c)},re=ae=>{const de=le(),he=le(ae),te=de.diff(he,"days"),ie=de.diff(he,"minutes"),d=de.diff(he,"months"),Me=de.diff(he,"years");if(console.log("diffInMonths",d),ie<1)return"Just now";if(te===0){if(ie<=60)return`${ie} minute${ie>1?"s":""} ago`;const oe=Math.floor(ie/60);return console.log("diffIhours",oe),`${oe} hour${oe>1?"s":""} ago`}if(te===1)return"Yesterday";if(te>=2&&te<7)return`${te} days ago`;if(te<30){const oe=Math.floor(te/7);return`${oe} week${oe>1?"s":""} ago`}return d===0||d===1?"1 month ago":d<12?`${d} months ago`:Me===0||Me===1?"1 year ago":"Over 1 year ago"};return D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:D.jsxRuntimeExports.jsxs("div",{className:"notitification-item__container",children:[D.jsxRuntimeExports.jsx("div",{className:"notification-item__image-container",children:D.jsxRuntimeExports.jsx("img",{src:!e.actorAvatarUrl||e.actorName==="System"?"https://ukpcsaprod.blob.core.windows.net/account/logo.png":e.actorAvatarUrl,onError:({currentTarget:ae})=>{console.log("img on error",ae),ae.onerror=null,ae.src="https://ukpcsaprod.blob.core.windows.net/account/logo.png"},alt:e.actorName})}),D.jsxRuntimeExports.jsxs("div",{style:{width:"100%"},children:[D.jsxRuntimeExports.jsxs("div",{className:"notification-item__content-wrapper",children:[D.jsxRuntimeExports.jsxs("div",{className:"notification-item__content",children:[D.jsxRuntimeExports.jsx("p",{className:"notification-item__user-name",children:e.actorName}),D.jsxRuntimeExports.jsxs("p",{children:[`${e.message} `,D.jsxRuntimeExports.jsx("span",{children:e==null?void 0:e.context})]}),(e==null?void 0:e.notificationType)==="deleteMultiple"&&D.jsxRuntimeExports.jsxs("button",{style:{color:se.color.primary400,textDecoration:"underline"},onClick:F,children:[c?"Hide":"Show "," details"]})]}),D.jsxRuntimeExports.jsx("div",{className:"notification-item__time",children:D.jsxRuntimeExports.jsx("p",{children:re(e.createdAt)})}),D.jsxRuntimeExports.jsx("button",{className:`${E} notification-item__read-at`,"aria-label":"Mark as read",style:A,onClick:()=>q(e.id,e.isRead)})]}),c&&D.jsxRuntimeExports.jsx("div",{style:{background:"#fff",width:"100%",padding:"8px",fontSize:"12px",marginTop:"8px"},children:D.jsxRuntimeExports.jsx("ul",{children:(H=e==null?void 0:e.data)==null?void 0:H.map((ae,de)=>D.jsxRuntimeExports.jsxs("li",{style:{display:"flex",alignItems:"center",marginBottom:"4px"},children:[D.jsxRuntimeExports.jsx("span",{style:{backgroundColor:se.color.primary400},className:"list-dot"}),D.jsxRuntimeExports.jsx("span",{style:{width:"calc(100% - 12px)"},children:ae.name})]},de))})})]})]})})},Ug=({notidata:e,baseUrl:t,notiPath:r,brandColors:s,notiUnreadNumber:o})=>{const[c,h]=D.reactExports.useState(!1);console.log(c);const{setNotiData:x}=D.reactExports.useContext(Hi),S=eh({baseUrl:t,notiPath:r,setNotiData:x}),E=async()=>{var $,B;try{const q=t+(r||"/notification-management/api/v1/notifications");await se.axios.put(q,{withCredentials:!0})}catch(K){console.log(K),h(!1),se.pushError(((B=($=K.response)==null?void 0:$.data)==null?void 0:B.errorMessage)||"Have error when get notification list")}await S(),h(!1)},A=()=>{h(!0),E()};return console.log("notiUnreadNumber",o),D.jsxRuntimeExports.jsxs("div",{children:[D.jsxRuntimeExports.jsx("div",{className:"mark-all-read",children:D.jsxRuntimeExports.jsx("button",{onClick:A,style:{visibility:o===0?"hidden":"visible"},children:"Mark all as read"})}),D.jsxRuntimeExports.jsx("div",{className:"notification-items__wrapper",children:D.jsxRuntimeExports.jsx("div",{className:"notification-items__content",children:Object.values(e).map(($,B)=>D.jsxRuntimeExports.jsx(jI,{notification:$,baseUrl:t,notiPath:r,markAllAsReadState:c,brandColors:s},B))})})]})},$I=({baseUrl:e,notiPath:t,brandColors:r})=>{var S,E,A,$;const{setShowModalFalse:s}=D.reactExports.useContext(Hi),{notidata:o}=D.reactExports.useContext(Hi);console.log(o);const[c,h]=D.reactExports.useState("all"),x=[{id:"all",tabTitle:`All (${((S=o==null?void 0:o.all)==null?void 0:S.total)||0})`,children:D.jsxRuntimeExports.jsx(Ug,{notidata:((E=o==null?void 0:o.all)==null?void 0:E.rows)||[],baseUrl:e,notiPath:t,brandColors:r,notiUnreadNumber:o.unread.total})},{id:"unread",tabTitle:`Unread (${((A=o==null?void 0:o.unread)==null?void 0:A.total)||0})`,children:D.jsxRuntimeExports.jsx(Ug,{notidata:(($=o==null?void 0:o.unread)==null?void 0:$.rows)||[],baseUrl:e,notiPath:t,brandColors:r,notiUnreadNumber:o.unread.total})}];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",color:se.color.textPrimary},className:"list-title",children:"Notifications"}),D.jsxRuntimeExports.jsx("button",{onClick:s,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(Sw,{tabs:x,setCurrentTab:h,currentTab:c,brandColors:r})]})})})};function th({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 FI({iconColor:e="#fff",baseUrl:t,notiPath:r,brandColors:s}){var $,B;const{isOpen:o,toggleOpen:c,setShowModalFalse:h}=D.reactExports.useContext(Hi),{notidata:x,setNotiData:S}=D.reactExports.useContext(Hi),E=eh({baseUrl:t,notiPath:r,setNotiData:S}),A=async()=>{var K,q;try{await E()}catch(F){se.pushError(((q=(K=F.response)==null?void 0:K.data)==null?void 0:q.errorMessage)||"Have error when get notification list")}};return D.reactExports.useEffect(()=>{A()},[o]),D.reactExports.useEffect(()=>{th({childrenClass:"noti-container",childrenOpenClass:"noti-list-container",action(){h()}})}),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:c,style:{cursor:"pointer",color:e},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:"currentColor",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:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(x==null?void 0:x.unread)&&(x==null?void 0:x.unread.total)!=0&&D.jsxRuntimeExports.jsx("span",{style:{position:"absolute",top:"-9px",right:"-6px",width:"20px",height:"20px",border:"1px solid #fff",borderRadius:"50%",color:"#fff",fontSize:"12px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:se.color.danger},className:"notification-badge",children:(($=x==null?void 0:x.unread)==null?void 0:$.total)>9?"9+":`${(B=x==null?void 0:x.unread)==null?void 0:B.total}`})]}),D.jsxRuntimeExports.jsx("div",{className:"noti-list-container",children:!o&&D.jsxRuntimeExports.jsx($I,{baseUrl:t,notiPath:r,brandColors:s})})]})}const YI=`.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{display:flex;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{height:100%;display:flex;align-items:center}.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;-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}
1093
1093
  `,WI=`: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;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:46px;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__content-wrapper{width:100%;display:flex;align-items:center;justify-content:space-between}.notification-item__context-link{color:#007bff}.notification-item__content{width:68%;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}.list-dot{border-radius:50%;width:8px;height:8px;margin-right:4px;display:block}
1094
- `,BI=`._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}
1095
- `,HI=`._subscription-diaglog_1bysb_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_1bysb_15{width:610px;height:222px;border-radius:8px;padding:32px 24px 40px;background:#fff;color:#292929}._subscription-title_1bysb_25{font-size:20px;font-weight:500;text-align:center;color:#292929}._subscription-title_1bysb_25,._subscription-text_1bysb_34{margin-bottom:24px}._subscription-btn__container_1bysb_38{display:flex;justify-content:space-between;align-items:center}._btn-success_1bysb_44,._btn-cancel_1bysb_45{width:150px;height:40px;display:flex;align-items:center;justify-content:center;padding:8px;color:#292929;border-radius:1px;transition:background-color .25s cubic-bezier(.4,0,.2,1) 0ms,box-shadow .25s cubic-bezier(.4,0,.2,1) 0ms,border-color .25s cubic-bezier(.4,0,.2,1) 0ms,color .25s cubic-bezier(.4,0,.2,1) 0ms}._btn-cancel_1bysb_45{background-color:#ddd}._btn-cancel_1bysb_45:hover{background-color:#c5c5c5}._btn-success_1bysb_44{background-color:#93d500}._btn-success_1bysb_44:hover{background-color:#2e7d32}
1096
- `;function UI(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 qI(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 yy({logo:e,user:t,baseUrl:r,notiPath:s,style:o,classNames:c="",customColors:h,notiprops:x}){const S=e||"https://ukpcsaprod.blob.core.windows.net/lib/images/logo-header.png",E={...o,color:(h==null?void 0:h.headerTextColor)||"white",backgroundColor:(h==null?void 0:h.headerBgColor)||"black"},[A,$]=D.reactExports.useState(!1),B=()=>{window.location.href=`${r}/authentication/logout?callbackUrl=${window.location.href}`};return D.jsxRuntimeExports.jsxs(se.ShadowDomWrapper,{styles:[YI,WI,BI,HI],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",style:{height:"40px"}})}),D.jsxRuntimeExports.jsxs("div",{className:"right-side-container",children:[D.jsxRuntimeExports.jsx("span",{children:D.jsxRuntimeExports.jsxs(MI,{children:[D.jsxRuntimeExports.jsx(AI,{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(FI,{iconColor:h==null?void 0:h.headerTextColor,baseUrl:r,notiPath:s,brandColors:h})]})}),D.jsxRuntimeExports.jsx(zI,{}),D.jsxRuntimeExports.jsxs("div",{className:"userContainer",children:[D.jsxRuntimeExports.jsx(VI,{primaryColor:h==null?void 0:h.headerTextColor,avatarUrl:t==null?void 0:t.avatarUrl,userName:t==null?void 0:t.firstName,setShowConfirmModal:$}),D.jsxRuntimeExports.jsx("p",{className:"userFullName",style:{color:h==null?void 0:h.headerTextColor},children:`${(t==null?void 0:t.firstName)||"Unknown"} ${(t==null?void 0:t.lastName)||"User"}`})]})]})]})}),D.jsxRuntimeExports.jsx(se.LogoutConfirmModal,{isOpen:A,onClose:()=>$(!1),onConfirm:B})]})}function zI(){var h;const e=[{value:ps.Language.en,element:D.jsxRuntimeExports.jsx(UI,{})},{value:ps.Language.de,element:D.jsxRuntimeExports.jsx(qI,{})}],[t,r]=D.reactExports.useState(!1);D.reactExports.useState(new Array(e.length).fill(!1));const{language:s,setLanguage:o}=NI();D.reactExports.useEffect(()=>{th({childrenClass:"languageDropdown",action(){r(!1)}})},[]);const c=(h=e.find(x=>x.value==s))==null?void 0:h.element;return D.jsxRuntimeExports.jsx("div",{className:"languageDropdownContainer",style:{position:"relative"},children:D.jsxRuntimeExports.jsx("div",{className:"languageDropdown",onClick:()=>{r(!t)},children:c})})}function VI({avatarUrl:e,userName:t}){const[r,s]=D.reactExports.useState(!1),o=D.reactExports.useRef(null);return D.reactExports.useRef(null),D.reactExports.useState(!1),D.reactExports.useState(!1),D.reactExports.useEffect(()=>{th({childrenClass:"userAvatar",action(){s(!1)}})},[]),D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:D.jsxRuntimeExports.jsx("div",{style:{position:"relative"},children:e?D.jsxRuntimeExports.jsx("img",{onClick:()=>s(!r),ref:o,alt:"user avatar",className:"userAvatar",src:e}):D.jsxRuntimeExports.jsx("div",{onClick:()=>s(!r),ref:o,className:"userAvatar",id:"userAvatarNull",children:(t==null?void 0:t.charAt(0))??""})})})}const GI=e=>D.jsxRuntimeExports.jsx(LI,{children:D.jsxRuntimeExports.jsx(yy,{...e})});{const e=D.s(GI,{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=gy;exports.TopBar=yy;exports.getUseHasPermission=py;
1094
+ `,BI=`._subscription-diaglog_1bysb_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_1bysb_15{width:610px;height:222px;border-radius:8px;padding:32px 24px 40px;background:#fff;color:#292929}._subscription-title_1bysb_25{font-size:20px;font-weight:500;text-align:center;color:#292929}._subscription-title_1bysb_25,._subscription-text_1bysb_34{margin-bottom:24px}._subscription-btn__container_1bysb_38{display:flex;justify-content:space-between;align-items:center}._btn-success_1bysb_44,._btn-cancel_1bysb_45{width:150px;height:40px;display:flex;align-items:center;justify-content:center;padding:8px;color:#292929;border-radius:1px;transition:background-color .25s cubic-bezier(.4,0,.2,1) 0ms,box-shadow .25s cubic-bezier(.4,0,.2,1) 0ms,border-color .25s cubic-bezier(.4,0,.2,1) 0ms,color .25s cubic-bezier(.4,0,.2,1) 0ms}._btn-cancel_1bysb_45{background-color:#ddd}._btn-cancel_1bysb_45:hover{background-color:#c5c5c5}._btn-success_1bysb_44{background-color:#93d500}._btn-success_1bysb_44:hover{background-color:#2e7d32}
1095
+ `,HI=`._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}
1096
+ `;function UI(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 qI(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 yy({logo:e,user:t,baseUrl:r,notiPath:s,style:o,classNames:c="",customColors:h,notiprops:x,customElement:S}){const E=e||"https://ukpcsaprod.blob.core.windows.net/lib/images/logo-header.png",A={...o,color:(h==null?void 0:h.headerTextColor)||"white",backgroundColor:(h==null?void 0:h.headerBgColor)||"black"},[$,B]=D.reactExports.useState(!1),K=()=>{window.location.href=`${r}/authentication/logout?callbackUrl=${window.location.href}`};return D.jsxRuntimeExports.jsxs(se.StyleWrapper,{styles:[YI,WI,HI,BI],style:{zIndex:1202},id:"topbar-wrapper",children:[D.jsxRuntimeExports.jsx("nav",{className:`navbar ${c}`,style:h?A:o,children:D.jsxRuntimeExports.jsxs("div",{className:"navbar-container",children:[D.jsxRuntimeExports.jsx("div",{className:"logo-container",children:D.jsxRuntimeExports.jsx("img",{src:E,alt:"logo-header",style:{height:"40px"}})}),D.jsxRuntimeExports.jsxs("div",{className:"right-side-container",children:[S,D.jsxRuntimeExports.jsx("span",{children:D.jsxRuntimeExports.jsxs(MI,{children:[D.jsxRuntimeExports.jsx(AI,{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(FI,{iconColor:h==null?void 0:h.headerTextColor,baseUrl:r,notiPath:s,brandColors:h})]})}),D.jsxRuntimeExports.jsx(zI,{}),D.jsxRuntimeExports.jsxs("div",{className:"userContainer",children:[D.jsxRuntimeExports.jsx(VI,{primaryColor:h==null?void 0:h.headerTextColor,avatarUrl:t==null?void 0:t.avatarUrl,userName:t==null?void 0:t.firstName,setShowConfirmModal:B}),D.jsxRuntimeExports.jsx("p",{className:"userFullName",style:{color:h==null?void 0:h.headerTextColor},children:`${(t==null?void 0:t.firstName)||"Unknown"} ${(t==null?void 0:t.lastName)||"User"}`})]})]})]})}),D.jsxRuntimeExports.jsx(se.LogoutConfirmModal,{isOpen:$,onClose:()=>B(!1),onConfirm:K})]})}function zI(){var h;const e=[{value:ps.Language.en,element:D.jsxRuntimeExports.jsx(UI,{})},{value:ps.Language.de,element:D.jsxRuntimeExports.jsx(qI,{})}],[t,r]=D.reactExports.useState(!1);D.reactExports.useState(new Array(e.length).fill(!1));const{language:s,setLanguage:o}=NI();D.reactExports.useEffect(()=>{th({childrenClass:"languageDropdown",action(){r(!1)}})},[]);const c=(h=e.find(x=>x.value==s))==null?void 0:h.element;return D.jsxRuntimeExports.jsx("div",{className:"languageDropdownContainer",style:{position:"relative"},children:D.jsxRuntimeExports.jsx("div",{className:"languageDropdown",onClick:()=>{r(!t)},children:c})})}function VI({avatarUrl:e,userName:t}){const[r,s]=D.reactExports.useState(!1),o=D.reactExports.useRef(null);return D.reactExports.useRef(null),D.reactExports.useState(!1),D.reactExports.useState(!1),D.reactExports.useEffect(()=>{th({childrenClass:"userAvatar",action(){s(!1)}})},[]),D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:D.jsxRuntimeExports.jsx("div",{style:{position:"relative"},children:e?D.jsxRuntimeExports.jsx("img",{onClick:()=>s(!r),ref:o,alt:"user avatar",className:"userAvatar",src:e}):D.jsxRuntimeExports.jsx("div",{onClick:()=>s(!r),ref:o,className:"userAvatar",id:"userAvatarNull",children:(t==null?void 0:t.charAt(0))??""})})})}const GI=e=>D.jsxRuntimeExports.jsx(LI,{children:D.jsxRuntimeExports.jsx(yy,{...e})});{const e=D.s(GI,{props:{logo:"string",user:"json",baseUrl:"string",notiPath:"string",classNames:"string",style:"json",customColors:"json",notiprops:"json",customElement:"string"},shadow:"open"});customElements.define("global-topbar",e)}exports.HasPermission=gy;exports.TopBar=yy;exports.getUseHasPermission=py;
@@ -1,5 +1,5 @@
1
1
  import { j as z, r as Q, R as Qp, g as _r, a as Js, c as pa, b as Ox, d as Ix, s as tm } from "./react-to-web-component-469d91d4.js";
2
- import { c as Bi, _ as $e, a as nr, b as Rx, o as Px, d as Nx, e as ho, p as po, n as Lx, l as eg, E as $x, S as Fx, L as Yx } from "./index-db308fb2.js";
2
+ import { c as Bi, _ as $e, a as nr, b as Rx, o as Px, d as Nx, e as ho, p as po, n as Lx, l as eg, E as $x, S as Fx, L as Yx } from "./index-979dc08c.js";
3
3
  import { _ as Bx, t as Wx, I as jx, i as Hx, L as Lf } from "./index-b3659f2e.js";
4
4
  function nm(e) {
5
5
  var t, r, a = "";
@@ -18536,10 +18536,10 @@ function uP({
18536
18536
  ) })
18537
18537
  ] });
18538
18538
  }
18539
- const lP = `.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{height:100%;display:flex;align-items:center}.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;-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}
18539
+ const lP = `.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{display:flex;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{height:100%;display:flex;align-items:center}.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;-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}
18540
18540
  `, cP = `: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;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:46px;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__content-wrapper{width:100%;display:flex;align-items:center;justify-content:space-between}.notification-item__context-link{color:#007bff}.notification-item__content{width:68%;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}.list-dot{border-radius:50%;width:8px;height:8px;margin-right:4px;display:block}
18541
- `, fP = `._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}
18542
- `, dP = `._subscription-diaglog_1bysb_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_1bysb_15{width:610px;height:222px;border-radius:8px;padding:32px 24px 40px;background:#fff;color:#292929}._subscription-title_1bysb_25{font-size:20px;font-weight:500;text-align:center;color:#292929}._subscription-title_1bysb_25,._subscription-text_1bysb_34{margin-bottom:24px}._subscription-btn__container_1bysb_38{display:flex;justify-content:space-between;align-items:center}._btn-success_1bysb_44,._btn-cancel_1bysb_45{width:150px;height:40px;display:flex;align-items:center;justify-content:center;padding:8px;color:#292929;border-radius:1px;transition:background-color .25s cubic-bezier(.4,0,.2,1) 0ms,box-shadow .25s cubic-bezier(.4,0,.2,1) 0ms,border-color .25s cubic-bezier(.4,0,.2,1) 0ms,color .25s cubic-bezier(.4,0,.2,1) 0ms}._btn-cancel_1bysb_45{background-color:#ddd}._btn-cancel_1bysb_45:hover{background-color:#c5c5c5}._btn-success_1bysb_44{background-color:#93d500}._btn-success_1bysb_44:hover{background-color:#2e7d32}
18541
+ `, fP = `._subscription-diaglog_1bysb_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_1bysb_15{width:610px;height:222px;border-radius:8px;padding:32px 24px 40px;background:#fff;color:#292929}._subscription-title_1bysb_25{font-size:20px;font-weight:500;text-align:center;color:#292929}._subscription-title_1bysb_25,._subscription-text_1bysb_34{margin-bottom:24px}._subscription-btn__container_1bysb_38{display:flex;justify-content:space-between;align-items:center}._btn-success_1bysb_44,._btn-cancel_1bysb_45{width:150px;height:40px;display:flex;align-items:center;justify-content:center;padding:8px;color:#292929;border-radius:1px;transition:background-color .25s cubic-bezier(.4,0,.2,1) 0ms,box-shadow .25s cubic-bezier(.4,0,.2,1) 0ms,border-color .25s cubic-bezier(.4,0,.2,1) 0ms,color .25s cubic-bezier(.4,0,.2,1) 0ms}._btn-cancel_1bysb_45{background-color:#ddd}._btn-cancel_1bysb_45:hover{background-color:#c5c5c5}._btn-success_1bysb_44{background-color:#93d500}._btn-success_1bysb_44:hover{background-color:#2e7d32}
18542
+ `, dP = `._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}
18543
18543
  `;
18544
18544
  function hP(e) {
18545
18545
  return /* @__PURE__ */ z.jsxs(
@@ -18655,13 +18655,14 @@ function gP({
18655
18655
  style: o,
18656
18656
  classNames: c = "",
18657
18657
  customColors: h,
18658
- notiprops: _
18658
+ notiprops: _,
18659
+ customElement: S
18659
18660
  }) {
18660
- const S = e || "https://ukpcsaprod.blob.core.windows.net/lib/images/logo-header.png", D = {
18661
+ const D = e || "https://ukpcsaprod.blob.core.windows.net/lib/images/logo-header.png", A = {
18661
18662
  ...o,
18662
18663
  color: (h == null ? void 0 : h.headerTextColor) || "white",
18663
18664
  backgroundColor: (h == null ? void 0 : h.headerBgColor) || "black"
18664
- }, [A, $] = Q.useState(!1), W = () => {
18665
+ }, [$, W] = Q.useState(!1), K = () => {
18665
18666
  window.location.href = `${r}/authentication/logout?callbackUrl=${window.location.href}`;
18666
18667
  };
18667
18668
  return /* @__PURE__ */ z.jsxs(
@@ -18671,8 +18672,8 @@ function gP({
18671
18672
  lP,
18672
18673
  // tabStyles,
18673
18674
  cP,
18674
- fP,
18675
- dP
18675
+ dP,
18676
+ fP
18676
18677
  ],
18677
18678
  style: { zIndex: 1202 },
18678
18679
  id: "topbar-wrapper",
@@ -18681,10 +18682,11 @@ function gP({
18681
18682
  "nav",
18682
18683
  {
18683
18684
  className: `navbar ${c}`,
18684
- style: h ? D : o,
18685
+ style: h ? A : o,
18685
18686
  children: /* @__PURE__ */ z.jsxs("div", { className: "navbar-container", children: [
18686
- /* @__PURE__ */ z.jsx("div", { className: "logo-container", children: /* @__PURE__ */ z.jsx("img", { src: S, alt: "logo-header", style: { height: "40px" } }) }),
18687
+ /* @__PURE__ */ z.jsx("div", { className: "logo-container", children: /* @__PURE__ */ z.jsx("img", { src: D, alt: "logo-header", style: { height: "40px" } }) }),
18687
18688
  /* @__PURE__ */ z.jsxs("div", { className: "right-side-container", children: [
18689
+ S,
18688
18690
  /* @__PURE__ */ z.jsx("span", { children: /* @__PURE__ */ z.jsxs(XR, { children: [
18689
18691
  /* @__PURE__ */ z.jsx(
18690
18692
  JR,
@@ -18719,7 +18721,7 @@ function gP({
18719
18721
  primaryColor: h == null ? void 0 : h.headerTextColor,
18720
18722
  avatarUrl: t == null ? void 0 : t.avatarUrl,
18721
18723
  userName: t == null ? void 0 : t.firstName,
18722
- setShowConfirmModal: $
18724
+ setShowConfirmModal: W
18723
18725
  }
18724
18726
  ),
18725
18727
  /* @__PURE__ */ z.jsx(
@@ -18738,9 +18740,9 @@ function gP({
18738
18740
  /* @__PURE__ */ z.jsx(
18739
18741
  Yx,
18740
18742
  {
18741
- isOpen: A,
18742
- onClose: () => $(!1),
18743
- onConfirm: W
18743
+ isOpen: $,
18744
+ onClose: () => W(!1),
18745
+ onConfirm: K
18744
18746
  }
18745
18747
  )
18746
18748
  ]
@@ -18833,7 +18835,8 @@ const vP = (e) => /* @__PURE__ */ z.jsx(aP, { children: /* @__PURE__ */ z.jsx(gP
18833
18835
  classNames: "string",
18834
18836
  style: "json",
18835
18837
  customColors: "json",
18836
- notiprops: "json"
18838
+ notiprops: "json",
18839
+ customElement: "string"
18837
18840
  },
18838
18841
  shadow: "open"
18839
18842
  });