@ukpc-lib/react 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/components/GlobalMenu/components/MenuItem.d.ts +1 -1
  2. package/dist/components/index.cjs +1 -1
  3. package/dist/components/index.js +3 -3
  4. package/dist/index-2ca7cc99.js +636 -0
  5. package/dist/index-5840ed79.cjs +1 -0
  6. package/dist/{index.module-be2c9027.cjs → index.module-28c2f9be.cjs} +116 -116
  7. package/dist/{index.module-fcfb53fb.js → index.module-d03675ea.js} +6673 -7185
  8. package/dist/share/index.cjs +1 -1
  9. package/dist/share/index.d.ts +1 -1
  10. package/dist/share/index.js +26 -25
  11. package/dist/theme/Theme.d.ts +1 -1
  12. package/dist/theme/index.cjs +1 -1
  13. package/dist/theme/index.d.ts +26 -3
  14. package/dist/theme/index.js +7 -459
  15. package/package.json +1 -1
  16. package/web-components-bundle/global-menu/index.cjs +1 -1
  17. package/web-components-bundle/global-menu/index.js +1 -1
  18. package/web-components-bundle/global-topbar/index.cjs +1 -1
  19. package/web-components-bundle/global-topbar/index.js +2 -2
  20. package/web-components-bundle/has-permission/index.cjs +1 -1
  21. package/web-components-bundle/has-permission/index.js +2 -2
  22. package/web-components-bundle/{index-ff7fd2be.cjs → index-12495706.cjs} +1 -1
  23. package/web-components-bundle/{index-8081b070.js → index-21a54132.js} +1 -1
  24. package/web-components-bundle/{index-c311c558.cjs → index-25f216cc.cjs} +16 -16
  25. package/web-components-bundle/{index-feebf9bf.js → index-c5021c14.js} +856 -882
  26. package/dist/index-5bc96a1f.js +0 -147
  27. package/dist/index-b3ac4c73.cjs +0 -1
  28. package/dist/share/BrandThemeProvider/Colors.d.ts +0 -33
  29. package/dist/share/BrandThemeProvider/Theme.d.ts +0 -21
  30. package/dist/share/BrandThemeProvider/index.d.ts +0 -15
  31. package/dist/theme/SaasThemeProvider.d.ts +0 -2
@@ -1,5 +1,5 @@
1
1
  import { Identity, MenuItemDto } from '../models';
