@ukpc-lib/react 0.13.1-dev.15 → 0.13.1-dev.16

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.
@@ -29,7 +29,7 @@
29
29
  .tab-content {
30
30
  padding: 16px 0;
31
31
  }
32
- `}),c.jsxs("div",{className:"tab-container",children:[c.jsx("div",{style:{display:"flex",width:"100%",height:"50px",borderBottom:`1px solid ${p.color.grey200}`},className:"tab-container__title",children:t.map((s,i)=>c.jsx("button",{id:s.id,disabled:e.currentTab===`${s.id}`,onClick:n,className:`tab-title ${e.currentTab===`${s.id}`?"is-active":""}`,children:s.tabTitle},i))}),c.jsx("div",{className:"tab-content",children:t.map((s,i)=>c.jsx("div",{children:e.currentTab===`${s.id}`&&c.jsx("div",{children:s.children})},i))})]})]})},yn=({baseUrl:e,notiPath:t,setNotiData:n})=>async(o=1,s=20,i="all")=>{const u=e+(t||"/notification-management/api/v1/notifications"),f=(await p.axiosInstance.get(u,{params:{page:o,pageSize:s,filter:{notificationFilterType:i}}})).data;return n(i==="all"?h=>({...h,all:{total:(f==null?void 0:f.total)??0}}):h=>({...h,unread:{total:(f==null?void 0:f.total)??0}})),f},zo=({notification:e,baseUrl:t,notiPath:n,markAllAsReadState:r,brandColors:o})=>{var T,S;const[s,i]=C.useState(!1),[l,u]=C.useState({id:e.id,isRead:e.isRead}),d=l.isRead===!1?"unread":"read",f={borderColor:l.isRead?"#c5c5c5":(o==null?void 0:o.primary500)||p.color.primary500,backgroundColor:l.isRead?"#c5c5c5":(o==null?void 0:o.primary500)||p.color.primary500},{setNotiData:h}=C.useContext(p.CustomOpenList),m=yn({baseUrl:t,notiPath:n,setNotiData:h}),b=async(x,w)=>{try{const k=n||`/notification-management/api/v1/notifications/${x}`,O=t+k;await p.axiosInstance.put(O,{isRead:w})}catch(k){console.log(k),u({id:e.id,isRead:e.isRead})}await m()},g=(x,w)=>{console.log("specificNotificationID",x);const k=!w;u(O=>({...O,isRead:k})),console.log("newIsReadState",k),b(x,k)};C.useEffect(()=>{u(r?x=>({...x,isRead:!0}):{id:e.id,isRead:e.isRead})},[r,e.id,e.isRead]);const a=()=>{i(!s)},y=x=>{const w=X(),k=X(x),O=w.diff(k,"days"),P=w.diff(k,"minutes"),I=w.diff(k,"months"),j=w.diff(k,"years");if(console.log("diffInMonths",I),P<1)return"Just now";if(O===0){if(P<=60)return`${P} minute${P>1?"s":""} ago`;const N=Math.floor(P/60);return console.log("diffIhours",N),`${N} hour${N>1?"s":""} ago`}if(O===1)return"Yesterday";if(O>=2&&O<7)return`${O} days ago`;if(O<30){const N=Math.floor(O/7);return`${N} week${N>1?"s":""} ago`}return I===0||I===1?"1 month ago":I<12?`${I} months ago`:j===0||j===1?"1 year ago":"Over 1 year ago"},v=e!=null&&e.data?(T=e==null?void 0:e.data)==null?void 0:T.length:0,_=(x,w)=>{var k,O;if((x==null?void 0:x.actionKey)!=null){if((k=x==null?void 0:x.data)!=null&&k.brandName)return p.translate(`notificationAdmin.notify.actionKey.${x==null?void 0:x.actionKey}`,{defaultValue:`${x==null?void 0:x.message}`,brandName:x.data.brandName});switch(x==null?void 0:x.notificationType){case"deleteMultiple":return x!=null&&x.data&&((O=x==null?void 0:x.data)==null?void 0:O.length)>1?p.translate(`notificationAdmin.notify.actionKey.${x==null?void 0:x.actionKey}_multiple`,{defaultValue:`${x==null?void 0:x.actionKey}`,count:w}):p.translate(`notificationAdmin.notify.actionKey.${x==null?void 0:x.actionKey}_single`,{defaultValue:`${x==null?void 0:x.actionKey}`});default:return p.translate(`notificationAdmin.notify.actionKey.${x==null?void 0:x.actionKey}`,{defaultValue:`${x==null?void 0:x.message}`})}}return x.message},E=e!=null&&e.contextUrl?"a":"p";return c.jsx(c.Fragment,{children:c.jsxs("div",{className:"notitification-item__container",children:[c.jsx("div",{className:"notification-item__image-container",children:c.jsx("img",{src:!e.actorAvatarUrl||e.actorName==="System"?"https://ukpcsaprod.blob.core.windows.net/account/logo.png":e.actorAvatarUrl,onError:({currentTarget:x})=>{console.log("img on error",x),x.onerror=null,x.src="https://ukpcsaprod.blob.core.windows.net/account/logo.png"},alt:e.actorName})}),c.jsxs("div",{style:{width:"100%"},children:[c.jsxs("div",{className:"notification-item__content-wrapper",children:[c.jsxs("div",{className:"notification-item__content",children:[c.jsx("p",{className:"notification-item__user-name",children:e.actorName}),c.jsxs(E,{href:e.contextUrl,style:{cursor:e!=null&&e.contextUrl?"pointer":"unset"},children:[_(e,v),c.jsx("span",{style:{color:e.contextUrl?"#007BFF":"#292929"},children:` ${e!=null&&e.context?e.context:""}`})]}),(e==null?void 0:e.notificationType)==="deleteMultiple"&&c.jsxs("button",{style:{color:p.color.primary400,textDecoration:"underline"},onClick:a,children:[s?"Hide":"Show "," details"]})]}),c.jsx("div",{className:"notification-item__time",children:c.jsx("p",{children:y(e.createdAt)})}),c.jsx("button",{className:`${d} notification-item__read-at`,"aria-label":"Mark as read",style:f,onClick:()=>g(e.id,e.isRead)})]}),s&&c.jsx("div",{style:{background:"#fff",width:"100%",padding:"8px",fontSize:"12px",marginTop:"8px"},children:c.jsx("ul",{children:(S=e==null?void 0:e.data)==null?void 0:S.map((x,w)=>c.jsxs("li",{style:{display:"flex",alignItems:"center",marginBottom:"4px"},children:[c.jsx("span",{style:{backgroundColor:p.color.primary400},className:"list-dot"}),c.jsx("span",{style:{width:"calc(100% - 12px)"},children:x.name})]},w))})})]})]})})};var $n=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Fo(e,t){return!!(e===t||$n(e)&&$n(t))}function Lo(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!Fo(e[n],t[n]))return!1;return!0}function Vt(e,t){t===void 0&&(t=Lo);var n,r=[],o,s=!1;function i(){for(var l=[],u=0;u<arguments.length;u++)l[u]=arguments[u];return s&&n===this&&t(l,r)||(o=e.apply(this,l),s=!0,n=this,r=l),o}return i}var Do=typeof performance=="object"&&typeof performance.now=="function",Rn=Do?function(){return performance.now()}:function(){return Date.now()};function zn(e){cancelAnimationFrame(e.id)}function Bo(e,t){var n=Rn();function r(){Rn()-n>=t?e.call(null):o.id=requestAnimationFrame(r)}var o={id:requestAnimationFrame(r)};return o}var Wt=-1;function Fn(e){if(e===void 0&&(e=!1),Wt===-1||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(t),Wt=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Wt}var Ae=null;function Ln(e){if(e===void 0&&(e=!1),Ae===null||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var r=document.createElement("div"),o=r.style;return o.width="100px",o.height="100px",t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?Ae="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?Ae="negative":Ae="positive-ascending"),document.body.removeChild(t),Ae}return Ae}process.env.NODE_ENV;var Ho=150,Vo=function(t,n){return t},ht=null,mt=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(ht=new WeakSet,mt=new WeakSet);function Ir(e){var t,n=e.getItemOffset,r=e.getEstimatedTotalSize,o=e.getItemSize,s=e.getOffsetForIndexAndAlignment,i=e.getStartIndexForOffset,l=e.getStopIndexForStartIndex,u=e.initInstanceProps,d=e.shouldResetStyleCacheOnItemSizeChange,f=e.validateProps;return t=function(h){p._inheritsLoose(m,h);function m(g){var a;return a=h.call(this,g)||this,a._instanceProps=u(a.props,p._assertThisInitialized(a)),a._outerRef=void 0,a._resetIsScrollingTimeoutId=null,a.state={instance:p._assertThisInitialized(a),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof a.props.initialScrollOffset=="number"?a.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},a._callOnItemsRendered=void 0,a._callOnItemsRendered=Vt(function(y,v,_,E){return a.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:_,visibleStopIndex:E})}),a._callOnScroll=void 0,a._callOnScroll=Vt(function(y,v,_){return a.props.onScroll({scrollDirection:y,scrollOffset:v,scrollUpdateWasRequested:_})}),a._getItemStyle=void 0,a._getItemStyle=function(y){var v=a.props,_=v.direction,E=v.itemSize,T=v.layout,S=a._getItemStyleCache(d&&E,d&&T,d&&_),x;if(S.hasOwnProperty(y))x=S[y];else{var w=n(a.props,y,a._instanceProps),k=o(a.props,y,a._instanceProps),O=_==="horizontal"||T==="horizontal",P=_==="rtl",I=O?w:0;S[y]=x={position:"absolute",left:P?void 0:I,right:P?I:void 0,top:O?0:w,height:O?"100%":k,width:O?k:"100%"}}return x},a._getItemStyleCache=void 0,a._getItemStyleCache=Vt(function(y,v,_){return{}}),a._onScrollHorizontal=function(y){var v=y.currentTarget,_=v.clientWidth,E=v.scrollLeft,T=v.scrollWidth;a.setState(function(S){if(S.scrollOffset===E)return null;var x=a.props.direction,w=E;if(x==="rtl")switch(Ln()){case"negative":w=-E;break;case"positive-descending":w=T-_-E;break}return w=Math.max(0,Math.min(w,T-_)),{isScrolling:!0,scrollDirection:S.scrollOffset<w?"forward":"backward",scrollOffset:w,scrollUpdateWasRequested:!1}},a._resetIsScrollingDebounced)},a._onScrollVertical=function(y){var v=y.currentTarget,_=v.clientHeight,E=v.scrollHeight,T=v.scrollTop;a.setState(function(S){if(S.scrollOffset===T)return null;var x=Math.max(0,Math.min(T,E-_));return{isScrolling:!0,scrollDirection:S.scrollOffset<x?"forward":"backward",scrollOffset:x,scrollUpdateWasRequested:!1}},a._resetIsScrollingDebounced)},a._outerRefSetter=function(y){var v=a.props.outerRef;a._outerRef=y,typeof v=="function"?v(y):v!=null&&typeof v=="object"&&v.hasOwnProperty("current")&&(v.current=y)},a._resetIsScrollingDebounced=function(){a._resetIsScrollingTimeoutId!==null&&zn(a._resetIsScrollingTimeoutId),a._resetIsScrollingTimeoutId=Bo(a._resetIsScrolling,Ho)},a._resetIsScrolling=function(){a._resetIsScrollingTimeoutId=null,a.setState({isScrolling:!1},function(){a._getItemStyleCache(-1,null)})},a}m.getDerivedStateFromProps=function(a,y){return Wo(a,y),f(a),null};var b=m.prototype;return b.scrollTo=function(a){a=Math.max(0,a),this.setState(function(y){return y.scrollOffset===a?null:{scrollDirection:y.scrollOffset<a?"forward":"backward",scrollOffset:a,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},b.scrollToItem=function(a,y){y===void 0&&(y="auto");var v=this.props,_=v.itemCount,E=v.layout,T=this.state.scrollOffset;a=Math.max(0,Math.min(a,_-1));var S=0;if(this._outerRef){var x=this._outerRef;E==="vertical"?S=x.scrollWidth>x.clientWidth?Fn():0:S=x.scrollHeight>x.clientHeight?Fn():0}this.scrollTo(s(this.props,a,y,T,this._instanceProps,S))},b.componentDidMount=function(){var a=this.props,y=a.direction,v=a.initialScrollOffset,_=a.layout;if(typeof v=="number"&&this._outerRef!=null){var E=this._outerRef;y==="horizontal"||_==="horizontal"?E.scrollLeft=v:E.scrollTop=v}this._callPropsCallbacks()},b.componentDidUpdate=function(){var a=this.props,y=a.direction,v=a.layout,_=this.state,E=_.scrollOffset,T=_.scrollUpdateWasRequested;if(T&&this._outerRef!=null){var S=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch(Ln()){case"negative":S.scrollLeft=-E;break;case"positive-ascending":S.scrollLeft=E;break;default:var x=S.clientWidth,w=S.scrollWidth;S.scrollLeft=w-x-E;break}else S.scrollLeft=E;else S.scrollTop=E}this._callPropsCallbacks()},b.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&zn(this._resetIsScrollingTimeoutId)},b.render=function(){var a=this.props,y=a.children,v=a.className,_=a.direction,E=a.height,T=a.innerRef,S=a.innerElementType,x=a.innerTagName,w=a.itemCount,k=a.itemData,O=a.itemKey,P=O===void 0?Vo:O,I=a.layout,j=a.outerElementType,N=a.outerTagName,z=a.style,Q=a.useIsScrolling,le=a.width,Ce=this.state.isScrolling,ge=_==="horizontal"||I==="horizontal",Ge=ge?this._onScrollHorizontal:this._onScrollVertical,ve=this._getRangeToRender(),ke=ve[0],Me=ve[1],je=[];if(w>0)for(var ue=ke;ue<=Me;ue++)je.push(C.createElement(y,{data:k,key:P(ue,k),index:ue,isScrolling:Q?Ce:void 0,style:this._getItemStyle(ue)}));var Oe=r(this.props,this._instanceProps);return C.createElement(j||N||"div",{className:v,onScroll:Ge,ref:this._outerRefSetter,style:p._extends({position:"relative",height:E,width:le,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:_},z)},C.createElement(S||x||"div",{children:je,ref:T,style:{height:ge?"100%":Oe,pointerEvents:Ce?"none":void 0,width:ge?Oe:"100%"}}))},b._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var a=this.props.itemCount;if(a>0){var y=this._getRangeToRender(),v=y[0],_=y[1],E=y[2],T=y[3];this._callOnItemsRendered(v,_,E,T)}}if(typeof this.props.onScroll=="function"){var S=this.state,x=S.scrollDirection,w=S.scrollOffset,k=S.scrollUpdateWasRequested;this._callOnScroll(x,w,k)}},b._getRangeToRender=function(){var a=this.props,y=a.itemCount,v=a.overscanCount,_=this.state,E=_.isScrolling,T=_.scrollDirection,S=_.scrollOffset;if(y===0)return[0,0,0,0];var x=i(this.props,S,this._instanceProps),w=l(this.props,x,S,this._instanceProps),k=!E||T==="backward"?Math.max(1,v):1,O=!E||T==="forward"?Math.max(1,v):1;return[Math.max(0,x-k),Math.max(0,Math.min(y-1,w+O)),x,w]},m}(C.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var Wo=function(t,n){var r=t.children,o=t.direction,s=t.height,i=t.layout,l=t.innerTagName,u=t.outerTagName,d=t.width,f=n.instance;if(process.env.NODE_ENV!=="production"){(l!=null||u!=null)&&mt&&!mt.has(f)&&(mt.add(f),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var h=o==="horizontal"||i==="horizontal";switch(o){case"horizontal":case"vertical":ht&&!ht.has(f)&&(ht.add(f),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+o+'" was specified.'))}switch(i){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+i+'" was specified.'))}if(r==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(r===null?"null":typeof r)+'" was specified.'));if(h&&typeof d!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(d===null?"null":typeof d)+'" was specified.'));if(!h&&typeof s!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(s===null?"null":typeof s)+'" was specified.'))}},Uo=50,De=function(t,n,r){var o=t,s=o.itemSize,i=r.itemMetadataMap,l=r.lastMeasuredIndex;if(n>l){var u=0;if(l>=0){var d=i[l];u=d.offset+d.size}for(var f=l+1;f<=n;f++){var h=s(f);i[f]={offset:u,size:h},u+=h}r.lastMeasuredIndex=n}return i[n]},Ko=function(t,n,r){var o=n.itemMetadataMap,s=n.lastMeasuredIndex,i=s>0?o[s].offset:0;return i>=r?kr(t,n,s,0,r):Yo(t,n,Math.max(0,s),r)},kr=function(t,n,r,o,s){for(;o<=r;){var i=o+Math.floor((r-o)/2),l=De(t,i,n).offset;if(l===s)return i;l<s?o=i+1:l>s&&(r=i-1)}return o>0?o-1:0},Yo=function(t,n,r,o){for(var s=t.itemCount,i=1;r<s&&De(t,r,n).offset<o;)r+=i,i*=2;return kr(t,n,Math.min(r,s-1),Math.floor(r/2),o)},Dn=function(t,n){var r=t.itemCount,o=n.itemMetadataMap,s=n.estimatedItemSize,i=n.lastMeasuredIndex,l=0;if(i>=r&&(i=r-1),i>=0){var u=o[i];l=u.offset+u.size}var d=r-i-1,f=d*s;return l+f},Go=Ir({getItemOffset:function(t,n,r){return De(t,n,r).offset},getItemSize:function(t,n,r){return r.itemMetadataMap[n].size},getEstimatedTotalSize:Dn,getOffsetForIndexAndAlignment:function(t,n,r,o,s,i){var l=t.direction,u=t.height,d=t.layout,f=t.width,h=l==="horizontal"||d==="horizontal",m=h?f:u,b=De(t,n,s),g=Dn(t,s),a=Math.max(0,Math.min(g-m,b.offset)),y=Math.max(0,b.offset-m+b.size+i);switch(r==="smart"&&(o>=y-m&&o<=a+m?r="auto":r="center"),r){case"start":return a;case"end":return y;case"center":return Math.round(y+(a-y)/2);case"auto":default:return o>=y&&o<=a?o:o<y?y:a}},getStartIndexForOffset:function(t,n,r){return Ko(t,r,n)},getStopIndexForStartIndex:function(t,n,r,o){for(var s=t.direction,i=t.height,l=t.itemCount,u=t.layout,d=t.width,f=s==="horizontal"||u==="horizontal",h=f?d:i,m=De(t,n,o),b=r+h,g=m.offset+m.size,a=n;a<l-1&&g<b;)a++,g+=De(t,a,o).size;return a},initInstanceProps:function(t,n){var r=t,o=r.estimatedItemSize,s={itemMetadataMap:{},estimatedItemSize:o||Uo,lastMeasuredIndex:-1};return n.resetAfterIndex=function(i,l){l===void 0&&(l=!0),s.lastMeasuredIndex=Math.min(s.lastMeasuredIndex,i-1),n._getItemStyleCache(-1),l&&n.forceUpdate()},s},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(t){var n=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof n!="function")throw Error('An invalid "itemSize" prop has been specified. Value should be a function. '+('"'+(n===null?"null":typeof n)+'" was specified.'))}}),qo=Ir({getItemOffset:function(t,n){var r=t.itemSize;return n*r},getItemSize:function(t,n){var r=t.itemSize;return r},getEstimatedTotalSize:function(t){var n=t.itemCount,r=t.itemSize;return r*n},getOffsetForIndexAndAlignment:function(t,n,r,o,s,i){var l=t.direction,u=t.height,d=t.itemCount,f=t.itemSize,h=t.layout,m=t.width,b=l==="horizontal"||h==="horizontal",g=b?m:u,a=Math.max(0,d*f-g),y=Math.min(a,n*f),v=Math.max(0,n*f-g+f+i);switch(r==="smart"&&(o>=v-g&&o<=y+g?r="auto":r="center"),r){case"start":return y;case"end":return v;case"center":{var _=Math.round(v+(y-v)/2);return _<Math.ceil(g/2)?0:_>a+Math.floor(g/2)?a:_}case"auto":default:return o>=v&&o<=y?o:o<v?v:y}},getStartIndexForOffset:function(t,n){var r=t.itemCount,o=t.itemSize;return Math.max(0,Math.min(r-1,Math.floor(n/o)))},getStopIndexForStartIndex:function(t,n,r){var o=t.direction,s=t.height,i=t.itemCount,l=t.itemSize,u=t.layout,d=t.width,f=o==="horizontal"||u==="horizontal",h=n*l,m=f?d:s,b=Math.ceil((m+r-h)/l);return Math.max(0,Math.min(i-1,n+b-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var n=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof n!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(n===null?"null":typeof n)+'" was specified.'))}});const Ut=20,Bn=({baseUrl:e,notiPath:t,brandColors:n,notiUnreadNumber:r,tabType:o,popupRef:s})=>{const[i,l]=C.useState(!1),[u,d]=C.useState(0);C.useEffect(()=>{const j=()=>{s&&s.current&&d(s.current.offsetHeight*.8)};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[]);const[f,h]=C.useState([]),[m,b]=C.useState(!0),[g,a]=C.useState(!1),[y,v]=C.useState(1),{setNotiData:_}=C.useContext(p.CustomOpenList),E=yn({baseUrl:e,notiPath:t,setNotiData:_}),T=C.useRef(null),S=C.useCallback(async()=>{if(!(g||!m)){a(!0);try{const j=f.length===0?1:y+1,N=await E(j,Ut,o),z=(N==null?void 0:N.rows)||[];T.current=(N==null?void 0:N.count)||(N==null?void 0:N.total)||null,h(Q=>[...Q,...z]),v(j),(z.length<Ut||T.current&&f.length+z.length>=T.current)&&b(!1)}catch{b(!1)}finally{a(!1)}}},[g,m,y,E,f.length,o]),x=m?f.length+1:f.length,w=j=>!m||j<f.length,k=async()=>{try{const z=e+(t||"/notification-management/api/v1/notifications");await p.axiosInstance.put(z)}catch(N){console.log(N)}const j=await E(1,Ut,o);h((j==null?void 0:j.rows)||[]),v(1),b(!0),l(!1)},O=()=>{l(!0),k()},P=({style:j})=>c.jsxs("div",{style:j,className:"notification-loading-item flex flex-col items-center justify-center py-4",children:[c.jsx("div",{className:"spinner mb-2"}),c.jsx("span",{className:"text-gray-500 text-sm",children:"Loading..."}),c.jsx("style",{children:`
32
+ `}),c.jsxs("div",{className:"tab-container",children:[c.jsx("div",{style:{display:"flex",width:"100%",height:"50px",borderBottom:`1px solid ${p.color.grey200}`},className:"tab-container__title",children:t.map((s,i)=>c.jsx("button",{id:s.id,disabled:e.currentTab===`${s.id}`,onClick:n,className:`tab-title ${e.currentTab===`${s.id}`?"is-active":""}`,children:s.tabTitle},i))}),c.jsx("div",{className:"tab-content",children:t.map((s,i)=>c.jsx("div",{children:e.currentTab===`${s.id}`&&c.jsx("div",{children:s.children})},i))})]})]})},yn=({baseUrl:e,notiPath:t,setNotiData:n})=>async(o=1,s=20,i="all")=>{const u=e+(t||"/notification-management/api/v1/notifications"),f=(await p.axiosInstance.get(u,{params:{page:o,pageSize:s,filter:{notificationFilterType:i}}})).data;return n(i==="all"?h=>({...h,all:{total:(f==null?void 0:f.total)??0}}):h=>({...h,unread:{total:(f==null?void 0:f.total)??0}})),f},zo=({notification:e,baseUrl:t,notiPath:n,markAllAsReadState:r,brandColors:o})=>{var T,S;const[s,i]=C.useState(!1),[l,u]=C.useState({id:e.id,isRead:e.isRead}),d=l.isRead===!1?"unread":"read",f={borderColor:l.isRead?"#c5c5c5":(o==null?void 0:o.primary500)||p.color.primary500,backgroundColor:l.isRead?"#c5c5c5":(o==null?void 0:o.primary500)||p.color.primary500},{setNotiData:h}=C.useContext(p.CustomOpenList),m=yn({baseUrl:t,notiPath:n,setNotiData:h}),b=async(x,w)=>{try{const k=n||`/notification-management/api/v1/notifications/${x}`,O=t+k;await p.axiosInstance.put(O,{isRead:w})}catch(k){console.log(k),u({id:e.id,isRead:e.isRead})}await m()},g=(x,w)=>{console.log("specificNotificationID",x);const k=!w;u(O=>({...O,isRead:k})),console.log("newIsReadState",k),b(x,k)};C.useEffect(()=>{u(r?x=>({...x,isRead:!0}):{id:e.id,isRead:e.isRead})},[r,e.id,e.isRead]);const a=()=>{i(!s)},y=x=>{const w=X(),k=X(x),O=w.diff(k,"days"),P=w.diff(k,"minutes"),I=w.diff(k,"months"),j=w.diff(k,"years");if(console.log("diffInMonths",I),P<1)return"Just now";if(O===0){if(P<=60)return`${P} minute${P>1?"s":""} ago`;const N=Math.floor(P/60);return console.log("diffIhours",N),`${N} hour${N>1?"s":""} ago`}if(O===1)return"Yesterday";if(O>=2&&O<7)return`${O} days ago`;if(O<30){const N=Math.floor(O/7);return`${N} week${N>1?"s":""} ago`}return I===0||I===1?"1 month ago":I<12?`${I} months ago`:j===0||j===1?"1 year ago":"Over 1 year ago"},v=e!=null&&e.data?(T=e==null?void 0:e.data)==null?void 0:T.length:0,_=(x,w)=>{var k,O;if((x==null?void 0:x.actionKey)!=null){if((k=x==null?void 0:x.data)!=null&&k.brandName)return p.translate(`notificationAdmin.notify.actionKey.${x==null?void 0:x.actionKey}`,{defaultValue:`${x==null?void 0:x.message}`,brandName:x.data.brandName});switch(x==null?void 0:x.notificationType){case"deleteMultiple":return x!=null&&x.data&&((O=x==null?void 0:x.data)==null?void 0:O.length)>1?p.translate(`notificationAdmin.notify.actionKey.${x==null?void 0:x.actionKey}_multiple`,{defaultValue:`${x==null?void 0:x.actionKey}`,count:w}):p.translate(`notificationAdmin.notify.actionKey.${x==null?void 0:x.actionKey}_single`,{defaultValue:`${x==null?void 0:x.actionKey}`});default:return p.translate(`notificationAdmin.notify.actionKey.${x==null?void 0:x.actionKey}`,{defaultValue:`${x==null?void 0:x.message}`})}}return x.message},E=e!=null&&e.contextUrl?"a":"p";return c.jsx(c.Fragment,{children:c.jsxs("div",{className:"notitification-item__container",children:[c.jsx("div",{className:"notification-item__image-container",children:c.jsx("img",{src:!e.actorAvatarUrl||e.actorName==="System"?"https://ukpcsaprod.blob.core.windows.net/account/logo.png":e.actorAvatarUrl,onError:({currentTarget:x})=>{console.log("img on error",x),x.onerror=null,x.src="https://ukpcsaprod.blob.core.windows.net/account/logo.png"},alt:e.actorName})}),c.jsxs("div",{style:{width:"100%"},children:[c.jsxs("div",{className:"notification-item__content-wrapper",children:[c.jsxs("div",{className:"notification-item__content",children:[c.jsx("p",{className:"notification-item__user-name",children:e.actorName}),c.jsxs(E,{href:e.contextUrl,style:{cursor:e!=null&&e.contextUrl?"pointer":"unset"},children:[_(e,v),c.jsx("span",{style:{color:e.contextUrl?"#007BFF":"#292929"},children:` ${e!=null&&e.context?e.context:""}`})]}),(e==null?void 0:e.notificationType)==="deleteMultiple"&&c.jsxs("button",{style:{color:p.color.primary400,textDecoration:"underline"},onClick:a,children:[s?"Hide":"Show "," details"]})]}),c.jsx("div",{className:"notification-item__time",children:c.jsx("p",{children:y(e.createdAt)})}),c.jsx("button",{className:`${d} notification-item__read-at`,"aria-label":"Mark as read",style:f,onClick:()=>g(e.id,e.isRead)})]}),s&&c.jsx("div",{style:{background:"#fff",width:"100%",padding:"8px",fontSize:"12px",marginTop:"8px"},children:c.jsx("ul",{children:(S=e==null?void 0:e.data)==null?void 0:S.map((x,w)=>c.jsxs("li",{style:{display:"flex",alignItems:"center",marginBottom:"4px"},children:[c.jsx("span",{style:{backgroundColor:p.color.primary400},className:"list-dot"}),c.jsx("span",{style:{width:"calc(100% - 12px)"},children:x.name})]},w))})})]})]})})};var $n=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Fo(e,t){return!!(e===t||$n(e)&&$n(t))}function Lo(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!Fo(e[n],t[n]))return!1;return!0}function Vt(e,t){t===void 0&&(t=Lo);var n,r=[],o,s=!1;function i(){for(var l=[],u=0;u<arguments.length;u++)l[u]=arguments[u];return s&&n===this&&t(l,r)||(o=e.apply(this,l),s=!0,n=this,r=l),o}return i}var Do=typeof performance=="object"&&typeof performance.now=="function",Rn=Do?function(){return performance.now()}:function(){return Date.now()};function zn(e){cancelAnimationFrame(e.id)}function Bo(e,t){var n=Rn();function r(){Rn()-n>=t?e.call(null):o.id=requestAnimationFrame(r)}var o={id:requestAnimationFrame(r)};return o}var Wt=-1;function Fn(e){if(e===void 0&&(e=!1),Wt===-1||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(t),Wt=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Wt}var Ae=null;function Ln(e){if(e===void 0&&(e=!1),Ae===null||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var r=document.createElement("div"),o=r.style;return o.width="100px",o.height="100px",t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?Ae="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?Ae="negative":Ae="positive-ascending"),document.body.removeChild(t),Ae}return Ae}process.env.NODE_ENV;var Ho=150,Vo=function(t,n){return t},ht=null,mt=null;process.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(ht=new WeakSet,mt=new WeakSet);function Ir(e){var t,n=e.getItemOffset,r=e.getEstimatedTotalSize,o=e.getItemSize,s=e.getOffsetForIndexAndAlignment,i=e.getStartIndexForOffset,l=e.getStopIndexForStartIndex,u=e.initInstanceProps,d=e.shouldResetStyleCacheOnItemSizeChange,f=e.validateProps;return t=function(h){p._inheritsLoose(m,h);function m(g){var a;return a=h.call(this,g)||this,a._instanceProps=u(a.props,p._assertThisInitialized(a)),a._outerRef=void 0,a._resetIsScrollingTimeoutId=null,a.state={instance:p._assertThisInitialized(a),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof a.props.initialScrollOffset=="number"?a.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},a._callOnItemsRendered=void 0,a._callOnItemsRendered=Vt(function(y,v,_,E){return a.props.onItemsRendered({overscanStartIndex:y,overscanStopIndex:v,visibleStartIndex:_,visibleStopIndex:E})}),a._callOnScroll=void 0,a._callOnScroll=Vt(function(y,v,_){return a.props.onScroll({scrollDirection:y,scrollOffset:v,scrollUpdateWasRequested:_})}),a._getItemStyle=void 0,a._getItemStyle=function(y){var v=a.props,_=v.direction,E=v.itemSize,T=v.layout,S=a._getItemStyleCache(d&&E,d&&T,d&&_),x;if(S.hasOwnProperty(y))x=S[y];else{var w=n(a.props,y,a._instanceProps),k=o(a.props,y,a._instanceProps),O=_==="horizontal"||T==="horizontal",P=_==="rtl",I=O?w:0;S[y]=x={position:"absolute",left:P?void 0:I,right:P?I:void 0,top:O?0:w,height:O?"100%":k,width:O?k:"100%"}}return x},a._getItemStyleCache=void 0,a._getItemStyleCache=Vt(function(y,v,_){return{}}),a._onScrollHorizontal=function(y){var v=y.currentTarget,_=v.clientWidth,E=v.scrollLeft,T=v.scrollWidth;a.setState(function(S){if(S.scrollOffset===E)return null;var x=a.props.direction,w=E;if(x==="rtl")switch(Ln()){case"negative":w=-E;break;case"positive-descending":w=T-_-E;break}return w=Math.max(0,Math.min(w,T-_)),{isScrolling:!0,scrollDirection:S.scrollOffset<w?"forward":"backward",scrollOffset:w,scrollUpdateWasRequested:!1}},a._resetIsScrollingDebounced)},a._onScrollVertical=function(y){var v=y.currentTarget,_=v.clientHeight,E=v.scrollHeight,T=v.scrollTop;a.setState(function(S){if(S.scrollOffset===T)return null;var x=Math.max(0,Math.min(T,E-_));return{isScrolling:!0,scrollDirection:S.scrollOffset<x?"forward":"backward",scrollOffset:x,scrollUpdateWasRequested:!1}},a._resetIsScrollingDebounced)},a._outerRefSetter=function(y){var v=a.props.outerRef;a._outerRef=y,typeof v=="function"?v(y):v!=null&&typeof v=="object"&&v.hasOwnProperty("current")&&(v.current=y)},a._resetIsScrollingDebounced=function(){a._resetIsScrollingTimeoutId!==null&&zn(a._resetIsScrollingTimeoutId),a._resetIsScrollingTimeoutId=Bo(a._resetIsScrolling,Ho)},a._resetIsScrolling=function(){a._resetIsScrollingTimeoutId=null,a.setState({isScrolling:!1},function(){a._getItemStyleCache(-1,null)})},a}m.getDerivedStateFromProps=function(a,y){return Wo(a,y),f(a),null};var b=m.prototype;return b.scrollTo=function(a){a=Math.max(0,a),this.setState(function(y){return y.scrollOffset===a?null:{scrollDirection:y.scrollOffset<a?"forward":"backward",scrollOffset:a,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},b.scrollToItem=function(a,y){y===void 0&&(y="auto");var v=this.props,_=v.itemCount,E=v.layout,T=this.state.scrollOffset;a=Math.max(0,Math.min(a,_-1));var S=0;if(this._outerRef){var x=this._outerRef;E==="vertical"?S=x.scrollWidth>x.clientWidth?Fn():0:S=x.scrollHeight>x.clientHeight?Fn():0}this.scrollTo(s(this.props,a,y,T,this._instanceProps,S))},b.componentDidMount=function(){var a=this.props,y=a.direction,v=a.initialScrollOffset,_=a.layout;if(typeof v=="number"&&this._outerRef!=null){var E=this._outerRef;y==="horizontal"||_==="horizontal"?E.scrollLeft=v:E.scrollTop=v}this._callPropsCallbacks()},b.componentDidUpdate=function(){var a=this.props,y=a.direction,v=a.layout,_=this.state,E=_.scrollOffset,T=_.scrollUpdateWasRequested;if(T&&this._outerRef!=null){var S=this._outerRef;if(y==="horizontal"||v==="horizontal")if(y==="rtl")switch(Ln()){case"negative":S.scrollLeft=-E;break;case"positive-ascending":S.scrollLeft=E;break;default:var x=S.clientWidth,w=S.scrollWidth;S.scrollLeft=w-x-E;break}else S.scrollLeft=E;else S.scrollTop=E}this._callPropsCallbacks()},b.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&zn(this._resetIsScrollingTimeoutId)},b.render=function(){var a=this.props,y=a.children,v=a.className,_=a.direction,E=a.height,T=a.innerRef,S=a.innerElementType,x=a.innerTagName,w=a.itemCount,k=a.itemData,O=a.itemKey,P=O===void 0?Vo:O,I=a.layout,j=a.outerElementType,N=a.outerTagName,z=a.style,Q=a.useIsScrolling,le=a.width,Ce=this.state.isScrolling,ge=_==="horizontal"||I==="horizontal",Ge=ge?this._onScrollHorizontal:this._onScrollVertical,ve=this._getRangeToRender(),ke=ve[0],Me=ve[1],je=[];if(w>0)for(var ue=ke;ue<=Me;ue++)je.push(C.createElement(y,{data:k,key:P(ue,k),index:ue,isScrolling:Q?Ce:void 0,style:this._getItemStyle(ue)}));var Oe=r(this.props,this._instanceProps);return C.createElement(j||N||"div",{className:v,onScroll:Ge,ref:this._outerRefSetter,style:p._extends({position:"relative",height:E,width:le,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:_},z)},C.createElement(S||x||"div",{children:je,ref:T,style:{height:ge?"100%":Oe,pointerEvents:Ce?"none":void 0,width:ge?Oe:"100%"}}))},b._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var a=this.props.itemCount;if(a>0){var y=this._getRangeToRender(),v=y[0],_=y[1],E=y[2],T=y[3];this._callOnItemsRendered(v,_,E,T)}}if(typeof this.props.onScroll=="function"){var S=this.state,x=S.scrollDirection,w=S.scrollOffset,k=S.scrollUpdateWasRequested;this._callOnScroll(x,w,k)}},b._getRangeToRender=function(){var a=this.props,y=a.itemCount,v=a.overscanCount,_=this.state,E=_.isScrolling,T=_.scrollDirection,S=_.scrollOffset;if(y===0)return[0,0,0,0];var x=i(this.props,S,this._instanceProps),w=l(this.props,x,S,this._instanceProps),k=!E||T==="backward"?Math.max(1,v):1,O=!E||T==="forward"?Math.max(1,v):1;return[Math.max(0,x-k),Math.max(0,Math.min(y-1,w+O)),x,w]},m}(C.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var Wo=function(t,n){var r=t.children,o=t.direction,s=t.height,i=t.layout,l=t.innerTagName,u=t.outerTagName,d=t.width,f=n.instance;if(process.env.NODE_ENV!=="production"){(l!=null||u!=null)&&mt&&!mt.has(f)&&(mt.add(f),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var h=o==="horizontal"||i==="horizontal";switch(o){case"horizontal":case"vertical":ht&&!ht.has(f)&&(ht.add(f),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+o+'" was specified.'))}switch(i){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+i+'" was specified.'))}if(r==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(r===null?"null":typeof r)+'" was specified.'));if(h&&typeof d!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(d===null?"null":typeof d)+'" was specified.'));if(!h&&typeof s!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(s===null?"null":typeof s)+'" was specified.'))}},Uo=50,De=function(t,n,r){var o=t,s=o.itemSize,i=r.itemMetadataMap,l=r.lastMeasuredIndex;if(n>l){var u=0;if(l>=0){var d=i[l];u=d.offset+d.size}for(var f=l+1;f<=n;f++){var h=s(f);i[f]={offset:u,size:h},u+=h}r.lastMeasuredIndex=n}return i[n]},Ko=function(t,n,r){var o=n.itemMetadataMap,s=n.lastMeasuredIndex,i=s>0?o[s].offset:0;return i>=r?kr(t,n,s,0,r):Yo(t,n,Math.max(0,s),r)},kr=function(t,n,r,o,s){for(;o<=r;){var i=o+Math.floor((r-o)/2),l=De(t,i,n).offset;if(l===s)return i;l<s?o=i+1:l>s&&(r=i-1)}return o>0?o-1:0},Yo=function(t,n,r,o){for(var s=t.itemCount,i=1;r<s&&De(t,r,n).offset<o;)r+=i,i*=2;return kr(t,n,Math.min(r,s-1),Math.floor(r/2),o)},Dn=function(t,n){var r=t.itemCount,o=n.itemMetadataMap,s=n.estimatedItemSize,i=n.lastMeasuredIndex,l=0;if(i>=r&&(i=r-1),i>=0){var u=o[i];l=u.offset+u.size}var d=r-i-1,f=d*s;return l+f},Go=Ir({getItemOffset:function(t,n,r){return De(t,n,r).offset},getItemSize:function(t,n,r){return r.itemMetadataMap[n].size},getEstimatedTotalSize:Dn,getOffsetForIndexAndAlignment:function(t,n,r,o,s,i){var l=t.direction,u=t.height,d=t.layout,f=t.width,h=l==="horizontal"||d==="horizontal",m=h?f:u,b=De(t,n,s),g=Dn(t,s),a=Math.max(0,Math.min(g-m,b.offset)),y=Math.max(0,b.offset-m+b.size+i);switch(r==="smart"&&(o>=y-m&&o<=a+m?r="auto":r="center"),r){case"start":return a;case"end":return y;case"center":return Math.round(y+(a-y)/2);case"auto":default:return o>=y&&o<=a?o:o<y?y:a}},getStartIndexForOffset:function(t,n,r){return Ko(t,r,n)},getStopIndexForStartIndex:function(t,n,r,o){for(var s=t.direction,i=t.height,l=t.itemCount,u=t.layout,d=t.width,f=s==="horizontal"||u==="horizontal",h=f?d:i,m=De(t,n,o),b=r+h,g=m.offset+m.size,a=n;a<l-1&&g<b;)a++,g+=De(t,a,o).size;return a},initInstanceProps:function(t,n){var r=t,o=r.estimatedItemSize,s={itemMetadataMap:{},estimatedItemSize:o||Uo,lastMeasuredIndex:-1};return n.resetAfterIndex=function(i,l){l===void 0&&(l=!0),s.lastMeasuredIndex=Math.min(s.lastMeasuredIndex,i-1),n._getItemStyleCache(-1),l&&n.forceUpdate()},s},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(t){var n=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof n!="function")throw Error('An invalid "itemSize" prop has been specified. Value should be a function. '+('"'+(n===null?"null":typeof n)+'" was specified.'))}}),qo=Ir({getItemOffset:function(t,n){var r=t.itemSize;return n*r},getItemSize:function(t,n){var r=t.itemSize;return r},getEstimatedTotalSize:function(t){var n=t.itemCount,r=t.itemSize;return r*n},getOffsetForIndexAndAlignment:function(t,n,r,o,s,i){var l=t.direction,u=t.height,d=t.itemCount,f=t.itemSize,h=t.layout,m=t.width,b=l==="horizontal"||h==="horizontal",g=b?m:u,a=Math.max(0,d*f-g),y=Math.min(a,n*f),v=Math.max(0,n*f-g+f+i);switch(r==="smart"&&(o>=v-g&&o<=y+g?r="auto":r="center"),r){case"start":return y;case"end":return v;case"center":{var _=Math.round(v+(y-v)/2);return _<Math.ceil(g/2)?0:_>a+Math.floor(g/2)?a:_}case"auto":default:return o>=v&&o<=y?o:o<v?v:y}},getStartIndexForOffset:function(t,n){var r=t.itemCount,o=t.itemSize;return Math.max(0,Math.min(r-1,Math.floor(n/o)))},getStopIndexForStartIndex:function(t,n,r){var o=t.direction,s=t.height,i=t.itemCount,l=t.itemSize,u=t.layout,d=t.width,f=o==="horizontal"||u==="horizontal",h=n*l,m=f?d:s,b=Math.ceil((m+r-h)/l);return Math.max(0,Math.min(i-1,n+b-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var n=t.itemSize;if(process.env.NODE_ENV!=="production"&&typeof n!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(n===null?"null":typeof n)+'" was specified.'))}});const Ut=20,Bn=({baseUrl:e,notiPath:t,brandColors:n,notiUnreadNumber:r,tabType:o,popupRef:s})=>{const[i,l]=C.useState(!1),[u,d]=C.useState(0);C.useEffect(()=>{const j=()=>{s&&s.current&&d(s.current.offsetHeight-200)};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[]);const[f,h]=C.useState([]),[m,b]=C.useState(!0),[g,a]=C.useState(!1),[y,v]=C.useState(1),{setNotiData:_}=C.useContext(p.CustomOpenList),E=yn({baseUrl:e,notiPath:t,setNotiData:_}),T=C.useRef(null),S=C.useCallback(async()=>{if(!(g||!m)){a(!0);try{const j=f.length===0?1:y+1,N=await E(j,Ut,o),z=(N==null?void 0:N.rows)||[];T.current=(N==null?void 0:N.count)||(N==null?void 0:N.total)||null,h(Q=>[...Q,...z]),v(j),(z.length<Ut||T.current&&f.length+z.length>=T.current)&&b(!1)}catch{b(!1)}finally{a(!1)}}},[g,m,y,E,f.length,o]),x=m?f.length+1:f.length,w=j=>!m||j<f.length,k=async()=>{try{const z=e+(t||"/notification-management/api/v1/notifications");await p.axiosInstance.put(z)}catch(N){console.log(N)}const j=await E(1,Ut,o);h((j==null?void 0:j.rows)||[]),v(1),b(!0),l(!1)},O=()=>{l(!0),k()},P=({style:j})=>c.jsxs("div",{style:j,className:"notification-loading-item flex flex-col items-center justify-center py-4",children:[c.jsx("div",{className:"spinner mb-2"}),c.jsx("span",{className:"text-gray-500 text-sm",children:"Loading..."}),c.jsx("style",{children:`
33
33
  .spinner {
34
34
  width: 32px;
35
35
  height: 32px;
@@ -741,7 +741,7 @@ const dn = 20, ur = ({
741
741
  const [i, l] = F(!1), [c, d] = F(0);
742
742
  q(() => {
743
743
  const M = () => {
744
- a && a.current && d(a.current.offsetHeight * 0.8);
744
+ a && a.current && d(a.current.offsetHeight - 200);
745
745
  };
746
746
  return M(), window.addEventListener("resize", M), () => window.removeEventListener("resize", M);
747
747
  }, []);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ukpc-lib/react",
3
3
  "private": false,
4
- "version": "0.13.1-dev.15",
4
+ "version": "0.13.1-dev.16",
5
5
  "type": "module",
6
6
  "main": "./dist/",
7
7
  "module": "./dist/",
@@ -1,5 +1,5 @@
1
- import "../react-to-web-component-D7SoYMky.js";
2
- import { U as e } from "../index-C4Vqyh6C.js";
1
+ import "../react-to-web-component-CXwKHjZr.js";
2
+ import { U as e } from "../index-CTw-G1vO.js";
3
3
  export {
4
4
  e as UnauthorizedPage
5
5
  };
@@ -1,5 +1,5 @@
1
- import "../react-to-web-component-D7SoYMky.js";
2
- import { aa as m } from "../index-CJLndpJy.js";
1
+ import "../react-to-web-component-CXwKHjZr.js";
2
+ import { aa as m } from "../index-Bn9XuXBT.js";
3
3
  export {
4
4
  m as BaseBreadcrumbs
5
5
  };
@@ -1,7 +1,7 @@
1
- import "../react-to-web-component-D7SoYMky.js";
2
- import { F as i, u as m } from "../index-CNiqJEgy.js";
3
- import "../index-Cx0zTfOC.js";
4
- import "../index-CJLndpJy.js";
1
+ import "../react-to-web-component-CXwKHjZr.js";
2
+ import { F as i, u as m } from "../index-Dyis4eM8.js";
3
+ import "../index-BSe1av43.js";
4
+ import "../index-Bn9XuXBT.js";
5
5
  export {
6
6
  i as FavoriteMenu,
7
7
  m as updateFavoriteItems
@@ -1,7 +1,7 @@
1
- import "../react-to-web-component-D7SoYMky.js";
2
- import { G as i } from "../index-CNiqJEgy.js";
3
- import "../index-Cx0zTfOC.js";
4
- import "../index-CJLndpJy.js";
1
+ import "../react-to-web-component-CXwKHjZr.js";
2
+ import { G as i } from "../index-Dyis4eM8.js";
3
+ import "../index-BSe1av43.js";
4
+ import "../index-Bn9XuXBT.js";
5
5
  export {
6
6
  i as GlobalMenu
7
7
  };
@@ -1,9 +1,9 @@
1
- import "../react-to-web-component-D7SoYMky.js";
2
- import { L as n, T as s } from "../index-CNiqJEgy.js";
3
- import "../index-Cx0zTfOC.js";
4
- import "../index-C4Vqyh6C.js";
5
- import "../index-CJLndpJy.js";
6
- import "../react-toastify.esm-Y1WvK90L.js";
1
+ import "../react-to-web-component-CXwKHjZr.js";
2
+ import { L as n, T as s } from "../index-Dyis4eM8.js";
3
+ import "../index-BSe1av43.js";
4
+ import "../index-CTw-G1vO.js";
5
+ import "../index-Bn9XuXBT.js";
6
+ import "../react-toastify.esm-CrTD7cpE.js";
7
7
  import "../toast-config/index.js";
8
8
  import "../toast-config-notification/index.js";
9
9
  export {
@@ -1,6 +1,6 @@
1
- import "../react-to-web-component-D7SoYMky.js";
2
- import { H as e, g as m } from "../index-CNiqJEgy.js";
3
- import "../index-CJLndpJy.js";
1
+ import "../react-to-web-component-CXwKHjZr.js";
2
+ import { H as e, g as m } from "../index-Dyis4eM8.js";
3
+ import "../index-Bn9XuXBT.js";
4
4
  export {
5
5
  e as HasPermission,
6
6
  m as getUseHasPermission
@@ -1,4 +1,4 @@
1
- import { j as e, s as a } from "./react-to-web-component-D7SoYMky.js";
1
+ import { j as e, s as a } from "./react-to-web-component-CXwKHjZr.js";
2
2
  const l = "*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}";
3
3
  function s({ children: t, styles: o = [], ...i }) {
4
4
  return /* @__PURE__ */ e.jsxs("div", { ...i, children: [