@ukpc-lib/react 0.2.39 → 0.2.40
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.
- package/dist/components/index.cjs +2 -2
- package/dist/components/index.js +3 -3
- package/dist/{index.module-dbbc618c.cjs → index.module-30dd8648.cjs} +77 -77
- package/dist/{index.module-b4e99b4d.js → index.module-b722c374.js} +4826 -4829
- package/dist/share/index.cjs +1 -1
- package/dist/share/index.js +2 -2
- package/package.json +1 -1
- package/web-components-bundle/global-topbar/index.cjs +1 -1
- package/web-components-bundle/global-topbar/index.js +1 -1
- package/web-components-bundle/has-permission/index.cjs +1 -1
- package/web-components-bundle/has-permission/index.js +1 -1
- package/web-components-bundle/{index-ecc040cf.cjs → index-25e1af9c.cjs} +1 -1
- package/web-components-bundle/{index-81cfe9d4.js → index-265fbeae.js} +1 -1
package/dist/share/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../index.module-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../index.module-30dd8648.cjs"),d=require("axios"),i=require("react/jsx-runtime"),h=require("react");require("moment");require("@r2wc/react-to-web-component");const R=require("react-router-dom");require("react-dom");require("@mui/material");function q({config:n,pushError:o=r.pushError}){const t=d.create(n);t.interceptors.request.use(async e=>(e.headers={Accept:"application/json","Content-Type":"application/json"},e),e=>Promise.reject(e)),t.interceptors.response.use(e=>e,async e=>s(e));async function s(e){var m,P,p,g;console.error("Error 🚨:",e);const a=e.config,u=(P=(m=e.response)==null?void 0:m.data)==null?void 0:P.errorMessage,l=u===r.ERROR_MESSAGE.TOKEN_EXPIRED;return((p=e.response)==null?void 0:p.status)===401?l&&!a._retry?(a._retry=!0,t.post("/authentication/api/v1/auth/refresh-token").then(()=>t(a)).catch(()=>r.login(n.baseURL))):((!u||!l)&&r.login(n.baseURL),Promise.reject("Unauthorized! Please login again.")):(((g=e.response)==null?void 0:g.status)===403?o(r.t("errorMessage.403")):o(r.t(`${u}`)||"Something went wrong!"),Promise.reject(e.response.data))}return t}const f=n=>{const[o,t]=h.useState([]);return h.useEffect(()=>{d.get(`${n}/user-management/api/v1/users/my-account/permissions`,{withCredentials:!0}).then(s=>t(s.data)).catch(s=>{console.error("Getting user permission error:",s)})},[n]),o},c=n=>(o,t)=>{const s=f(n);return t?o.every(e=>s==null?void 0:s.includes(e)):o.some(e=>s==null?void 0:s.includes(e))},j=({baseUrl:n,accessWith:o,requireAll:t,children:s})=>c(n)(o,t)?i.jsx(i.Fragment,{children:s}):null,v=({accessWith:n,requireAll:o,baseUrl:t,unAuthorizedPath:s,children:e})=>c(t)(n,o)?i.jsx(i.Fragment,{children:e}):i.jsx(R.Navigate,{to:s,replace:!0});exports.AuthProvider=r.AuthProvider;exports.TranslationProvider=r.TranslationProvider;exports.search=r.search;exports.translate=r.translate;exports.translationConfig=r.translationConfig;exports.useAuth=r.useAuth;exports.useCustomTranslation=r.useCustomTranslation;exports.useTranslation=r.useTranslation$1;exports.HasPermission=j;exports.PermissionRoute=v;exports.getAxiosInstance=q;exports.getUseHasPermission=c;exports.useGetPermission=f;
|
package/dist/share/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as l, G as f, p as E, H as R } from "../index.module-
|
|
2
|
-
import { J as k, T as F, q as K, N as L, M as b, K as z, u as D, O as J } from "../index.module-
|
|
1
|
+
import { F as l, G as f, p as E, H as R } from "../index.module-b722c374.js";
|
|
2
|
+
import { J as k, T as F, q as K, N as L, M as b, K as z, u as D, O as J } from "../index.module-b722c374.js";
|
|
3
3
|
import P from "axios";
|
|
4
4
|
import { jsx as i, Fragment as g } from "react/jsx-runtime";
|
|
5
5
|
import { useState as y, useEffect as v } from "react";
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../react-to-web-component-5d347552.cjs");require("../index-01dc8163.cjs");const e=require("../index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../react-to-web-component-5d347552.cjs");require("../index-01dc8163.cjs");const e=require("../index-25e1af9c.cjs");require("../index-5627e1e9.cjs");exports.TopBar=e.TopBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../react-to-web-component-5d347552.cjs");const e=require("../index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../react-to-web-component-5d347552.cjs");const e=require("../index-25e1af9c.cjs");require("../index-01dc8163.cjs");require("../index-5627e1e9.cjs");exports.HasPermission=e.HasPermission;exports.getUseHasPermission=e.getUseHasPermission;
|
|
@@ -1058,7 +1058,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
1058
1058
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1059
1059
|
* See the License for the specific language governing permissions and
|
|
1060
1060
|
* limitations under the License.
|
|
1061
|
-
*/function dy(e=HA()){return SO().then(t=>{if(!t)throw nn.create("unsupported-browser")},t=>{throw nn.create("indexed-db-unsupported")}),Hd(Wd(e),"messaging").getImmediate()}async function CO(e,t){return e=Wd(e),fy(e,t)}function DO(e,t){return e=Wd(e),kO(e,t)}wO();const hy=e=>{"serviceWorker"in navigator&&navigator.serviceWorker.register(e.path).then(function(t){console.log("Registration successful, scope is:",t.scope),console.log("initialize service worker props ",e);const r=dy(Ud({apiKey:e.apiKey,authDomain:e.authDomain,projectId:e.projectId,storageBucket:e.storageBucket,messagingSenderId:e.messagingSenderId,appId:e.appId,measurementId:e.measurementId}));CO(r,{serviceWorkerRegistration:t,vapidKey:e.vapidKey}).then(async s=>{var o,c;if(s){console.log("current token for client: ",s);try{const h="/notification-management/api/v1/notifications/registrations",x=e.baseUrl+h;await ce.axios.post(x,{deviceToken:s},{withCredentials:!0})}catch(h){console.log(h),ce.pushError(((c=(o=h.response)==null?void 0:o.data)==null?void 0:c.errorMessage)||"Have error when get notification list")}}else console.log("No registration token available. Request permission to generate one.")}).catch(s=>{console.log("An error occurred while retrieving token. ",s)})}).catch(function(t){console.log("Service worker registration failed, error:",t)})},EO=e=>{const t=new BroadcastChannel("my-channel");t.onmessage=r=>{console.log("Broadcast chanel message",r),r&&e(s=>({...s,unread:{...s.unread,total:s.unread.total+1}}))}},TO=e=>new Promise(t=>{const r=dy(Ud({apiKey:e.apiKey,authDomain:e.authDomain,projectId:e.projectId,storageBucket:e.storageBucket,messagingSenderId:e.messagingSenderId,appId:e.appId,measurementId:e.measurementId}));DO(r,s=>{console.log("payload",s),t(s)})}),os={"subscription-diaglog":"_subscription-diaglog_1gvmm_2","subscription-container":"_subscription-container_1gvmm_15","subscription-title":"_subscription-title_1gvmm_25","subscription-text":"_subscription-text_1gvmm_34","subscription-btn__container":"_subscription-btn__container_1gvmm_38","btn-success":"_btn-success_1gvmm_44","btn-cancel":"_btn-cancel_1gvmm_45"},MO=["granted","denied"],RO=e=>{const[t,r]=D.reactExports.useState(!1),s=()=>{Notification.requestPermission(function(c){c==="granted"&&hy(e),MO.includes(c)&&r(!0)})},o=()=>{r(!0)};return D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:t?"":D.jsxRuntimeExports.jsx("div",{className:os["subscription-diaglog"],children:D.jsxRuntimeExports.jsxs("div",{className:os["subscription-container"],children:[D.jsxRuntimeExports.jsx("h4",{className:os["subscription-title"],children:"Notification"}),D.jsxRuntimeExports.jsx("p",{className:os["subscription-text"],children:"Option to receive notifications about the latest information. You can turn them off at any time."}),D.jsxRuntimeExports.jsxs("div",{className:os["subscription-btn__container"],children:[D.jsxRuntimeExports.jsx("button",{className:os["btn-cancel"],onClick:o,children:"Not now"}),D.jsxRuntimeExports.jsx("button",{className:os["btn-success"],onClick:s,children:"Turn on"})]})]})})})},Au={"notification-massage_container":"_notification-massage_container_ql4az_1","notification-name":"_notification-name_ql4az_18","notification-message_service":"_notification-message_service_ql4az_23","notification-message_button-close":"_notification-message_button-close_ql4az_27"},AO=e=>{const[t,r]=D.reactExports.useState({userName:"",message:"",context:""});console.log(t);const{setNotiData:s}=D.reactExports.useContext(Xs);function o(){return D.jsxRuntimeExports.jsx("div",{className:Au["notification-massage_container"],children:D.jsxRuntimeExports.jsxs("div",{className:Au["notification-massage_content"],children:[D.jsxRuntimeExports.jsx("h6",{className:Au["notification-name"],children:t==null?void 0:t.userName}),D.jsxRuntimeExports.jsxs("div",{className:Au["notification-message_service"],children:[D.jsxRuntimeExports.jsxs("span",{children:[`${t==null?void 0:t.message} `," "]}),D.jsxRuntimeExports.jsx("span",{children:t==null?void 0:t.context})]})]})})}return D.reactExports.useEffect(()=>{t&&Notification.permission==="granted"&&t.userName&&t.message&&t.context&&ce.notify(D.jsxRuntimeExports.jsx(o,{}))},[t]),D.reactExports.useEffect(()=>{Notification.permission==="granted"&&hy(e)},[Notification.permission]),D.reactExports.useEffect(()=>{EO(s)},[]),TO(e).then(c=>{var h,x,S;console.log("aaa",c),r({userName:(h=c==null?void 0:c.data)==null?void 0:h.userName,message:(x=c==null?void 0:c.data)==null?void 0:x.message,context:(S=c==null?void 0:c.data)==null?void 0:S.context}),s(E=>{var A;return{...E,unread:{...E.unread,total:((A=E.unread)==null?void 0:A.total)+1}}})}).catch(c=>console.log("failed: ",c)),D.jsxRuntimeExports.jsx("div",{children:"Notification"in window&&Notification.permission==="default"?D.jsxRuntimeExports.jsx(RO,{...e}):""})},py=({baseUrl:e,notiPath:t,setNotiData:r})=>async()=>{const c=e+(t||"/notification-management/api/v1/notifications"),h=await ce.axios.get(c,{params:{filter:{notificationFilterType:"all"}},withCredentials:!0}),x=await ce.axios.get(c,{params:{filter:{notificationFilterType:"unread"}},withCredentials:!0});Promise.all([h,x]).then(S=>{var E,A,Y,F;console.log("result: "+S),r({all:{rows:(E=S[0].data)==null?void 0:E.rows,total:(A=S[0].data)==null?void 0:A.total},unread:{rows:(Y=S[1].data)==null?void 0:Y.rows,total:(F=S[1].data)==null?void 0:F.total}})})},IO=({baseUrl:e,notiPath:t})=>{var Y,F,V,q;const{setShowModalFalse:r}=D.reactExports.useContext(Xs),{notidata:s,setNotiData:o}=D.reactExports.useContext(Xs);console.log(s);const[c,h]=D.reactExports.useState("all"),x=py({baseUrl:e,notiPath:t,setNotiData:o}),S=async()=>{var $,te;try{const pe=e+(t||"/notification-management/api/v1/notifications");await ce.axios.put(pe,{withCredentials:!0})}catch(H){console.log(H),ce.pushError(((te=($=H.response)==null?void 0:$.data)==null?void 0:te.errorMessage)||"Have error when get notification list")}await x()},E=async($,te)=>{var H,pe;try{const me=t||`/notification-management/api/v1/notifications/${$}`,ye=e+me;await ce.axios.put(ye,{isRead:te},{withCredentials:!0})}catch(me){ce.pushError(((pe=(H=me.response)==null?void 0:H.data)==null?void 0:pe.errorMessage)||"Have error when get notification list")}await x()},A=[{id:"all",tabTitle:`All (${((Y=s==null?void 0:s.all)==null?void 0:Y.total)||0})`,children:D.jsxRuntimeExports.jsx(Zp,{notidata:((F=s==null?void 0:s.all)==null?void 0:F.rows)||[],handleUpdateRead:E,handleUpdateReadAll:S})},{id:"unread",tabTitle:`Unread (${((V=s==null?void 0:s.unread)==null?void 0:V.total)||0})`,children:D.jsxRuntimeExports.jsx(Zp,{notidata:((q=s==null?void 0:s.unread)==null?void 0:q.rows)||[],handleUpdateRead:E,handleUpdateReadAll:S})}];return D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:D.jsxRuntimeExports.jsx("div",{style:{position:"absolute",backgroundColor:"#fff",width:"550px",height:"90vh",right:"100px",top:"100%",padding:"32px",boxShadow:"10px 0px 20px #999",borderRadius:"0 0 8px 8px",overflow:"hidden"},children:D.jsxRuntimeExports.jsxs("div",{className:"list-content",children:[D.jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[D.jsxRuntimeExports.jsx("h3",{style:{fontSize:"24px",fontWeight:"500"},className:"list-title",children:"Notifications"}),D.jsxRuntimeExports.jsx("button",{onClick:r,children:D.jsxRuntimeExports.jsx("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:D.jsxRuntimeExports.jsx("path",{d:"M7.05086 6.13616C6.66033 5.74563 6.02717 5.74563 5.63664 6.13616C5.24612 6.52668 5.24612 7.15984 5.63664 7.55037L10.5864 12.5001L5.63664 17.4499C5.24612 17.8404 5.24612 18.4736 5.63664 18.8641C6.02717 19.2546 6.66033 19.2546 7.05086 18.8641L12.0006 13.9143L16.9504 18.8641C17.3409 19.2546 17.974 19.2546 18.3646 18.8641C18.7551 18.4736 18.7551 17.8404 18.3646 17.4499L13.4148 12.5001L18.3646 7.55037C18.7551 7.15984 18.7551 6.52668 18.3646 6.13616C17.974 5.74563 17.3409 5.74563 16.9504 6.13616L12.0006 11.0859L7.05086 6.13616Z",fill:"#85858A"})})})]}),D.jsxRuntimeExports.jsx(ww,{tabs:A,setCurrentTab:h,currentTab:c})]})})})};function eh({childrenClass:e,action:t,childrenOpenClass:r}){const s=document.querySelector("#topbar-wrapper"),o=s==null?void 0:s.shadowRoot,c=o==null?void 0:o.querySelector(`.${e}`),h=o==null?void 0:o.querySelector(`.${r}`),x=o==null?void 0:o.querySelector("nav"),S=E=>{x==null||x.addEventListener("click",function(A){if(r&&h&&h.contains(A.target)){if(c&&!c.contains(A.target))return}else c&&!c.contains(A.target)&&t()}),s&&!s.contains(E.target)&&t()};document.addEventListener("click",S,!0)}function OO({primaryColor:e="#009d4f",baseUrl:t,notiPath:r}){var A,Y;const{isOpen:s,toggleOpen:o,setShowModalFalse:c}=D.reactExports.useContext(Xs),{notidata:h,setNotiData:x}=D.reactExports.useContext(Xs),S=py({baseUrl:t,notiPath:r,setNotiData:x}),E=async()=>{var F,V;try{await S()}catch(q){ce.pushError(((V=(F=q.response)==null?void 0:F.data)==null?void 0:V.errorMessage)||"Have error when get notification list")}};return D.reactExports.useEffect(()=>{E()},[s]),D.reactExports.useEffect(()=>{eh({childrenClass:"noti-container",childrenOpenClass:"noti-list-container",action(){c()}})}),D.jsxRuntimeExports.jsxs("div",{children:[D.jsxRuntimeExports.jsxs("div",{className:"noti-container",style:{position:"relative"},children:[D.jsxRuntimeExports.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:o,style:{cursor:"pointer"},children:[D.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.7968 17.4705C16.5901 17.4705 18.8076 16.8556 19.0218 14.3874C19.0218 11.921 17.4757 12.0796 17.4757 9.05334C17.4757 6.68952 15.2352 4 11.7968 4C8.35833 4 6.1178 6.68952 6.1178 9.05334C6.1178 12.0796 4.57178 11.921 4.57178 14.3874C4.78679 16.8649 7.00428 17.4705 11.7968 17.4705Z",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),D.jsxRuntimeExports.jsx("path",{d:"M13.8274 20.0286C12.6679 21.3161 10.8591 21.3313 9.68848 20.0286",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(h==null?void 0:h.unread)&&(h==null?void 0:h.unread.total)!=0&&D.jsxRuntimeExports.jsx("span",{style:{position:"absolute",top:"-9px",right:"-6px",background:`${ce.color.dangerDark}`,width:"20px",height:"20px",border:"1px solid #fff",borderRadius:"50%",color:"#fff",fontSize:"12px",display:"flex",alignItems:"center",justifyContent:"center"},className:"notification-badge",children:((A=h==null?void 0:h.unread)==null?void 0:A.total)>9?"9+":`${(Y=h==null?void 0:h.unread)==null?void 0:Y.total}`})]}),D.jsxRuntimeExports.jsx("div",{className:"noti-list-container",children:!s&&D.jsxRuntimeExports.jsx(IO,{baseUrl:t,notiPath:r})})]})}const PO=`.avatar-dropdown-item{padding:.5rem;font-size:.875rem;line-height:1.25rem;cursor:pointer;border-radius:.25rem}.avartarDropdownMenu{background-color:#fff;padding:.5rem;width:13rem;--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);position:absolute;left:-10rem;top:3.2rem}.avartarDropdownMenu ul{list-style:none;padding-inline-start:0;margin-block-end:0}.navbar{position:fixed;display:flex;z-index:30;background:#292929;top:0;width:100%;padding-left:2.5rem;height:64px}.navbar-container{display:flex;flex-direction:row;align-items:center;width:100%;justify-content:space-between}.logo-container{padding:16px 0;height:100%}.right-side-container{display:flex;flex-direction:row;align-items:center;text-align:center;margin-right:2.5rem;gap:1rem}.userContainer{display:flex;align-items:center;gap:.5rem}.languageDropdown{height:100%;padding:0 8px;display:flex;flex-direction:row;gap:8px;border-radius:3px;align-items:center;justify-content:center;height:41px;background-color:#ffffff1a;cursor:pointer;transition:background-color .2s ease-in-out}.languageDropdown:hover{background-color:#fff3}.userFullName{color:#fff;font-weight:400;font-size:.875rem;line-height:1.25rem}.userAvatar{width:2.5rem;height:2.5rem;cursor:pointer;-o-object-fit:cover;object-fit:cover;border-radius:9999px;border:2px solid #FFFFFF}#userAvatarNull{width:2.5rem;height:2.5rem;background:#DDDDDD;border-radius:100%;color:#fff;font-size:20px;font-weight:400;display:flex;align-items:center;justify-content:center}.relative{position:relative}.cursor-pointer{cursor:pointer}
|
|
1061
|
+
*/function dy(e=HA()){return SO().then(t=>{if(!t)throw nn.create("unsupported-browser")},t=>{throw nn.create("indexed-db-unsupported")}),Hd(Wd(e),"messaging").getImmediate()}async function CO(e,t){return e=Wd(e),fy(e,t)}function DO(e,t){return e=Wd(e),kO(e,t)}wO();const hy=e=>{"serviceWorker"in navigator&&navigator.serviceWorker.register(e.path).then(function(t){console.log("Registration successful, scope is:",t.scope),console.log("initialize service worker props ",e);const r=dy(Ud({apiKey:e.apiKey,authDomain:e.authDomain,projectId:e.projectId,storageBucket:e.storageBucket,messagingSenderId:e.messagingSenderId,appId:e.appId,measurementId:e.measurementId}));CO(r,{serviceWorkerRegistration:t,vapidKey:e.vapidKey}).then(async s=>{var o,c;if(s){console.log("current token for client: ",s);try{const h="/notification-management/api/v1/notifications/registrations",x=e.baseUrl+h;await ce.axios.post(x,{deviceToken:s},{withCredentials:!0})}catch(h){console.log(h),ce.pushError(((c=(o=h.response)==null?void 0:o.data)==null?void 0:c.errorMessage)||"Have error when get notification list")}}else console.log("No registration token available. Request permission to generate one.")}).catch(s=>{console.log("An error occurred while retrieving token. ",s)})}).catch(function(t){console.log("Service worker registration failed, error:",t)})},EO=e=>{const t=new BroadcastChannel("my-channel");t.onmessage=r=>{console.log("Broadcast chanel message",r),r&&e(s=>({...s,unread:{...s.unread,total:s.unread.total+1}}))}},TO=e=>new Promise(t=>{const r=dy(Ud({apiKey:e.apiKey,authDomain:e.authDomain,projectId:e.projectId,storageBucket:e.storageBucket,messagingSenderId:e.messagingSenderId,appId:e.appId,measurementId:e.measurementId}));DO(r,s=>{console.log("payload",s),t(s)})}),os={"subscription-diaglog":"_subscription-diaglog_1gvmm_2","subscription-container":"_subscription-container_1gvmm_15","subscription-title":"_subscription-title_1gvmm_25","subscription-text":"_subscription-text_1gvmm_34","subscription-btn__container":"_subscription-btn__container_1gvmm_38","btn-success":"_btn-success_1gvmm_44","btn-cancel":"_btn-cancel_1gvmm_45"},MO=["granted","denied"],RO=e=>{const[t,r]=D.reactExports.useState(!1),s=()=>{Notification.requestPermission(function(c){c==="granted"&&hy(e),MO.includes(c)&&r(!0)})},o=()=>{r(!0)};return D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:t?"":D.jsxRuntimeExports.jsx("div",{className:os["subscription-diaglog"],children:D.jsxRuntimeExports.jsxs("div",{className:os["subscription-container"],children:[D.jsxRuntimeExports.jsx("h4",{className:os["subscription-title"],children:"Notification"}),D.jsxRuntimeExports.jsx("p",{className:os["subscription-text"],children:"Option to receive notifications about the latest information. You can turn them off at any time."}),D.jsxRuntimeExports.jsxs("div",{className:os["subscription-btn__container"],children:[D.jsxRuntimeExports.jsx("button",{className:os["btn-cancel"],onClick:o,children:"Not now"}),D.jsxRuntimeExports.jsx("button",{className:os["btn-success"],onClick:s,children:"Turn on"})]})]})})})},Au={"notification-massage_container":"_notification-massage_container_ql4az_1","notification-name":"_notification-name_ql4az_18","notification-message_service":"_notification-message_service_ql4az_23","notification-message_button-close":"_notification-message_button-close_ql4az_27"},AO=e=>{const[t,r]=D.reactExports.useState({userName:"",message:"",context:""});console.log(t);const{setNotiData:s}=D.reactExports.useContext(Xs);function o(){return D.jsxRuntimeExports.jsx("div",{className:Au["notification-massage_container"],children:D.jsxRuntimeExports.jsxs("div",{className:Au["notification-massage_content"],children:[D.jsxRuntimeExports.jsx("h6",{className:Au["notification-name"],children:t==null?void 0:t.userName}),D.jsxRuntimeExports.jsxs("div",{className:Au["notification-message_service"],children:[D.jsxRuntimeExports.jsxs("span",{children:[`${t==null?void 0:t.message} `," "]}),D.jsxRuntimeExports.jsx("span",{children:t==null?void 0:t.context})]})]})})}return D.reactExports.useEffect(()=>{t&&Notification.permission==="granted"&&(t.userName||t.message||t.context)&&ce.notify(D.jsxRuntimeExports.jsx(o,{}))},[t]),D.reactExports.useEffect(()=>{Notification.permission==="granted"&&hy(e)},[Notification.permission]),D.reactExports.useEffect(()=>{EO(s)},[]),TO(e).then(c=>{var h,x,S;console.log("aaa",c),r({userName:(h=c==null?void 0:c.data)==null?void 0:h.userName,message:(x=c==null?void 0:c.data)==null?void 0:x.message,context:(S=c==null?void 0:c.data)==null?void 0:S.context}),s(E=>{var A;return{...E,unread:{...E.unread,total:((A=E.unread)==null?void 0:A.total)+1}}})}).catch(c=>console.log("failed: ",c)),D.jsxRuntimeExports.jsx("div",{children:"Notification"in window&&Notification.permission==="default"?D.jsxRuntimeExports.jsx(RO,{...e}):""})},py=({baseUrl:e,notiPath:t,setNotiData:r})=>async()=>{const c=e+(t||"/notification-management/api/v1/notifications"),h=await ce.axios.get(c,{params:{filter:{notificationFilterType:"all"}},withCredentials:!0}),x=await ce.axios.get(c,{params:{filter:{notificationFilterType:"unread"}},withCredentials:!0});Promise.all([h,x]).then(S=>{var E,A,Y,F;console.log("result: "+S),r({all:{rows:(E=S[0].data)==null?void 0:E.rows,total:(A=S[0].data)==null?void 0:A.total},unread:{rows:(Y=S[1].data)==null?void 0:Y.rows,total:(F=S[1].data)==null?void 0:F.total}})})},IO=({baseUrl:e,notiPath:t})=>{var Y,F,V,q;const{setShowModalFalse:r}=D.reactExports.useContext(Xs),{notidata:s,setNotiData:o}=D.reactExports.useContext(Xs);console.log(s);const[c,h]=D.reactExports.useState("all"),x=py({baseUrl:e,notiPath:t,setNotiData:o}),S=async()=>{var $,te;try{const pe=e+(t||"/notification-management/api/v1/notifications");await ce.axios.put(pe,{withCredentials:!0})}catch(H){console.log(H),ce.pushError(((te=($=H.response)==null?void 0:$.data)==null?void 0:te.errorMessage)||"Have error when get notification list")}await x()},E=async($,te)=>{var H,pe;try{const me=t||`/notification-management/api/v1/notifications/${$}`,ye=e+me;await ce.axios.put(ye,{isRead:te},{withCredentials:!0})}catch(me){ce.pushError(((pe=(H=me.response)==null?void 0:H.data)==null?void 0:pe.errorMessage)||"Have error when get notification list")}await x()},A=[{id:"all",tabTitle:`All (${((Y=s==null?void 0:s.all)==null?void 0:Y.total)||0})`,children:D.jsxRuntimeExports.jsx(Zp,{notidata:((F=s==null?void 0:s.all)==null?void 0:F.rows)||[],handleUpdateRead:E,handleUpdateReadAll:S})},{id:"unread",tabTitle:`Unread (${((V=s==null?void 0:s.unread)==null?void 0:V.total)||0})`,children:D.jsxRuntimeExports.jsx(Zp,{notidata:((q=s==null?void 0:s.unread)==null?void 0:q.rows)||[],handleUpdateRead:E,handleUpdateReadAll:S})}];return D.jsxRuntimeExports.jsx(D.jsxRuntimeExports.Fragment,{children:D.jsxRuntimeExports.jsx("div",{style:{position:"absolute",backgroundColor:"#fff",width:"550px",height:"90vh",right:"100px",top:"100%",padding:"32px",boxShadow:"10px 0px 20px #999",borderRadius:"0 0 8px 8px",overflow:"hidden"},children:D.jsxRuntimeExports.jsxs("div",{className:"list-content",children:[D.jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[D.jsxRuntimeExports.jsx("h3",{style:{fontSize:"24px",fontWeight:"500"},className:"list-title",children:"Notifications"}),D.jsxRuntimeExports.jsx("button",{onClick:r,children:D.jsxRuntimeExports.jsx("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:D.jsxRuntimeExports.jsx("path",{d:"M7.05086 6.13616C6.66033 5.74563 6.02717 5.74563 5.63664 6.13616C5.24612 6.52668 5.24612 7.15984 5.63664 7.55037L10.5864 12.5001L5.63664 17.4499C5.24612 17.8404 5.24612 18.4736 5.63664 18.8641C6.02717 19.2546 6.66033 19.2546 7.05086 18.8641L12.0006 13.9143L16.9504 18.8641C17.3409 19.2546 17.974 19.2546 18.3646 18.8641C18.7551 18.4736 18.7551 17.8404 18.3646 17.4499L13.4148 12.5001L18.3646 7.55037C18.7551 7.15984 18.7551 6.52668 18.3646 6.13616C17.974 5.74563 17.3409 5.74563 16.9504 6.13616L12.0006 11.0859L7.05086 6.13616Z",fill:"#85858A"})})})]}),D.jsxRuntimeExports.jsx(ww,{tabs:A,setCurrentTab:h,currentTab:c})]})})})};function eh({childrenClass:e,action:t,childrenOpenClass:r}){const s=document.querySelector("#topbar-wrapper"),o=s==null?void 0:s.shadowRoot,c=o==null?void 0:o.querySelector(`.${e}`),h=o==null?void 0:o.querySelector(`.${r}`),x=o==null?void 0:o.querySelector("nav"),S=E=>{x==null||x.addEventListener("click",function(A){if(r&&h&&h.contains(A.target)){if(c&&!c.contains(A.target))return}else c&&!c.contains(A.target)&&t()}),s&&!s.contains(E.target)&&t()};document.addEventListener("click",S,!0)}function OO({primaryColor:e="#009d4f",baseUrl:t,notiPath:r}){var A,Y;const{isOpen:s,toggleOpen:o,setShowModalFalse:c}=D.reactExports.useContext(Xs),{notidata:h,setNotiData:x}=D.reactExports.useContext(Xs),S=py({baseUrl:t,notiPath:r,setNotiData:x}),E=async()=>{var F,V;try{await S()}catch(q){ce.pushError(((V=(F=q.response)==null?void 0:F.data)==null?void 0:V.errorMessage)||"Have error when get notification list")}};return D.reactExports.useEffect(()=>{E()},[s]),D.reactExports.useEffect(()=>{eh({childrenClass:"noti-container",childrenOpenClass:"noti-list-container",action(){c()}})}),D.jsxRuntimeExports.jsxs("div",{children:[D.jsxRuntimeExports.jsxs("div",{className:"noti-container",style:{position:"relative"},children:[D.jsxRuntimeExports.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:o,style:{cursor:"pointer"},children:[D.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.7968 17.4705C16.5901 17.4705 18.8076 16.8556 19.0218 14.3874C19.0218 11.921 17.4757 12.0796 17.4757 9.05334C17.4757 6.68952 15.2352 4 11.7968 4C8.35833 4 6.1178 6.68952 6.1178 9.05334C6.1178 12.0796 4.57178 11.921 4.57178 14.3874C4.78679 16.8649 7.00428 17.4705 11.7968 17.4705Z",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),D.jsxRuntimeExports.jsx("path",{d:"M13.8274 20.0286C12.6679 21.3161 10.8591 21.3313 9.68848 20.0286",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(h==null?void 0:h.unread)&&(h==null?void 0:h.unread.total)!=0&&D.jsxRuntimeExports.jsx("span",{style:{position:"absolute",top:"-9px",right:"-6px",background:`${ce.color.dangerDark}`,width:"20px",height:"20px",border:"1px solid #fff",borderRadius:"50%",color:"#fff",fontSize:"12px",display:"flex",alignItems:"center",justifyContent:"center"},className:"notification-badge",children:((A=h==null?void 0:h.unread)==null?void 0:A.total)>9?"9+":`${(Y=h==null?void 0:h.unread)==null?void 0:Y.total}`})]}),D.jsxRuntimeExports.jsx("div",{className:"noti-list-container",children:!s&&D.jsxRuntimeExports.jsx(IO,{baseUrl:t,notiPath:r})})]})}const PO=`.avatar-dropdown-item{padding:.5rem;font-size:.875rem;line-height:1.25rem;cursor:pointer;border-radius:.25rem}.avartarDropdownMenu{background-color:#fff;padding:.5rem;width:13rem;--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);position:absolute;left:-10rem;top:3.2rem}.avartarDropdownMenu ul{list-style:none;padding-inline-start:0;margin-block-end:0}.navbar{position:fixed;display:flex;z-index:30;background:#292929;top:0;width:100%;padding-left:2.5rem;height:64px}.navbar-container{display:flex;flex-direction:row;align-items:center;width:100%;justify-content:space-between}.logo-container{padding:16px 0;height:100%}.right-side-container{display:flex;flex-direction:row;align-items:center;text-align:center;margin-right:2.5rem;gap:1rem}.userContainer{display:flex;align-items:center;gap:.5rem}.languageDropdown{height:100%;padding:0 8px;display:flex;flex-direction:row;gap:8px;border-radius:3px;align-items:center;justify-content:center;height:41px;background-color:#ffffff1a;cursor:pointer;transition:background-color .2s ease-in-out}.languageDropdown:hover{background-color:#fff3}.userFullName{color:#fff;font-weight:400;font-size:.875rem;line-height:1.25rem}.userAvatar{width:2.5rem;height:2.5rem;cursor:pointer;-o-object-fit:cover;object-fit:cover;border-radius:9999px;border:2px solid #FFFFFF}#userAvatarNull{width:2.5rem;height:2.5rem;background:#DDDDDD;border-radius:100%;color:#fff;font-size:20px;font-weight:400;display:flex;align-items:center;justify-content:center}.relative{position:relative}.cursor-pointer{cursor:pointer}
|
|
1062
1062
|
`,NO=`.tab-title{min-width:90px;padding:5px 16px;font-size:14px;font-weight:500;color:#c5c5c5;transition:all .3s ease-in-out;position:relative}.tab-title.is-active{color:#2e7d32}.tab-title.is-active:before{transition:all .3s ease-in-out;position:absolute;content:"";width:100%;height:100%;top:0;left:0;border-bottom:2px solid #2E7D32}.tab-content{padding:16px 0}
|
|
1063
1063
|
`,LO=`:root{--textPrimary: #292929;--textWhite: #fff;--primary500: #2E7D32;--grey100: #FAFAFA;--gray200: #EEEEEE;--gray600: #85858A;--link: #007BFF }.list-content{overflow-y:auto;overflow-x:hidden}.mark-all-read{text-align:right;color:#007bff;margin-bottom:12px;font-size:12px}.notification-items__wrapper{overflow:hidden}.notification-items__content{height:calc(100vh - 275px);overflow-x:hidden;overflow-y:auto;color:#292929}.notitification-item__container{display:flex;align-items:center;justify-content:space-between;padding:16px;border-bottom:#FAFAFA 1px solid;text-align:left;font-size:12px;position:relative;z-index:10;cursor:pointer;border-radius:4px;margin-bottom:8px}.notitification-item__container:hover{background-color:#fafafa}.notification-item__image-container{width:40px;height:40px;display:flex;justify-content:center;align-items:center;border-radius:50%;overflow:hidden;margin-right:16px}.notification-item__image-container img{width:100%;height:100%;text-align:center;-o-object-fit:cover;object-fit:cover;color:transparent;text-indent:10000px}.notification-item__context-link{color:#007bff}.notification-item__content{width:60%;padding-right:16px}.notification-item__user-name{margin-bottom:2px;font-size:14px}.notification-item__time{margin-right:15px;text-align:right}.notification-item__read-at{border-width:2px;border-style:solid;border-radius:50%;width:10px;height:10px;display:block;position:relative}.notification-item__read-at:before{position:absolute;top:-30px;right:0;width:91px;background-color:#85858a;color:#fff;border-radius:4px;font-size:10px;text-align:center;padding:4px;opacity:0;visibility:hidden;transition:all .3s cubic-bezier(.39,.575,.565,1)}.notification-item__read-at:hover:before{opacity:1;visibility:visible}.notification-item__read-at.read:before{content:"Mark as unread"}.notification-item__read-at.unread:before{content:"Mark as read"}.notification-item__read-at.read{border-color:#eee}.notification-item__read-at.unread{border-color:#2e7d32;background-color:#2e7d32}
|
|
1064
1064
|
`,jO=`._notification-massage_container_ql4az_1{background:#fff;padding:0 64px 0 84px;border-radius:8px;font-family:TT Firs Neue Trl,sans-serif}._notification-massage_container_ql4az_1:before{position:absolute;content:"";width:48px;height:48px;background:url(https://ukpcsaprod.blob.core.windows.net/saas/notification-icon.svg) no-repeat center/100%;top:12px;left:24px}._notification-name_ql4az_18{font-weight:500;font-size:14px}._notification-message_service_ql4az_23{font-size:12px}._notification-message_button-close_ql4az_27{position:absolute;top:12px;right:24px;width:24px;height:24px}
|
|
@@ -18059,7 +18059,7 @@ const wy = (e) => {
|
|
|
18059
18059
|
] }) });
|
|
18060
18060
|
}
|
|
18061
18061
|
return te.useEffect(() => {
|
|
18062
|
-
t && Notification.permission === "granted" && t.userName
|
|
18062
|
+
t && Notification.permission === "granted" && (t.userName || t.message || t.context) && Ox(/* @__PURE__ */ q.jsx(o, {}));
|
|
18063
18063
|
}, [t]), te.useEffect(() => {
|
|
18064
18064
|
Notification.permission === "granted" && wy(e);
|
|
18065
18065
|
}, [Notification.permission]), te.useEffect(() => {
|