2
- import { ColorsType } from '../../../share/BrandThemeProvider/Colors';
2
+ import { ColorsType } from '../../../theme/Colors';
3
3
  export type OwnMenuItemProps = {
4
4
  replacePath?(path: string): string;
5
5
  ssr?: boolean;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),C=require("react"),g=require("../index.module-be2c9027.cjs"),sn=require("../index-b3ac4c73.cjs"),K=require("moment"),Ue=require("axios");require("@r2wc/react-to-web-component");const M=require("@mui/material");require("react-router-dom");function Xn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const L=Xn(C);function Jn({primaryColor:e="#009d4f"}){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:[s.jsx("path",{d:"M8.5 19.5H8C4 19.5 2 18.5 2 13.5V8.5C2 4.5 4 2.5 8 2.5H16C20 2.5 22 4.5 22 8.5V13.5C22 17.5 20 19.5 16 19.5H15.5C15.19 19.5 14.89 19.65 14.7 19.9L13.2 21.9C12.54 22.78 11.46 22.78 10.8 21.9L9.3 19.9C9.14 19.68 8.77 19.5 8.5 19.5Z",stroke:e,"stroke-width":"1.5","stroke-miterlimit":"10","stroke-linecap":"round","stroke-linejoin":"round"}),s.jsx("path",{d:"M15.9965 11.5H16.0054",stroke:e,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),s.jsx("path",{d:"M11.9955 11.5H12.0045",stroke:e,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),s.jsx("path",{d:"M7.99451 11.5H8.00349",stroke:e,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}const Qn=e=>{const{tabs:t}=e,r=n=>{e.setCurrentTab(n.target.id)};return s.jsxs("div",{className:"tab-container",children:[s.jsx("div",{style:{display:"flex",width:"100%",height:"50px",borderBottom:`1px solid ${sn.color.grey200}`},className:"tab-container__title",children:t.map((n,o)=>s.jsx("button",{id:n.id,disabled:e.currentTab===`${n.id}`,onClick:r,className:`tab-title ${e.currentTab===`${n.id}`?"is-active":""}`,children:n.tabTitle},o))}),s.jsx("div",{className:"tab-content",children:t.map((n,o)=>s.jsx("div",{children:e.currentTab===`${n.id}`&&s.jsx("div",{children:n.children})},o))})]})},eo=e=>s.jsx(g.Q,{autoClose:3e3,hideProgressBar:!0,closeButton:!1,position:"bottom-left",newestOnTop:!0,pauseOnFocusLoss:!1,style:{fontFamily:"inherit"},...e}),to=e=>s.jsx(g.Q,{autoClose:3e3,hideProgressBar:!0,closeButton:!1,position:"bottom-left",newestOnTop:!0,pauseOnFocusLoss:!1,style:{fontFamily:"inherit",width:"610px"},containerId:"toastifyNotification",...e}),Zt=({baseUrl:e,notiPath:t,setNotiData:r})=>async()=>{const i=e+(t||"/notification-management/api/v1/notifications"),a=await Ue.get(i,{params:{filter:{notificationFilterType:"all"}},withCredentials:!0}),c=await Ue.get(i,{params:{filter:{notificationFilterType:"unread"}},withCredentials:!0});Promise.all([a,c]).then(d=>{var f,h,m,p;console.log("result: "+d),r({all:{rows:(f=d[0].data)==null?void 0:f.rows,total:(h=d[0].data)==null?void 0:h.total},unread:{rows:(m=d[1].data)==null?void 0:m.rows,total:(p=d[1].data)==null?void 0:p.total}})})},ro=({notification:e,baseUrl:t,notiPath:r,markAllAsReadState:n})=>{const[o,i]=C.useState({id:e.id,isRead:e.isRead}),a=o.isRead===!1?"unread":"read",{setNotiData:c}=C.useContext(g.CustomOpenList),d=Zt({baseUrl:t,notiPath:r,setNotiData:c}),f=async(p,x)=>{var v,l;try{const u=r||`/notification-management/api/v1/notifications/${p}`,b=t+u;await Ue.put(b,{isRead:x},{withCredentials:!0})}catch(u){i({id:e.id,isRead:e.isRead}),g.pushError(((l=(v=u.response)==null?void 0:v.data)==null?void 0:l.errorMessage)||"Have error when get notification list")}await d()},h=(p,x)=>{console.log("specificNotificationID",p);const v=!x;i(l=>({...l,isRead:v})),console.log("newIsReadState",v),f(p,v)};C.useEffect(()=>{i(n?p=>({...p,isRead:!0}):{id:e.id,isRead:e.isRead})},[n,e.id,e.isRead]);const m=p=>{const x=K(),v=K(p),l=x.diff(v,"days"),u=x.diff(v,"minutes"),b=x.diff(v,"months"),w=x.diff(v,"years");if(console.log("diffInMonths",b),u<1)return"Just now";if(l===0){if(u<=60)return`${u} minute${u>1?"s":""} ago`;const _=Math.floor(u/60);return console.log("diffIhours",_),`${_} hour${_>1?"s":""} ago`}if(l===1)return"Yesterday";if(l>=2&&l<7)return`${l} days ago`;if(l<30){const _=Math.floor(l/7);return`${_} week${_>1?"s":""} ago`}return b===0||b===1?"1 month ago":b<12?`${b} months ago`:w===0||w===1?"1 year ago":"Over 1 year ago"};return s.jsxs("div",{className:"notitification-item__container",onClick:()=>h(e.id,e.isRead),children:[s.jsx("div",{className:"notification-item__image-container",children:s.jsx("img",{src:e==null?void 0:e.userAvatarUrl,onError:({currentTarget:p})=>{p.onerror=null,p.src="https://ukpcsaprod.blob.core.windows.net/account/logo.png"},alt:e.userName})}),s.jsxs("div",{className:"notification-item__content",children:[s.jsx("p",{className:"notification-item__user-name",children:e.userName}),s.jsxs("p",{children:[`${e.message} `,s.jsx("span",{children:e==null?void 0:e.context})]})]}),s.jsx("div",{className:"notification-item__time",children:s.jsx("p",{children:m(e.createdAt)})}),s.jsx("button",{className:`${a} notification-item__read-at`,"aria-label":"Mark as read"})]})},gr=({notidata:e,baseUrl:t,notiPath:r})=>{const[n,o]=C.useState(!1);console.log(n);const{setNotiData:i}=C.useContext(g.CustomOpenList),a=Zt({baseUrl:t,notiPath:r,setNotiData:i}),c=async()=>{var f,h;try{const p=t+(r||"/notification-management/api/v1/notifications");await Ue.put(p,{withCredentials:!0})}catch(m){console.log(m),o(!1),g.pushError(((h=(f=m.response)==null?void 0:f.data)==null?void 0:h.errorMessage)||"Have error when get notification list")}await a(),o(!1)},d=()=>{o(!0),c()};return s.jsxs("div",{children:[s.jsx("div",{className:"mark-all-read",children:s.jsx("button",{onClick:d,children:"Mark all as read"})}),s.jsx("div",{className:"notification-items__wrapper",children:s.jsx("div",{className:"notification-items__content",children:Object.values(e).map((f,h)=>s.jsx(ro,{notification:f,baseUrl:t,notiPath:r,markAllAsReadState:n},h))})})]})},no=({baseUrl:e,notiPath:t})=>{var c,d,f,h;const{setShowModalFalse:r}=C.useContext(g.CustomOpenList),{notidata:n}=C.useContext(g.CustomOpenList);console.log(n);const[o,i]=C.useState("all"),a=[{id:"all",tabTitle:`All (${((c=n==null?void 0:n.all)==null?void 0:c.total)||0})`,children:s.jsx(gr,{notidata:((d=n==null?void 0:n.all)==null?void 0:d.rows)||[],baseUrl:e,notiPath:t})},{id:"unread",tabTitle:`Unread (${((f=n==null?void 0:n.unread)==null?void 0:f.total)||0})`,children:s.jsx(gr,{notidata:((h=n==null?void 0:n.unread)==null?void 0:h.rows)||[],baseUrl:e,notiPath:t})}];return s.jsx(s.Fragment,{children:s.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:s.jsxs("div",{className:"list-content",children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsx("h3",{style:{fontSize:"24px",fontWeight:"500"},className:"list-title",children:"Notifications"}),s.jsx("button",{onClick:r,children:s.jsx("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:s.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"})})})]}),s.jsx(Qn,{tabs:a,setCurrentTab:i,currentTab:o})]})})})};function Xt({childrenClass:e,action:t,childrenOpenClass:r}){const n=document.querySelector("#topbar-wrapper"),o=n==null?void 0:n.shadowRoot,i=o==null?void 0:o.querySelector(`.${e}`),a=o==null?void 0:o.querySelector(`.${r}`),c=o==null?void 0:o.querySelector("nav"),d=f=>{c==null||c.addEventListener("click",function(h){if(r&&a&&a.contains(h.target)){if(i&&!i.contains(h.target))return}else i&&!i.contains(h.target)&&t()}),n&&!n.contains(f.target)&&t()};document.addEventListener("click",d,!0)}function oo({primaryColor:e="#009d4f",baseUrl:t,notiPath:r}){var h,m;const{isOpen:n,toggleOpen:o,setShowModalFalse:i}=C.useContext(g.CustomOpenList),{notidata:a,setNotiData:c}=C.useContext(g.CustomOpenList),d=Zt({baseUrl:t,notiPath:r,setNotiData:c}),f=async()=>{var p,x;try{await d()}catch(v){g.pushError(((x=(p=v.response)==null?void 0:p.data)==null?void 0:x.errorMessage)||"Have error when get notification list")}};return C.useEffect(()=>{f()},[n]),C.useEffect(()=>{Xt({childrenClass:"noti-container",childrenOpenClass:"noti-list-container",action(){i()}})}),s.jsxs("div",{children:[s.jsxs("div",{className:"noti-container",style:{position:"relative"},children:[s.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:[s.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"}),s.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"})]}),(a==null?void 0:a.unread)&&(a==null?void 0:a.unread.total)!=0&&s.jsx("span",{style:{position:"absolute",top:"-9px",right:"-6px",background:`${sn.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:((h=a==null?void 0:a.unread)==null?void 0:h.total)>9?"9+":`${(m=a==null?void 0:a.unread)==null?void 0:m.total}`})]}),s.jsx("div",{className:"noti-list-container",children:!n&&s.jsx(no,{baseUrl:t,notiPath:r})})]})}const io=`.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;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}
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),C=require("react"),g=require("../index.module-28c2f9be.cjs"),sn=require("../index-5840ed79.cjs"),K=require("moment"),Ue=require("axios");require("@r2wc/react-to-web-component");const M=require("@mui/material");require("react-router-dom");function Xn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const L=Xn(C);function Jn({primaryColor:e="#009d4f"}){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:[s.jsx("path",{d:"M8.5 19.5H8C4 19.5 2 18.5 2 13.5V8.5C2 4.5 4 2.5 8 2.5H16C20 2.5 22 4.5 22 8.5V13.5C22 17.5 20 19.5 16 19.5H15.5C15.19 19.5 14.89 19.65 14.7 19.9L13.2 21.9C12.54 22.78 11.46 22.78 10.8 21.9L9.3 19.9C9.14 19.68 8.77 19.5 8.5 19.5Z",stroke:e,"stroke-width":"1.5","stroke-miterlimit":"10","stroke-linecap":"round","stroke-linejoin":"round"}),s.jsx("path",{d:"M15.9965 11.5H16.0054",stroke:e,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),s.jsx("path",{d:"M11.9955 11.5H12.0045",stroke:e,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),s.jsx("path",{d:"M7.99451 11.5H8.00349",stroke:e,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]})}const Qn=e=>{const{tabs:t}=e,r=n=>{e.setCurrentTab(n.target.id)};return s.jsxs("div",{className:"tab-container",children:[s.jsx("div",{style:{display:"flex",width:"100%",height:"50px",borderBottom:`1px solid ${sn.color.grey200}`},className:"tab-container__title",children:t.map((n,o)=>s.jsx("button",{id:n.id,disabled:e.currentTab===`${n.id}`,onClick:r,className:`tab-title ${e.currentTab===`${n.id}`?"is-active":""}`,children:n.tabTitle},o))}),s.jsx("div",{className:"tab-content",children:t.map((n,o)=>s.jsx("div",{children:e.currentTab===`${n.id}`&&s.jsx("div",{children:n.children})},o))})]})},eo=e=>s.jsx(g.Q,{autoClose:3e3,hideProgressBar:!0,closeButton:!1,position:"bottom-left",newestOnTop:!0,pauseOnFocusLoss:!1,style:{fontFamily:"inherit"},...e}),to=e=>s.jsx(g.Q,{autoClose:3e3,hideProgressBar:!0,closeButton:!1,position:"bottom-left",newestOnTop:!0,pauseOnFocusLoss:!1,style:{fontFamily:"inherit",width:"610px"},containerId:"toastifyNotification",...e}),Zt=({baseUrl:e,notiPath:t,setNotiData:r})=>async()=>{const i=e+(t||"/notification-management/api/v1/notifications"),a=await Ue.get(i,{params:{filter:{notificationFilterType:"all"}},withCredentials:!0}),c=await Ue.get(i,{params:{filter:{notificationFilterType:"unread"}},withCredentials:!0});Promise.all([a,c]).then(d=>{var f,h,m,p;console.log("result: "+d),r({all:{rows:(f=d[0].data)==null?void 0:f.rows,total:(h=d[0].data)==null?void 0:h.total},unread:{rows:(m=d[1].data)==null?void 0:m.rows,total:(p=d[1].data)==null?void 0:p.total}})})},ro=({notification:e,baseUrl:t,notiPath:r,markAllAsReadState:n})=>{const[o,i]=C.useState({id:e.id,isRead:e.isRead}),a=o.isRead===!1?"unread":"read",{setNotiData:c}=C.useContext(g.CustomOpenList),d=Zt({baseUrl:t,notiPath:r,setNotiData:c}),f=async(p,x)=>{var v,l;try{const u=r||`/notification-management/api/v1/notifications/${p}`,b=t+u;await Ue.put(b,{isRead:x},{withCredentials:!0})}catch(u){i({id:e.id,isRead:e.isRead}),g.pushError(((l=(v=u.response)==null?void 0:v.data)==null?void 0:l.errorMessage)||"Have error when get notification list")}await d()},h=(p,x)=>{console.log("specificNotificationID",p);const v=!x;i(l=>({...l,isRead:v})),console.log("newIsReadState",v),f(p,v)};C.useEffect(()=>{i(n?p=>({...p,isRead:!0}):{id:e.id,isRead:e.isRead})},[n,e.id,e.isRead]);const m=p=>{const x=K(),v=K(p),l=x.diff(v,"days"),u=x.diff(v,"minutes"),b=x.diff(v,"months"),w=x.diff(v,"years");if(console.log("diffInMonths",b),u<1)return"Just now";if(l===0){if(u<=60)return`${u} minute${u>1?"s":""} ago`;const _=Math.floor(u/60);return console.log("diffIhours",_),`${_} hour${_>1?"s":""} ago`}if(l===1)return"Yesterday";if(l>=2&&l<7)return`${l} days ago`;if(l<30){const _=Math.floor(l/7);return`${_} week${_>1?"s":""} ago`}return b===0||b===1?"1 month ago":b<12?`${b} months ago`:w===0||w===1?"1 year ago":"Over 1 year ago"};return s.jsxs("div",{className:"notitification-item__container",onClick:()=>h(e.id,e.isRead),children:[s.jsx("div",{className:"notification-item__image-container",children:s.jsx("img",{src:e==null?void 0:e.userAvatarUrl,onError:({currentTarget:p})=>{p.onerror=null,p.src="https://ukpcsaprod.blob.core.windows.net/account/logo.png"},alt:e.userName})}),s.jsxs("div",{className:"notification-item__content",children:[s.jsx("p",{className:"notification-item__user-name",children:e.userName}),s.jsxs("p",{children:[`${e.message} `,s.jsx("span",{children:e==null?void 0:e.context})]})]}),s.jsx("div",{className:"notification-item__time",children:s.jsx("p",{children:m(e.createdAt)})}),s.jsx("button",{className:`${a} notification-item__read-at`,"aria-label":"Mark as read"})]})},gr=({notidata:e,baseUrl:t,notiPath:r})=>{const[n,o]=C.useState(!1);console.log(n);const{setNotiData:i}=C.useContext(g.CustomOpenList),a=Zt({baseUrl:t,notiPath:r,setNotiData:i}),c=async()=>{var f,h;try{const p=t+(r||"/notification-management/api/v1/notifications");await Ue.put(p,{withCredentials:!0})}catch(m){console.log(m),o(!1),g.pushError(((h=(f=m.response)==null?void 0:f.data)==null?void 0:h.errorMessage)||"Have error when get notification list")}await a(),o(!1)},d=()=>{o(!0),c()};return s.jsxs("div",{children:[s.jsx("div",{className:"mark-all-read",children:s.jsx("button",{onClick:d,children:"Mark all as read"})}),s.jsx("div",{className:"notification-items__wrapper",children:s.jsx("div",{className:"notification-items__content",children:Object.values(e).map((f,h)=>s.jsx(ro,{notification:f,baseUrl:t,notiPath:r,markAllAsReadState:n},h))})})]})},no=({baseUrl:e,notiPath:t})=>{var c,d,f,h;const{setShowModalFalse:r}=C.useContext(g.CustomOpenList),{notidata:n}=C.useContext(g.CustomOpenList);console.log(n);const[o,i]=C.useState("all"),a=[{id:"all",tabTitle:`All (${((c=n==null?void 0:n.all)==null?void 0:c.total)||0})`,children:s.jsx(gr,{notidata:((d=n==null?void 0:n.all)==null?void 0:d.rows)||[],baseUrl:e,notiPath:t})},{id:"unread",tabTitle:`Unread (${((f=n==null?void 0:n.unread)==null?void 0:f.total)||0})`,children:s.jsx(gr,{notidata:((h=n==null?void 0:n.unread)==null?void 0:h.rows)||[],baseUrl:e,notiPath:t})}];return s.jsx(s.Fragment,{children:s.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:s.jsxs("div",{className:"list-content",children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsx("h3",{style:{fontSize:"24px",fontWeight:"500"},className:"list-title",children:"Notifications"}),s.jsx("button",{onClick:r,children:s.jsx("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:s.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"})})})]}),s.jsx(Qn,{tabs:a,setCurrentTab:i,currentTab:o})]})})})};function Xt({childrenClass:e,action:t,childrenOpenClass:r}){const n=document.querySelector("#topbar-wrapper"),o=n==null?void 0:n.shadowRoot,i=o==null?void 0:o.querySelector(`.${e}`),a=o==null?void 0:o.querySelector(`.${r}`),c=o==null?void 0:o.querySelector("nav"),d=f=>{c==null||c.addEventListener("click",function(h){if(r&&a&&a.contains(h.target)){if(i&&!i.contains(h.target))return}else i&&!i.contains(h.target)&&t()}),n&&!n.contains(f.target)&&t()};document.addEventListener("click",d,!0)}function oo({primaryColor:e="#009d4f",baseUrl:t,notiPath:r}){var h,m;const{isOpen:n,toggleOpen:o,setShowModalFalse:i}=C.useContext(g.CustomOpenList),{notidata:a,setNotiData:c}=C.useContext(g.CustomOpenList),d=Zt({baseUrl:t,notiPath:r,setNotiData:c}),f=async()=>{var p,x;try{await d()}catch(v){g.pushError(((x=(p=v.response)==null?void 0:p.data)==null?void 0:x.errorMessage)||"Have error when get notification list")}};return C.useEffect(()=>{f()},[n]),C.useEffect(()=>{Xt({childrenClass:"noti-container",childrenOpenClass:"noti-list-container",action(){i()}})}),s.jsxs("div",{children:[s.jsxs("div",{className:"noti-container",style:{position:"relative"},children:[s.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:[s.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"}),s.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"})]}),(a==null?void 0:a.unread)&&(a==null?void 0:a.unread.total)!=0&&s.jsx("span",{style:{position:"absolute",top:"-9px",right:"-6px",background:`${sn.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:((h=a==null?void 0:a.unread)==null?void 0:h.total)>9?"9+":`${(m=a==null?void 0:a.unread)==null?void 0:m.total}`})]}),s.jsx("div",{className:"noti-list-container",children:!n&&s.jsx(no,{baseUrl:t,notiPath:r})})]})}const io=`.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;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}
2
2
  `,ao=`.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}
3
3
  `,so=`: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}
4
4
  `,lo=`._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}
@@ -1,9 +1,9 @@
1
1
  import { jsxs as N, jsx as c, Fragment as st } from "react/jsx-runtime";
2
2
  import * as F from "react";
3
3
  import So, { useState as G, useContext as be, useEffect as Q, useRef as ve, useCallback as bt, forwardRef as Eo, createElement as er, PureComponent as Co } from "react";
4
- import { Q as kn, C as Ne, p as At, S as Oo, a as No, L as To, b as Ir, u as ko, i as Mo, c as mt, d as $o, s as pt, _ as z, e as xe, P as T, g as he, f as Io, o as Ao, h as Po, j as Ro, k as Ar, l as Pr, I as Do, m as zo, n as Rr, D as Lo, q as Mn, r as $n, t as Fo, v as jo, w as Ce, x as Vo, y as gt } from "../index.module-fcfb53fb.js";
5
- import { G as E1, z as C1, A as O1 } from "../index.module-fcfb53fb.js";
6
- import { c as In } from "../index-5bc96a1f.js";
4
+ import { Q as kn, C as Ne, p as At, S as Oo, a as No, L as To, b as Ir, u as ko, i as Mo, c as mt, d as $o, s as pt, _ as z, e as xe, P as T, g as he, f as Io, o as Ao, h as Po, j as Ro, k as Ar, l as Pr, I as Do, m as zo, n as Rr, D as Lo, q as Mn, r as $n, t as Fo, v as jo, w as Ce, x as Vo, y as gt } from "../index.module-d03675ea.js";
5
+ import { G as E1, z as C1, A as O1 } from "../index.module-d03675ea.js";
6
+ import { c as In } from "../index-2ca7cc99.js";
7
7
  import Z from "moment";
8
8
  import tt from "axios";
9
9
  import "@r2wc/react-to-web-component";