@devtron-labs/devtron-fe-common-lib 0.0.6-beta-10 → 0.0.6-beta-13
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/Common/Constants.d.ts +6 -0
- package/dist/Common/CustomTagSelector/PropagateTagInfo.d.ts +2 -0
- package/dist/Common/CustomTagSelector/TagDetails.d.ts +8 -0
- package/dist/Common/CustomTagSelector/TagLabelSelect.d.ts +5 -0
- package/dist/Common/CustomTagSelector/TagLabelValueSelector.d.ts +10 -0
- package/dist/Common/CustomTagSelector/TagSelector.utils.d.ts +12 -0
- package/dist/Common/CustomTagSelector/ValidationRules.d.ts +10 -0
- package/dist/Common/CustomTagSelector/index.d.ts +2 -0
- package/dist/Common/Dialogs/ConfirmationDialog.d.ts +20 -0
- package/dist/Common/Dialogs/DeleteDialog.d.ts +5 -0
- package/dist/Common/Dialogs/DialogForm.d.ts +22 -0
- package/dist/Common/Dialogs/ForceDeleteDialog.d.ts +3 -0
- package/dist/Common/Dialogs/Types.d.ts +15 -0
- package/dist/Common/Dialogs/index.d.ts +4 -0
- package/dist/Common/PopupMenu.d.ts +23 -0
- package/dist/Common/RadioGroup.d.ts +17 -0
- package/dist/Common/TippyCustomized.d.ts +35 -0
- package/dist/Common/Types.d.ts +12 -0
- package/dist/Common/index.d.ts +4 -0
- package/dist/index.js +3959 -1
- package/package.json +2 -2
- package/rollup.config.js +1 -3
- package/src/Assets/Icon/ic-help-outline.svg +3 -0
- package/src/Assets/Icon/ic-info-outlined.svg +13 -0
- package/src/Assets/Icon/inject-tag.svg +5 -0
- package/src/Assets/Img/warning-medium.svg +15 -0
- package/src/Common/BreadCrumb/BreadCrumb.tsx +1 -2
- package/src/Common/Constants.ts +7 -0
- package/src/Common/CustomTagSelector/PropagateTagInfo.tsx +36 -0
- package/src/Common/CustomTagSelector/TagDetails.tsx +41 -0
- package/src/Common/CustomTagSelector/TagLabelSelect.tsx +49 -0
- package/src/Common/CustomTagSelector/TagLabelValueSelector.tsx +144 -0
- package/src/Common/CustomTagSelector/TagSelector.utils.ts +71 -0
- package/src/Common/CustomTagSelector/ValidationRules.ts +55 -0
- package/src/Common/CustomTagSelector/index.ts +2 -0
- package/src/Common/Dialogs/ConfirmationDialog.tsx +32 -0
- package/src/Common/Dialogs/DeleteDialog.tsx +35 -0
- package/src/Common/Dialogs/DialogForm.tsx +95 -0
- package/src/Common/Dialogs/ForceDeleteDialog.tsx +19 -0
- package/src/Common/Dialogs/Types.ts +16 -0
- package/src/Common/Dialogs/index.ts +4 -0
- package/src/Common/PopupMenu.tsx +131 -0
- package/src/Common/RadioGroup.tsx +63 -0
- package/src/Common/TippyCustomized.tsx +173 -0
- package/src/Common/Types.ts +14 -0
- package/src/Common/index.ts +5 -1
- package/tsconfig.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1,3959 @@
|
|
|
1
|
-
import{jsx as t,jsxs as e,Fragment as n}from"react/jsx-runtime";import*as r from"react";import s,{createElement as o,useRef as i,useLayoutEffect as a,useEffect as c,useReducer as l,useState as u,isValidElement as d,cloneElement as h,Component as p,createContext as f,useMemo as m}from"react";import g,{render as v}from"react-dom";import{useRouteMatch as _,useParams as y}from"react-router";import{Link as b}from"react-router-dom";var E=6e4,w=process.env.REACT_APP_ORCHESTRATOR_ROOT,C=function(t,e){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},C(t,e)};function D(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}C(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var x=function(){return x=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},x.apply(this,arguments)};function T(t,e,n,r){return new(n||(n=Promise))((function(s,o){function i(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,a)}c((r=r.apply(t,e||[])).next())}))}function S(t,e){var n,r,s,o,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(i=0)),i;)try{if(n=1,r&&(s=2&a[0]?r.return:a[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;switch(r=0,s&&(a=[2&a[0],s.value]),a[0]){case 0:case 1:s=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(s=i.trys,(s=s.length>0&&s[s.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(6===a[0]&&i.label<s[1]){i.label=s[1],s=a;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(a);break}s[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],r=0}finally{n=s=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var N=function(t){this.code=t.code||0,this.userMessage=t.userMessage||"",this.internalMessage=t.internalMessage||"",this.moreInfo=t.moreInfo||""},F=function(t){function e(n){var r=t.call(this)||this;r.code=n.code;var s=n.errors.reduce((function(t,e){return t+="".concat(e.internalMessage||e.userMessage)}),"");return r.name="[".concat(n.code.toString(),"]"),r.message=s,r.errors=n.errors.map((function(t){return new N(t)})),Object.setPrototypeOf(r,e.prototype),r}return D(e,t),e}(Error),k={100:"Continue",101:"Switching Protocols",102:"Processing(WebDAV)",200:"OK",201:"Created",202:"Accepted",203:"Non - Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi - Status(WebDAV)",208:"Already Reported(WebDAV)",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect(experimental)",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request - URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",420:"Enhance Your Calm(Twitter)",422:"Unprocessable Entity(WebDAV)",423:"Locked(WebDAV)",424:"Failed Dependency(WebDAV)",425:"Reserved for WebDAV",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",444:"No Response(Nginx)",449:"Retry With(Microsoft)",450:"Blocked by Windows Parental Controls(Microsoft)",451:"Unavailable For Legal Reasons",499:"Client Closed Request(Nginx)",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates(Experimental)",507:"Insufficient Storage(WebDAV)",508:"Loop Detected(WebDAV)",509:"Bandwidth Limit Exceeded(Apache)",510:"Not Extended",511:"Network Authentication Required",598:"Network read timeout error",599:"Network connect timeout error"};function L(t,e){return T(this,void 0,void 0,(function(){var n,r,s,o;return S(this,(function(i){switch(i.label){case 0:return n=e.status,r=e.statusText||k[n],s=new F({code:n,errors:[]}),"application/json"===t?[3,1]:(r="".concat(k[n],". Please try again."),[3,3]);case 1:return[4,e.json()];case 2:(o=i.sent()).errors&&(s.errors=o.errors),i.label=3;case 3:throw s.errors=s.errors.length>0?s.errors:[{code:n,internalMessage:r,userMessage:r}],s}}))}))}function R(t,e,n,r,s,o){return void 0===s&&(s=!1),T(this,void 0,void 0,(function(){var i,a=this;return S(this,(function(c){return(i={method:e,signal:r,body:n?JSON.stringify(n):void 0}).credentials="include",[2,fetch("".concat(w,"/").concat(t),o?{method:e,body:n}:i).then((function(t){return T(a,void 0,void 0,(function(){var e;return S(this,(function(n){switch(n.label){case 0:if(e=t.headers.get("Content-Type"),401!==t.status)return[3,1];if(s)throw new F({code:401,errors:[{code:401,internalMessage:"Please login again",userMessage:"Please login again"}]});return[2,{code:401,status:"Unauthorized",result:[]}];case 1:return t.status>=300&&t.status<=599?[4,L(e,t)]:[3,3];case 2:return[2,n.sent()];case 3:if("application/json"===e)return[2,t.json().then((function(t){if(t.code>=300&&t.code<=599)throw new F({code:t.code,errors:t.errors});return t}))];if("octet-stream"===e||"application/octet-stream"===e)return[2,t];n.label=4;case 4:return[2]}}))}))}),(function(t){var e={code:0,userMessage:t.message,internalMessage:t.message,moreInfo:t.message};throw new F({code:0,errors:[e]})}))]}))}))}function O(t,e,n,r,s){var o=new AbortController,i=o.signal,a=new Promise((function(t,e){var n=(null==r?void 0:r.timeout)?r.timeout:6e4;setTimeout((function(){o.abort(),e({code:408,errors:[{code:408,internalMessage:"Request cancelled",userMessage:"Request Cancelled"}]})}),n)}));return Promise.race([R(t,e,n,(null==r?void 0:r.signal)||i,(null==r?void 0:r.preventAutoLogout)||!1,s),a]).catch((function(t){throw t instanceof F?t:new F({code:408,errors:[{code:408,internalMessage:"That took longer than expected.",userMessage:"That took longer than expected."}]})}))}var M=function(t,e,n,r){return O(t,"POST",e,n,r)},A=function(t,e,n){return O(t,"PUT",e,n)},P=function(t,e){return O(t,"GET",null,e)},I=function(t,e,n){return O(t,"DELETE",e,n)};function B(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&r.firstChild?r.insertBefore(s,r.firstChild):r.appendChild(s),s.styleSheet?s.styleSheet.cssText=t:s.appendChild(document.createTextNode(t))}}var z;function j(){return j=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},j.apply(this,arguments)}B(".empty-state {\n height: 100%;\n}\n.empty-state img {\n height: 40%;\n max-height: 200px;\n width: auto;\n max-width: 250px;\n}\n.empty-state svg {\n height: 40%;\n max-height: 200px;\n width: auto;\n}\n.empty-state h1,\n.empty-state h2,\n.empty-state h3,\n.empty-state h4,\n.empty-state h5,\n.empty-state h6 {\n color: var(--N900);\n}\n.empty-state .title {\n font-weight: 600;\n}\n.empty-state .subtitle {\n font-size: 13px;\n width: 250px;\n font-weight: 400;\n text-align: center;\n line-height: 1.5;\n margin-bottom: 20px;\n}\n.empty-state .cta {\n height: 36px;\n}\n.empty-state p {\n width: 250px;\n text-align: center;\n font-size: 13px;\n color: var(--N700);\n}\n.empty-state strong {\n font-size: 16px;\n margin-bottom: 4px;\n color: var(--N900);\n font-weight: normal;\n}\n.empty-state .select-popup {\n height: min-content;\n max-height: 250px;\n overflow: auto;\n padding: 8px 0;\n}\n.empty-state .empty-state__loader {\n width: 34px;\n height: 34px;\n margin-bottom: 16px;\n}\n.empty-state .empty-state__loading-text {\n font-size: 12px;\n width: 200px;\n font-weight: normal;\n font-stretch: normal;\n font-style: normal;\n line-height: 1.5;\n letter-spacing: normal;\n text-align: center;\n color: var(--N900);\n}\n.empty-state .button__icon {\n width: 16px;\n height: 16px;\n margin-left: 8px;\n}");var U=function(t){return r.createElement("svg",j({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},t),z||(z=r.createElement("g",{fill:"none"},r.createElement("animateTransform",{attributeName:"transform",attributeType:"XML",dur:"0.5s",from:"0 12 12",repeatCount:"indefinite",to:"360 12 12",type:"rotate"}),r.createElement("path",{fill:"#06C",d:"M12 2.5A9.5 9.5 0 1 1 2.5 12a1.5 1.5 0 0 1 3 0A6.5 6.5 0 1 0 12 5.5a1.5 1.5 0 0 1 0-3z"}))))};function q(e){var n=e.children;return t("div",x({className:"flex column empty-state",style:{width:"100%",height:"100%"}},{children:n}))}function H(t){var e,n,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t)if(Array.isArray(t))for(e=0;e<t.length;e++)t[e]&&(n=H(t[e]))&&(r&&(r+=" "),r+=n);else for(e in t)t[e]&&(r&&(r+=" "),r+=e);return r}function G(){for(var t,e,n=0,r="";n<arguments.length;)(t=arguments[n++])&&(e=H(t))&&(r&&(r+=" "),r+=e);return r}function W(){return W=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},W.apply(this,arguments)}function Y(t,e){if(null==t)return{};var n,r,s={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(s[n]=t[n]);return s}function V(t){return"number"==typeof t&&!isNaN(t)}function $(t){return"boolean"==typeof t}function Q(t){return"string"==typeof t}function J(t){return"function"==typeof t}function X(t){return Q(t)||J(t)?t:null}function K(t){return 0===t||t}q.Image=function(t){return t.children},q.Title=function(t){return t.children},q.Subtitle=function(e){var n=e.children,r=e.className;return t("p",x({className:"subtitle ".concat(r)},{children:n}))},q.Button=function(t){return t.children},q.Loading=function(r){return e(n,{children:[t(U,{className:"dc__block empty-state__loader"}),t("p",x({className:"empty-state__loading-text"},{children:r.text}))]})};var Z=!("undefined"==typeof window||!window.document||!window.document.createElement);function tt(t){return d(t)||Q(t)||J(t)||V(t)}var et={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},nt={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"};function rt(t){var e=t.enter,n=t.exit,r=t.appendPosition,o=void 0!==r&&r,l=t.collapse,u=void 0===l||l,d=t.collapseDuration,h=void 0===d?300:d;return function(t){var r=t.children,l=t.position,d=t.preventExitTransition,p=t.done,f=t.nodeRef,m=t.isIn,g=o?e+"--"+l:e,v=o?n+"--"+l:n,_=i(),y=i(0);function b(t){if(t.target===f.current){var e=f.current;e.dispatchEvent(new Event("d")),e.removeEventListener("animationend",b),e.removeEventListener("animationcancel",b),0===y.current&&(e.className=_.current)}}function E(){var t=f.current;t.removeEventListener("animationend",E),u?function(t,e,n){void 0===n&&(n=300);var r=t.scrollHeight,s=t.style;requestAnimationFrame((function(){s.minHeight="initial",s.height=r+"px",s.transition="all "+n+"ms",requestAnimationFrame((function(){s.height="0",s.padding="0",s.margin="0",setTimeout(e,n)}))}))}(t,p,h):p()}return a((function(){var t;t=f.current,_.current=t.className,t.className+=" "+g,t.addEventListener("animationend",b),t.addEventListener("animationcancel",b)}),[]),c((function(){m||(d?E():function(){y.current=1;var t=f.current;t.className+=" "+v,t.addEventListener("animationend",E)}())}),[m]),s.createElement(s.Fragment,null,r)}}var st={list:new Map,emitQueue:new Map,on:function(t,e){return this.list.has(t)||this.list.set(t,[]),this.list.get(t).push(e),this},off:function(t,e){if(e){var n=this.list.get(t).filter((function(t){return t!==e}));return this.list.set(t,n),this}return this.list.delete(t),this},cancelEmit:function(t){var e=this.emitQueue.get(t);return e&&(e.forEach(clearTimeout),this.emitQueue.delete(t)),this},emit:function(t){for(var e=this,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];this.list.has(t)&&this.list.get(t).forEach((function(n){var s=setTimeout((function(){n.apply(void 0,r)}),0);e.emitQueue.has(t)||e.emitQueue.set(t,[]),e.emitQueue.get(t).push(s)}))}},ot=["delay","staleId"];function it(t){var e=l((function(t){return t+1}),0)[1],n=u([]),r=n[0],s=n[1],o=i(null),a=i(new Map).current,p=function(t){return-1!==r.indexOf(t)},f=i({toastKey:1,displayedToast:0,count:0,queue:[],props:t,containerId:null,isToastActive:p,getToast:function(t){return a.get(t)}}).current;function m(t){var e=t.containerId;!f.props.limit||e&&f.containerId!==e||(f.count-=f.queue.length,f.queue=[])}function g(t){s((function(e){return K(t)?e.filter((function(e){return e!==t})):[]}))}function v(){var t=f.queue.shift();y(t.toastContent,t.toastProps,t.staleId)}function _(t,n){var r=n.delay,s=n.staleId,i=Y(n,ot);if(tt(t)&&!function(t){return!o.current||f.props.enableMultiContainer&&t.containerId!==f.props.containerId||a.has(t.toastId)&&null==t.updateId}(i)){var c=i.toastId,l=i.updateId,u=i.data,p=f.props,m=function(){return g(c)},_=null==l;_&&f.count++;var b,E,w={toastId:c,updateId:l,isLoading:i.isLoading,theme:i.theme||p.theme,icon:null!=i.icon?i.icon:p.icon,isIn:!1,key:i.key||f.toastKey++,type:i.type,closeToast:m,closeButton:i.closeButton,rtl:p.rtl,position:i.position||p.position,transition:i.transition||p.transition,className:X(i.className||p.toastClassName),bodyClassName:X(i.bodyClassName||p.bodyClassName),style:i.style||p.toastStyle,bodyStyle:i.bodyStyle||p.bodyStyle,onClick:i.onClick||p.onClick,pauseOnHover:$(i.pauseOnHover)?i.pauseOnHover:p.pauseOnHover,pauseOnFocusLoss:$(i.pauseOnFocusLoss)?i.pauseOnFocusLoss:p.pauseOnFocusLoss,draggable:$(i.draggable)?i.draggable:p.draggable,draggablePercent:i.draggablePercent||p.draggablePercent,draggableDirection:i.draggableDirection||p.draggableDirection,closeOnClick:$(i.closeOnClick)?i.closeOnClick:p.closeOnClick,progressClassName:X(i.progressClassName||p.progressClassName),progressStyle:i.progressStyle||p.progressStyle,autoClose:!i.isLoading&&(b=i.autoClose,E=p.autoClose,!1===b||V(b)&&b>0?b:E),hideProgressBar:$(i.hideProgressBar)?i.hideProgressBar:p.hideProgressBar,progress:i.progress,role:i.role||p.role,deleteToast:function(){a.delete(c);var t=f.queue.length;if(f.count=K(c)?f.count-1:f.count-f.displayedToast,f.count<0&&(f.count=0),t>0){var n=K(c)?1:f.props.limit;if(1===t||1===n)f.displayedToast++,v();else{var r=n>t?t:n;f.displayedToast=r;for(var s=0;s<r;s++)v()}}else e()}};J(i.onOpen)&&(w.onOpen=i.onOpen),J(i.onClose)&&(w.onClose=i.onClose),w.closeButton=p.closeButton,!1===i.closeButton||tt(i.closeButton)?w.closeButton=i.closeButton:!0===i.closeButton&&(w.closeButton=!tt(p.closeButton)||p.closeButton);var C=t;d(t)&&!Q(t.type)?C=h(t,{closeToast:m,toastProps:w,data:u}):J(t)&&(C=t({closeToast:m,toastProps:w,data:u})),p.limit&&p.limit>0&&f.count>p.limit&&_?f.queue.push({toastContent:C,toastProps:w,staleId:s}):V(r)&&r>0?setTimeout((function(){y(C,w,s)}),r):y(C,w,s)}}function y(t,e,n){var r=e.toastId;n&&a.delete(n),a.set(r,{content:t,props:e}),s((function(t){return[].concat(t,[r]).filter((function(t){return t!==n}))}))}return c((function(){return f.containerId=t.containerId,st.cancelEmit(3).on(0,_).on(1,(function(t){return o.current&&g(t)})).on(5,m).emit(2,f),function(){return st.emit(3,f)}}),[]),c((function(){f.isToastActive=p,f.displayedToast=r.length,st.emit(4,r.length,t.containerId)}),[r]),c((function(){f.props=t})),{getToastToRender:function(e){var n=new Map,r=Array.from(a.values());return t.newestOnTop&&r.reverse(),r.forEach((function(t){var e=t.props.position;n.has(e)||n.set(e,[]),n.get(e).push(t)})),Array.from(n,(function(t){return e(t[0],t[1])}))},containerRef:o,isToastActive:p}}function at(t){return t.targetTouches&&t.targetTouches.length>=1?t.targetTouches[0].clientX:t.clientX}function ct(t){return t.targetTouches&&t.targetTouches.length>=1?t.targetTouches[0].clientY:t.clientY}function lt(t){var e=u(!1),n=e[0],r=e[1],s=u(!1),o=s[0],a=s[1],l=i(null),h=i({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,p=i(t),f=t.autoClose,m=t.pauseOnHover,g=t.closeToast,v=t.onClick,_=t.closeOnClick;function y(e){if(t.draggable){h.didMove=!1,document.addEventListener("mousemove",C),document.addEventListener("mouseup",D),document.addEventListener("touchmove",C),document.addEventListener("touchend",D);var n=l.current;h.canCloseOnClick=!0,h.canDrag=!0,h.boundingRect=n.getBoundingClientRect(),n.style.transition="",h.x=at(e.nativeEvent),h.y=ct(e.nativeEvent),"x"===t.draggableDirection?(h.start=h.x,h.removalDistance=n.offsetWidth*(t.draggablePercent/100)):(h.start=h.y,h.removalDistance=n.offsetHeight*(80===t.draggablePercent?1.5*t.draggablePercent:t.draggablePercent/100))}}function b(){if(h.boundingRect){var e=h.boundingRect,n=e.top,r=e.bottom,s=e.left,o=e.right;t.pauseOnHover&&h.x>=s&&h.x<=o&&h.y>=n&&h.y<=r?w():E()}}function E(){r(!0)}function w(){r(!1)}function C(e){var r=l.current;h.canDrag&&r&&(h.didMove=!0,n&&w(),h.x=at(e),h.y=ct(e),"x"===t.draggableDirection?h.delta=h.x-h.start:h.delta=h.y-h.start,h.start!==h.x&&(h.canCloseOnClick=!1),r.style.transform="translate"+t.draggableDirection+"("+h.delta+"px)",r.style.opacity=""+(1-Math.abs(h.delta/h.removalDistance)))}function D(){document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",D),document.removeEventListener("touchmove",C),document.removeEventListener("touchend",D);var e=l.current;if(h.canDrag&&h.didMove&&e){if(h.canDrag=!1,Math.abs(h.delta)>h.removalDistance)return a(!0),void t.closeToast();e.style.transition="transform 0.2s, opacity 0.2s",e.style.transform="translate"+t.draggableDirection+"(0)",e.style.opacity="1"}}c((function(){p.current=t})),c((function(){return l.current&&l.current.addEventListener("d",E,{once:!0}),J(t.onOpen)&&t.onOpen(d(t.children)&&t.children.props),function(){var t=p.current;J(t.onClose)&&t.onClose(d(t.children)&&t.children.props)}}),[]),c((function(){return t.pauseOnFocusLoss&&function(){document.hasFocus()||w();window.addEventListener("focus",E),window.addEventListener("blur",w)}(),function(){t.pauseOnFocusLoss&&(window.removeEventListener("focus",E),window.removeEventListener("blur",w))}}),[t.pauseOnFocusLoss]);var x={onMouseDown:y,onTouchStart:y,onMouseUp:b,onTouchEnd:b};return f&&m&&(x.onMouseEnter=w,x.onMouseLeave=E),_&&(x.onClick=function(t){v&&v(t),h.canCloseOnClick&&g()}),{playToast:E,pauseToast:w,isRunning:n,preventExitTransition:o,toastRef:l,eventHandlers:x}}function ut(t){var e=t.closeToast,n=t.theme,r=t.ariaLabel;return o("button",{className:"Toastify__close-button Toastify__close-button--"+n,type:"button",onClick:function(t){t.stopPropagation(),e(t)},"aria-label":void 0===r?"close":r},o("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},o("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function dt(t){var e,n,r=t.delay,s=t.isRunning,i=t.closeToast,a=t.type,c=t.hide,l=t.className,u=t.style,d=t.controlledProgress,h=t.progress,p=t.rtl,f=t.isIn,m=t.theme,g=W({},u,{animationDuration:r+"ms",animationPlayState:s?"running":"paused",opacity:c?0:1});d&&(g.transform="scaleX("+h+")");var v=G("Toastify__progress-bar",d?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated","Toastify__progress-bar-theme--"+m,"Toastify__progress-bar--"+a,((e={})["Toastify__progress-bar--rtl"]=p,e)),_=J(l)?l({rtl:p,type:a,defaultClassName:v}):G(v,l),y=((n={})[d&&h>=1?"onTransitionEnd":"onAnimationEnd"]=d&&h<1?null:function(){f&&i()},n);return o("div",Object.assign({role:"progressbar","aria-hidden":c?"true":"false","aria-label":"notification timer",className:_,style:g},y))}dt.defaultProps={type:nt.DEFAULT,hide:!1};var ht=["theme","type"],pt=function(t){var e=t.theme,n=t.type,r=Y(t,ht);return o("svg",Object.assign({viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===e?"currentColor":"var(--toastify-icon-color-"+n+")"},r))};var ft={info:function(t){return o(pt,Object.assign({},t),o("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(t){return o(pt,Object.assign({},t),o("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(t){return o(pt,Object.assign({},t),o("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(t){return o(pt,Object.assign({},t),o("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return o("div",{className:"Toastify__spinner"})}},mt=function(t){var e,n,r=lt(t),s=r.isRunning,i=r.preventExitTransition,a=r.toastRef,c=r.eventHandlers,l=t.closeButton,u=t.children,p=t.autoClose,f=t.onClick,m=t.type,g=t.hideProgressBar,v=t.closeToast,_=t.transition,y=t.position,b=t.className,E=t.style,w=t.bodyClassName,C=t.bodyStyle,D=t.progressClassName,x=t.progressStyle,T=t.updateId,S=t.role,N=t.progress,F=t.rtl,k=t.toastId,L=t.deleteToast,R=t.isIn,O=t.isLoading,M=t.icon,A=t.theme,P=G("Toastify__toast","Toastify__toast-theme--"+A,"Toastify__toast--"+m,((e={})["Toastify__toast--rtl"]=F,e)),I=J(b)?b({rtl:F,position:y,type:m,defaultClassName:P}):G(P,b),B=!!N,z=ft[m],j={theme:A,type:m},U=z&&z(j);return!1===M?U=void 0:J(M)?U=M(j):d(M)?U=h(M,j):Q(M)?U=M:O&&(U=ft.spinner()),o(_,{isIn:R,done:L,position:y,preventExitTransition:i,nodeRef:a},o("div",Object.assign({id:k,onClick:f,className:I},c,{style:E,ref:a}),o("div",Object.assign({},R&&{role:S},{className:J(w)?w({type:m}):G("Toastify__toast-body",w),style:C}),U&&o("div",{className:G("Toastify__toast-icon",(n={},n["Toastify--animate-icon Toastify__zoom-enter"]=!O,n))},U),o("div",null,u)),function(t){if(t){var e={closeToast:v,type:m,theme:A};return J(t)?t(e):d(t)?h(t,e):void 0}}(l),(p||B)&&o(dt,Object.assign({},T&&!B?{key:"pb-"+T}:{},{rtl:F,theme:A,delay:p,isRunning:s,isIn:R,closeToast:v,hide:g,type:m,style:x,className:D,controlledProgress:B,progress:N}))))},gt=function(t){var e=it(t),n=e.getToastToRender,r=e.containerRef,s=e.isToastActive,i=t.className,a=t.style,c=t.rtl,l=t.containerId;function u(t){var e,n=G("Toastify__toast-container","Toastify__toast-container--"+t,((e={})["Toastify__toast-container--rtl"]=c,e));return J(i)?i({position:t,rtl:c,defaultClassName:n}):G(n,X(i))}return o("div",{ref:r,className:"Toastify",id:l},n((function(t,e){var n=e.length?W({},a):W({},a,{pointerEvents:"none"});return o("div",{className:u(t),style:n,key:"container-"+t},e.map((function(t){var e=t.content,n=t.props;return o(mt,Object.assign({},n,{isIn:s(n.toastId),key:"toast-"+n.key,closeButton:!0===n.closeButton?ut:n.closeButton}),e)})))})))};gt.defaultProps={position:et.TOP_RIGHT,transition:rt({enter:"Toastify--animate Toastify__bounce-enter",exit:"Toastify--animate Toastify__bounce-exit",appendPosition:!0}),rtl:!1,autoClose:5e3,hideProgressBar:!1,closeButton:ut,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,newestOnTop:!1,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};var vt,_t,yt,bt=new Map,Et=[],wt=!1;function Ct(){return Math.random().toString(36).substring(2,9)}function Dt(t){return t&&(Q(t.toastId)||V(t.toastId))?t.toastId:Ct()}function xt(t,e){return bt.size>0?st.emit(0,t,e):(Et.push({content:t,options:e}),wt&&Z&&(wt=!1,_t=document.createElement("div"),document.body.appendChild(_t),v(o(gt,Object.assign({},yt)),_t))),e.toastId}function Tt(t,e){return W({},e,{type:e&&e.type||t,toastId:Dt(e)})}function St(t){return function(e,n){return xt(e,Tt(t,n))}}function Nt(t,e){return xt(t,Tt(nt.DEFAULT,e))}Nt.loading=function(t,e){return xt(t,Tt(nt.DEFAULT,W({isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1},e)))},Nt.promise=function(t,e,n){var r,s=e.pending,o=e.error,i=e.success;s&&(r=Q(s)?Nt.loading(s,n):Nt.loading(s.render,W({},n,s)));var a={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},c=function(t,e,s){if(null!=e){var o=W({type:t},a,n,{data:s}),i=Q(e)?{render:e}:e;return r?Nt.update(r,W({},o,i)):Nt(i.render,W({},o,i)),s}Nt.dismiss(r)},l=J(t)?t():t;return l.then((function(t){return c("success",i,t)})).catch((function(t){return c("error",o,t)})),l},Nt.success=St(nt.SUCCESS),Nt.info=St(nt.INFO),Nt.error=St(nt.ERROR),Nt.warning=St(nt.WARNING),Nt.warn=Nt.warning,Nt.dark=function(t,e){return xt(t,Tt(nt.DEFAULT,W({theme:"dark"},e)))},Nt.dismiss=function(t){return st.emit(1,t)},Nt.clearWaitingQueue=function(t){return void 0===t&&(t={}),st.emit(5,t)},Nt.isActive=function(t){var e=!1;return bt.forEach((function(n){n.isToastActive&&n.isToastActive(t)&&(e=!0)})),e},Nt.update=function(t,e){void 0===e&&(e={}),setTimeout((function(){var n=function(t,e){var n=e.containerId,r=bt.get(n||vt);return r?r.getToast(t):null}(t,e);if(n){var r=n.props,s=n.content,o=W({},r,e,{toastId:e.toastId||t,updateId:Ct()});o.toastId!==t&&(o.staleId=t);var i=o.render||s;delete o.render,xt(i,o)}}),0)},Nt.done=function(t){Nt.update(t,{progress:1})},Nt.onChange=function(t){return J(t)&&st.on(4,t),function(){J(t)&&st.off(4,t)}},Nt.configure=function(t){void 0===t&&(t={}),wt=!0,yt=t},Nt.POSITION=et,Nt.TYPE=nt,st.on(2,(function(t){vt=t.containerId||t,bt.set(vt,t),Et.forEach((function(t){st.emit(0,t.content,t.options)})),Et=[]})).on(3,(function(t){bt.delete(t.containerId||t),0===bt.size&&st.off(0).off(1).off(5),Z&&_t&&document.body.removeChild(_t)}));var Ft=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return D(r,n),r.prototype.render=function(){return e("div",x({className:"toast"},{children:[t("div",x({className:"toast__title"},{children:this.props.title})),this.props.subtitle&&t("div",x({className:"toast__subtitle"},{children:this.props.subtitle}))]}))},r}(s.Component),kt=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return D(r,n),r.prototype.render=function(){return e("div",x({className:"flex left column dc__app-update-toast"},{children:[t("span",x({className:"info"},{children:this.props.text})),t("button",x({type:"button",onClick:this.props.onClick},{children:this.props.buttonText}))]}))},r}(s.Component),Lt=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return D(r,n),r.prototype.render=function(){return e("div",x({className:"toast dc__app-update-toast"},{children:[t("div",x({className:"toast__title"},{children:this.props.title})),this.props.subtitle&&t("div",x({className:"toast__subtitle"},{children:this.props.subtitle})),t("button",x({type:"button",onClick:this.props.onClick,style:{float:"right"}},{children:this.props.buttonText}))]}))},r}(s.Component),Rt=function(e){return Nt.info(t(Ft,{title:"Access denied",subtitle:e||"You do not have required access to perform this action"}),{className:"devtron-toast unauthorized"})};function Ot(n){var r=n.reload,s=void 0===r?null:r,o=n.className;return t("article",x({className:"flex ".concat(void 0===o?"":o),style:{width:"100%",height:"100%"}},{children:e("div",x({className:"flex column",style:{width:"250px",textAlign:"center"}},{children:[t("img",{src:"b5d52f036bdcd3ed.png",style:{width:"100%",height:"auto",marginBottom:"12px"},alt:"load-error"}),t("h3",x({className:"title dc__bold"},{children:"Failed to load"})),t("div",x({className:"dc__empty__subtitle",style:{marginBottom:"20px"}},{children:"We could not load this page. Please give us another try."})),t("button",x({type:"button",className:"cta ghosted",onClick:"function"==typeof s?s:function(t){window.location.reload()}},{children:"Retry"}))]}))}))}var Mt=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return D(n,e),n.prototype.getMessage=function(){switch(this.props.code){case 400:return"Bad Request";case 401:return"Unauthorized";case 403:return t(At,{subtitle:this.props.subtitle});case 404:return"Not Found";case 500:return"Internal Server Error";case 502:return"Bad Gateway";case 503:return"Service Temporarily Unavailable";default:return t(Ot,{className:this.props.reloadClass})}},n.prototype.render=function(){var e=this.getMessage();return t("div",{children:t("h1",{children:e})})},n}(p),At=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return D(r,n),r.prototype.render=function(){return e(q,{children:[t(q.Image,{children:t("img",{src:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%22250%22%20height%3D%22200%22%20viewBox%3D%220%200%20250%20200%22%3E%20%20%20%20%3Cdefs%3E%20%20%20%20%20%20%20%20%3ClinearGradient%20id%3D%22ho9etwod5c%22%20x1%3D%2255.01%25%22%20x2%3D%2240.976%25%22%20y1%3D%220%25%22%20y2%3D%22100%25%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20offset%3D%220%25%22%20stop-color%3D%22%232A318C%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20offset%3D%22100%25%22%20stop-color%3D%22%231D225F%22%2F%3E%20%20%20%20%20%20%20%20%3C%2FlinearGradient%3E%20%20%20%20%20%20%20%20%3ClinearGradient%20id%3D%22mdhg2gjypd%22%20x1%3D%2250%25%22%20x2%3D%2250%25%22%20y1%3D%220%25%22%20y2%3D%22100%25%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20offset%3D%220%25%22%20stop-color%3D%22%23EEE%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20offset%3D%22100%25%22%20stop-color%3D%22%23D6D7D8%22%2F%3E%20%20%20%20%20%20%20%20%3C%2FlinearGradient%3E%20%20%20%20%20%20%20%20%3ClinearGradient%20id%3D%22xe2mx0bk0e%22%20x1%3D%220%25%22%20x2%3D%22100%25%22%20y1%3D%2218%25%22%20y2%3D%2282%25%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20offset%3D%220%25%22%20stop-color%3D%22%23E8B73F%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20offset%3D%22100%25%22%20stop-color%3D%22%23CF9F36%22%2F%3E%20%20%20%20%20%20%20%20%3C%2FlinearGradient%3E%20%20%20%20%20%20%20%20%3Cpath%20id%3D%2288gkjk6cca%22%20d%3D%22M0%200H250V200H0z%22%2F%3E%20%20%20%20%3C%2Fdefs%3E%20%20%20%20%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%20%20%20%20%20%20%20%20%3Cg%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20transform%3D%22translate%28-590%20-308%29%20translate%28590%20308%29%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cmask%20id%3D%22pitr2853ub%22%20fill%3D%22%23fff%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cuse%20xlink%3Ahref%3D%22%2388gkjk6cca%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fmask%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20mask%3D%22url%28%23pitr2853ub%29%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23FFF%22%20fill-rule%3D%22nonzero%22%20d%3D%22M47.646%200c2.598%200%205.717%201.017%207.994%202.74%202.276%201.722%203.845%203.02%204.55%205.097.465%201.372.252%203.282-.641%205.728l.008-.072c-.013.145-.039.269-.071.387.574-1.048%201.638-1.624%202.576-1.283%201.07.39%201.5%201.803%201.013%203.14-.487%201.337-1.723%202.144-2.794%201.754-.536-.195-.91-.646-1.09-1.216.023.975.09%202.117.203%203.427l-2.317.161c-2.223%202.412-4.574%203.48-7.055%203.207-.6-.067-1.158-.18-1.675-.339-.588%201.007-1.177%202.688-1.766%205.043l-.064.031.005-.043c-.585%205.627-1.014%2011.07-1.287%2016.327l.001-.108c-.013.958-.003%201.853.028%202.684l.109-1.533c2.141%201.735%204.344%202.776%206.608%203.123%202.263.348%205.76-.128%2010.49-1.426%202.808-.962%205.555-2.299%208.243-4.011H63.94l16.84-20.83h2.756c0-1.439%201.165-2.604%202.604-2.604%201.378%200%202.506%201.07%202.597%202.425l.006.178h1.736c0-1.438%201.166-2.603%202.604-2.603%201.378%200%202.506%201.07%202.598%202.425l.006.178h5.284L89.832%2035.292c.097-.07.17-.106.212-.106.692%200%20.692%205.306-.057%207.152-.289.865-4.73%205.71-9.864%2010.844-2.78%202.78-6.605%206.366-11.477%2010.759l2.511%2011.858c-.568%201.157-2.01%201.928-4.324%202.314-5.208.579-10.415-1.736-16.78-1.736-1.852%200-3.142.343-4.269.744.841%208.545%202.264%2016.398%204.269%2023.558-1.157%201.157-1.946%201.682-2.808%202.052-1.015.394-2.305.789-3.009.86.776%202.429%201.318%204.584%201.627%206.464.38%202.322%202.518%2022.156%206.411%2059.5h-.044l2.037%201.697c2.308%201.962%2012.796%207.547%2014.132%208.307.891.506%202.067%201.794%203.526%203.864-16.575-.025-27.78-.05-33.613-.075l.053.075C12.788%20183.385%200%20183.346%200%20183.308c0-.116%201.154-3.288%202.538-7.095l2.44-6.658H1.761c-.4-1.385-.792-3.254-1.175-5.606-.75-4.788-.18-7.96%203.05-14.536%203.23-6.518%204.866-10.072%204.866-13.764.058-5.768%201.222-11.316%204.28-17.315%202.364-4.73%203.495-5.086%203.725-7.97l.367-5.421c-2.382-.231-5.928-.988-8.045-1.693l-4.21-1.385-.116-4.326C4.214%2085.6%205.08%2076.89%207.79%2065.757%2011.482%2050.47%2022.096%2034.84%2034.959%2025.668c3.055-2.203%204.272-3.049%205.093-2.807.79-.548%201.483-1.096%202.077-1.645-1.685-.52-3.275-1.222-4.77-2.105-2.311-1.366-4.444-3.194-6.398-5.483.397-.834.904-1.524%201.522-2.07.671-.592%201.935-1.108%203.169-1.822l-.065.021-1.204.401c-1.26.424-1.956.713-2.396%201.032-.829.601-1.259%201.275-1.312%202.032l-.005.191-.579.007c-.012-1.039.516-1.943%201.557-2.699.427-.31%201.013-.573%201.983-.916l1.755-.59.612-.213c.593-.213%201.063-.401%201.438-.584%201.296-1.399%202.17-3.971%204.089-5.678C43.642.855%2045.048%200%2047.646%200zM27.999%20144.476l-.189.512c-2.603%207.055-5.679%2015.219-9.228%2024.493l2.126%201.771c2.307%201.962%2012.795%207.547%2014.132%208.307l.035.021c.364-1.006.782-2.154%201.223-3.367l2.44-6.658h-4.242c-1.444-2.617-2.166-4.456-2.166-5.517%200-1.59.913-3.77.913-6.068%200-1.393-1.68-5.89-5.044-13.494zM78.827%2042.819l-1.242-.001c-2.375%202.17-3.972%203.706-4.791%204.61-.72.793-2.112%202.23-4.176%204.309%203.033-1.194%205.06-2.078%206.083-2.65%201.5-.865%202.077-1.673%203.807-5.307.082-.163.192-.506.319-.961zm7.313-22.857c-1.119%200-2.026.907-2.026%202.025h4.05c0-1.118-.906-2.025-2.024-2.025zm6.943%200c-1.119%200-2.025.907-2.025%202.025h4.05c0-1.118-.907-2.025-2.025-2.025zm-33.27-5.413c-.388%201.066-.065%202.132.666%202.398.73.266%201.664-.343%202.052-1.408.388-1.065.064-2.132-.667-2.398-.73-.266-1.664.343-2.052%201.408z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%2380AEF2%22%20fill-rule%3D%22nonzero%22%20d%3D%22M36.56%20183.308c0-.116%201.153-3.288%202.538-7.095l2.538-6.922%206.46-.173%206.403-.173%202.768%202.307c2.308%201.962%2012.796%207.547%2014.132%208.307.891.506%202.067%201.794%203.526%203.864-25.577-.038-38.365-.077-38.365-.115z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%2394BBF8%22%20fill-rule%3D%22nonzero%22%20d%3D%22M3%20183.308c0-.116%201.154-3.288%202.538-7.095l2.538-6.922%206.46-.173%206.403-.173%202.769%202.307c2.307%201.962%2012.795%207.547%2014.132%208.307.89.506%202.066%201.794%203.525%203.864C15.788%20183.385%203%20183.346%203%20183.308z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%231D225F%22%20fill-rule%3D%22nonzero%22%20d%3D%22M46.655%20101.836c1.09%203.158%201.826%205.898%202.208%208.22.38%202.321%202.518%2022.155%206.411%2059.5H37.296c-1.444-2.618-2.166-4.457-2.166-5.518%200-1.59.913-3.77.913-6.068%200-1.532-2.034-6.823-6.104-15.871l3.931-39.349%2012.785-.914z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22url%28%23ho9etwod5c%29%22%20d%3D%22M21.554%20169.555H4.76c-.4-1.385-.792-3.254-1.175-5.606-.75-4.788-.18-7.96%203.05-14.536%203.23-6.518%204.866-10.072%204.866-13.764.058-5.768%201.222-11.316%204.28-17.315%202.364-4.73%203.495-5.086%203.725-7.97l.42-6.202h21.078c.512%201.433.696%204.075.55%207.925-.145%203.85-6.812%2023.006-20.001%2057.468z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20fill-rule%3D%22nonzero%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%2398BDF9%22%20d%3D%22M0%2024.302L16.84%203.472%2037.031%203.472%2019.592%2024.302z%22%20transform%3D%22translate%2829%208%29%20translate%2866.94%2018.516%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%232174DB%22%20d%3D%22M22.2.868c1.378%200%202.506%201.07%202.597%202.425l.006.179h-.578c0-1.119-.907-2.025-2.025-2.025-1.119%200-2.025.906-2.025%202.025%200%201.062.818%201.934%201.859%202.018l.166.007v.578c-1.438%200-2.604-1.165-2.604-2.603%200-1.438%201.166-2.604%202.604-2.604zM29.143.868c1.378%200%202.506%201.07%202.598%202.425l.006.179h-.579c0-1.119-.906-2.025-2.025-2.025-1.118%200-2.025.906-2.025%202.025%200%201.062.818%201.934%201.859%202.018l.166.007v.578c-1.438%200-2.604-1.165-2.604-2.603%200-1.438%201.166-2.604%202.604-2.604z%22%20transform%3D%22translate%2829%208%29%20translate%2866.94%2018.516%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23F3A29D%22%20fill-rule%3D%22nonzero%22%20d%3D%22M65.472%2046.829c2.807-.962%205.554-2.299%208.242-4.011h6.871c-2.375%202.17-3.972%203.706-4.791%204.61-.82.903-2.509%202.638-5.068%205.205-1.091%205.781-2.254%208.21-3.487%207.285-1.85-1.386-7.939-10.897-1.767-13.09z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23FAB6AF%22%20fill-rule%3D%22nonzero%22%20d%3D%22M69.254%2052.654c4.363-1.668%207.179-2.857%208.447-3.567%201.5-.865%202.077-1.673%203.807-5.307.23-.461.692-2.365%201.096-4.153.923-4.557%202.423-4.326%202.538.346.058%201.27.346%202.423.692%202.538.288.116%201.961-1.5%203.634-3.576%201.673-2.077%203.288-3.75%203.576-3.75.692%200%20.692%205.307-.057%207.153-.289.865-4.73%205.71-9.864%2010.844-3.422%203.423-8.431%208.068-15.026%2013.937l1.157-14.465z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23F3A29D%22%20fill-rule%3D%22nonzero%22%20d%3D%22M49.581%2027.774c.772-3.086%201.543-5.015%202.315-5.787-1.157-1.157-2.315-2.314-4.63-3.471-.77%201.543-2.314%203.086-4.628%204.629%200%202.314.771%203.857%202.314%204.629%201.543.771%203.086.771%204.63%200z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22url%28%23mdhg2gjypd%29%22%20fill-rule%3D%22nonzero%22%20d%3D%22M12.858%2082.16c-2.365-.174-6.23-.981-8.48-1.731l-4.21-1.385-.115-4.326c-.289-11.94.577-20.65%203.288-31.782C7.032%2027.65%2017.646%2012.019%2030.509%202.847c4.96-3.576%205.076-3.576%206.518-1.153.634%201.153%201.96%202.307%202.884%202.653l2.161.594c-3.046%2029.324-1.87%2053.63%203.531%2072.917-1.157%201.158-1.946%201.682-2.808%202.052-1.039.403-2.365.807-3.057.865-.693.058-3%20.519-5.25%201.038-4.21.923-13.382%201.096-21.63.346z%22%20transform%3D%22translate%2829%208%29%20translate%287.45%2022.82%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23D6D7D8%22%20d%3D%22M58.022%2024.008l1.767%2011.311-19.972%202.645%201.106-15.653c2.141%201.735%204.344%202.776%206.608%203.123%202.263.348%205.76-.128%2010.49-1.426z%22%20transform%3D%22translate%2829%208%29%20translate%287.45%2022.82%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23E9E9E9%22%20fill-rule%3D%22nonzero%22%20d%3D%22M61.804%2029.833l4.903%2023.145c-.568%201.157-2.01%201.929-4.324%202.314-5.208.579-10.415-1.736-16.78-1.736-6.365%200-6.09%204.05-15.348.58-6.172-2.315-8.68-12.73-7.523-31.246l18.054-1.73c-.078%205.782.655%209.252%202.198%2010.409%201.512%201.134%207.569.601%2018.17-1.6l.65-.136z%22%20transform%3D%22translate%2829%208%29%20translate%287.45%2022.82%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23FAB6AF%22%20fill-rule%3D%22nonzero%22%20d%3D%22M29.082%207.444c1.07%201.52%201.488%203.536%201.253%206.049-.062.656-.376.883-.376%202.052%200%201.12.07%202.506.212%204.157l-2.317.161c-2.222%202.412-4.574%203.48-7.055%203.207-2.48-.275-4.251-1.343-5.31-3.207-2.18-4.023-1.621-7.444%201.675-10.262%203.296-2.818%207.269-3.537%2011.918-2.157z%22%20transform%3D%22translate%2829%208%29%20translate%2832.223%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23E94A47%22%20d%3D%22M18.423%200c2.598%200%205.717%201.017%207.994%202.74%202.277%201.722%203.845%203.02%204.55%205.097.47%201.384.248%203.314-.664%205.791.13-2.345-.048-3.647-.533-3.906-.67%201.653-1.595%201.987-2.703%202.787-.62.448-2.791.518-4.917.897-2.628%201.722-4.303%203.33-4.867%204.86-.448%201.218-.402%202.608.148%204.177l.126.339-.54.21c-.714-1.833-.81-3.478-.277-4.925.522-1.417%201.85-2.838%203.894-4.321-1.09.307-2.051.754-2.634%201.449-1.279%201.526-2.028%203.765-2.246%206.716-2.766-.5-5.305-1.433-7.617-2.8-2.312-1.366-4.445-3.194-6.398-5.483.396-.834.904-1.524%201.521-2.07.671-.592%201.935-1.108%203.169-1.822l-.065.021-1.204.401c-1.26.424-1.956.713-2.395%201.032-.83.601-1.26%201.275-1.313%202.032l-.005.191-.579.007c-.012-1.039.516-1.943%201.557-2.699.427-.31%201.013-.573%201.983-.916l1.756-.59.61-.213c.594-.213%201.064-.401%201.439-.584%201.296-1.399%202.17-3.971%204.09-5.678C14.418.855%2015.825%200%2018.422%200z%22%20transform%3D%22translate%2829%208%29%20translate%2832.223%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20fill%3D%22%23222768%22%20fill-rule%3D%22nonzero%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M1.025%203.16C1.622%201.52%203.194.563%204.56%201.06c1.061.386%201.653%201.524%201.586%202.781.36-.092.688-.137.988-.137l.208.008c.254.02.466.056.636.114.511-1.271%201.708-2.023%202.749-1.644%201.07.39%201.5%201.802%201.013%203.14-.487%201.337-1.723%202.143-2.794%201.754-.953-.347-1.397-1.504-1.14-2.697-.103-.038-.274-.072-.508-.09-.334-.025-.737.029-1.209.165l-.03.01c-.036.159-.083.318-.14.477-.597%201.64-2.17%202.597-3.536%202.1C1.017%206.543.428%204.8%201.025%203.16zm9.504-.434c-.73-.266-1.664.343-2.052%201.408-.388%201.065-.064%202.132.667%202.398.73.266%201.664-.343%202.052-1.408.387-1.066.064-2.132-.667-2.398zM4.362%201.604c-1.036-.378-2.297.39-2.793%201.754-.496%201.363-.024%202.762%201.012%203.14%201.036.376%202.298-.392%202.794-1.755s.023-2.762-1.013-3.14z%22%20transform%3D%22translate%2829%208%29%20translate%2832.223%29%20translate%2822.112%2010.415%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20mask%3D%22url%28%23pitr2853ub%29%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23FFF%22%20d%3D%22M30%200c12.15%200%2022%209.85%2022%2022v11h8v48H0V33h8V22C8%209.973%2017.654.198%2029.637.004zm0%207.934c-7.755%200-14.067%206.309-14.067%2014.067V33h28.133V22c0-7.652-6.14-13.896-13.752-14.063z%22%20transform%3D%22translate%28134%2061%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23D6D7D8%22%20d%3D%22M55%2034.3V22C55%209.85%2045.15%200%2033%200S11%209.85%2011%2022v12.3m7.933%200V22c0-7.757%206.312-14.066%2014.068-14.066%207.756%200%2014.065%206.31%2014.065%2014.067v12.298%22%20transform%3D%22translate%28134%2061%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22url%28%23xe2mx0bk0e%29%22%20d%3D%22M3%2033H63V81H3z%22%20transform%3D%22translate%28134%2061%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%233E3D4C%22%20fill-rule%3D%22nonzero%22%20d%3D%22M39%2056c0-3.314-2.686-6-6-6s-6%202.686-6%206c0%202.282%201.275%204.267%203.15%205.281l-.965%207.386h7.63l-.965-7.386C37.726%2060.267%2039%2058.282%2039%2056z%22%20transform%3D%22translate%28134%2061%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%3C%2Fg%3E%3C%2Fsvg%3E",alt:"Not Authorized"})}),t(q.Title,{children:t("h3",x({className:"title"},{children:"Not authorized"}))}),t(q.Subtitle,{children:this.props.subtitle?this.props.subtitle:"Looks like you don't have access to information on this page. Please contact your manager to request access."})]})},r}(p);const Pt=Object.prototype.toString;function It(t){return function(t,e){return Pt.call(t)===`[object ${e}]`}(t,"Object")}function Bt(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function zt(t){return t&&t.Math==Math?t:void 0}const jt="object"==typeof globalThis&&zt(globalThis)||"object"==typeof window&&zt(window)||"object"==typeof self&&zt(self)||"object"==typeof global&&zt(global)||function(){return this}()||{};function Ut(t,e,n){const r=n||jt,s=r.__SENTRY__=r.__SENTRY__||{};return s[t]||(s[t]=e())}const qt=["debug","info","warn","error","log","assert","trace"];function Ht(t){if(!("console"in jt))return t();const e=jt.console,n={};qt.forEach((t=>{const r=e[t]&&e[t].__sentry_original__;t in e&&r&&(n[t]=e[t],e[t]=r)}));try{return t()}finally{Object.keys(n).forEach((t=>{e[t]=n[t]}))}}function Gt(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1}};return"undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__?qt.forEach((n=>{e[n]=(...e)=>{t&&Ht((()=>{jt.console[n](`Sentry Logger [${n}]:`,...e)}))}})):qt.forEach((t=>{e[t]=()=>{}})),e}let Wt;function Yt(t){return Vt(t,new Map)}function Vt(t,e){if(It(t)){const n=e.get(t);if(void 0!==n)return n;const r={};e.set(t,r);for(const n of Object.keys(t))void 0!==t[n]&&(r[n]=Vt(t[n],e));return r}if(Array.isArray(t)){const n=e.get(t);if(void 0!==n)return n;const r=[];return e.set(t,r),t.forEach((t=>{r.push(Vt(t,e))})),r}return t}function $t(){const t=jt,e=t.crypto||t.msCrypto;if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");const n=e&&e.getRandomValues?()=>e.getRandomValues(new Uint8Array(1))[0]:()=>16*Math.random();return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(t=>(t^(15&n())>>t/4).toString(16)))}function Qt(){return!("undefined"!=typeof __SENTRY_BROWSER_BUNDLE__&&__SENTRY_BROWSER_BUNDLE__)&&"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)}var Jt;Wt="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__?Ut("logger",Gt):Gt(),function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(Jt||(Jt={}));class Xt{__init(){this._state=Jt.PENDING}__init2(){this._handlers=[]}constructor(t){Xt.prototype.__init.call(this),Xt.prototype.__init2.call(this),Xt.prototype.__init3.call(this),Xt.prototype.__init4.call(this),Xt.prototype.__init5.call(this),Xt.prototype.__init6.call(this);try{t(this._resolve,this._reject)}catch(t){this._reject(t)}}then(t,e){return new Xt(((n,r)=>{this._handlers.push([!1,e=>{if(t)try{n(t(e))}catch(t){r(t)}else n(e)},t=>{if(e)try{n(e(t))}catch(t){r(t)}else r(t)}]),this._executeHandlers()}))}catch(t){return this.then((t=>t),t)}finally(t){return new Xt(((e,n)=>{let r,s;return this.then((e=>{s=!1,r=e,t&&t()}),(e=>{s=!0,r=e,t&&t()})).then((()=>{s?n(r):e(r)}))}))}__init3(){this._resolve=t=>{this._setResult(Jt.RESOLVED,t)}}__init4(){this._reject=t=>{this._setResult(Jt.REJECTED,t)}}__init5(){this._setResult=(t,e)=>{this._state===Jt.PENDING&&(Bt(e)?e.then(this._resolve,this._reject):(this._state=t,this._value=e,this._executeHandlers()))}}__init6(){this._executeHandlers=()=>{if(this._state===Jt.PENDING)return;const t=this._handlers.slice();this._handlers=[],t.forEach((t=>{t[0]||(this._state===Jt.RESOLVED&&t[1](this._value),this._state===Jt.REJECTED&&t[2](this._value),t[0]=!0)}))}}}const Kt=jt,Zt={nowSeconds:()=>Date.now()/1e3};const te=Qt()?function(){try{return(t=module,e="perf_hooks",t.require(e)).performance}catch(t){return}var t,e}():function(){const{performance:t}=Kt;if(!t||!t.now)return;return{now:()=>t.now(),timeOrigin:Date.now()-t.now()}}(),ee=void 0===te?Zt:{nowSeconds:()=>(te.timeOrigin+te.now())/1e3},ne=Zt.nowSeconds.bind(Zt),re=ee.nowSeconds.bind(ee);function se(t){const e=re(),n={sid:$t(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return Yt({sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}})}(n)};return t&&oe(n,t),n}function oe(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),t.did||e.did||(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||re(),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=32===e.sid.length?e.sid:$t()),void 0!==e.init&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),"number"==typeof e.started&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof e.duration)t.duration=e.duration;else{const e=t.timestamp-t.started;t.duration=e>=0?e:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),"number"==typeof e.errors&&(t.errors=e.errors),e.status&&(t.status=e.status)}(()=>{const{performance:t}=Kt;if(!t||!t.now)return;const e=36e5,n=t.now(),r=Date.now(),s=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,o=s<e,i=t.timing&&t.timing.navigationStart,a="number"==typeof i?Math.abs(i+n-r):e;(o||a<e)&&(s<=a&&t.timeOrigin)})();class ie{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={}}static clone(t){const e=new ie;return t&&(e._breadcrumbs=[...t._breadcrumbs],e._tags={...t._tags},e._extra={...t._extra},e._contexts={...t._contexts},e._user=t._user,e._level=t._level,e._span=t._span,e._session=t._session,e._transactionName=t._transactionName,e._fingerprint=t._fingerprint,e._eventProcessors=[...t._eventProcessors],e._requestSession=t._requestSession,e._attachments=[...t._attachments],e._sdkProcessingMetadata={...t._sdkProcessingMetadata}),e}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{},this._session&&oe(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,e){return this._tags={...this._tags,[t]:e},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,e){return this._extra={...this._extra,[t]:e},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,e){return null===e?delete this._contexts[t]:this._contexts[t]=e,this._notifyScopeListeners(),this}setSpan(t){return this._span=t,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const t=this.getSpan();return t&&t.transaction}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;if("function"==typeof t){const e=t(this);return e instanceof ie?e:this}return t instanceof ie?(this._tags={...this._tags,...t._tags},this._extra={...this._extra,...t._extra},this._contexts={...this._contexts,...t._contexts},t._user&&Object.keys(t._user).length&&(this._user=t._user),t._level&&(this._level=t._level),t._fingerprint&&(this._fingerprint=t._fingerprint),t._requestSession&&(this._requestSession=t._requestSession)):It(t)&&(this._tags={...this._tags,...t.tags},this._extra={...this._extra,...t.extra},this._contexts={...this._contexts,...t.contexts},t.user&&(this._user=t.user),t.level&&(this._level=t.level),t.fingerprint&&(this._fingerprint=t.fingerprint),t.requestSession&&(this._requestSession=t.requestSession)),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this}addBreadcrumb(t,e){const n="number"==typeof e?e:100;if(n<=0)return this;const r={timestamp:ne(),...t};return this._breadcrumbs=[...this._breadcrumbs,r].slice(-n),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}getAttachments(){return this._attachments}clearAttachments(){return this._attachments=[],this}applyToEvent(t,e={}){if(this._extra&&Object.keys(this._extra).length&&(t.extra={...this._extra,...t.extra}),this._tags&&Object.keys(this._tags).length&&(t.tags={...this._tags,...t.tags}),this._user&&Object.keys(this._user).length&&(t.user={...this._user,...t.user}),this._contexts&&Object.keys(this._contexts).length&&(t.contexts={...this._contexts,...t.contexts}),this._level&&(t.level=this._level),this._transactionName&&(t.transaction=this._transactionName),this._span){t.contexts={trace:this._span.getTraceContext(),...t.contexts};const e=this._span.transaction&&this._span.transaction.name;e&&(t.tags={transaction:e,...t.tags})}return this._applyFingerprint(t),t.breadcrumbs=[...t.breadcrumbs||[],...this._breadcrumbs],t.breadcrumbs=t.breadcrumbs.length>0?t.breadcrumbs:void 0,t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...this._sdkProcessingMetadata},this._notifyEventProcessors([...Ut("globalEventProcessors",(()=>[])),...this._eventProcessors],t,e)}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...t},this}_notifyEventProcessors(t,e,n,r=0){return new Xt(((s,o)=>{const i=t[r];if(null===e||"function"!=typeof i)s(e);else{const a=i({...e},n);("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&i.id&&null===a&&Wt.log(`Event processor "${i.id}" dropped event`),Bt(a)?a.then((e=>this._notifyEventProcessors(t,e,n,r+1).then(s))).then(null,o):this._notifyEventProcessors(t,a,n,r+1).then(s).then(null,o)}}))}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((t=>{t(this)})),this._notifyingListeners=!1)}_applyFingerprint(t){var e;t.fingerprint=t.fingerprint?(e=t.fingerprint,Array.isArray(e)?e:[e]):[],this._fingerprint&&(t.fingerprint=t.fingerprint.concat(this._fingerprint)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}}const ae=100;class ce{__init(){this._stack=[{}]}constructor(t,e=new ie,n=4){this._version=n,ce.prototype.__init.call(this),this.getStackTop().scope=e,t&&this.bindClient(t)}isOlderThan(t){return this._version<t}bindClient(t){this.getStackTop().client=t,t&&t.setupIntegrations&&t.setupIntegrations()}pushScope(){const t=ie.clone(this.getScope());return this.getStack().push({client:this.getClient(),scope:t}),t}popScope(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}withScope(t){const e=this.pushScope();try{t(e)}finally{this.popScope()}}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(t,e){const n=this._lastEventId=e&&e.event_id?e.event_id:$t(),r=new Error("Sentry syntheticException");return this._withClient(((s,o)=>{s.captureException(t,{originalException:t,syntheticException:r,...e,event_id:n},o)})),n}captureMessage(t,e,n){const r=this._lastEventId=n&&n.event_id?n.event_id:$t(),s=new Error(t);return this._withClient(((o,i)=>{o.captureMessage(t,e,{originalException:t,syntheticException:s,...n,event_id:r},i)})),r}captureEvent(t,e){const n=e&&e.event_id?e.event_id:$t();return t.type||(this._lastEventId=n),this._withClient(((r,s)=>{r.captureEvent(t,{...e,event_id:n},s)})),n}lastEventId(){return this._lastEventId}addBreadcrumb(t,e){const{scope:n,client:r}=this.getStackTop();if(!n||!r)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:o=ae}=r.getOptions&&r.getOptions()||{};if(o<=0)return;const i={timestamp:ne(),...t},a=s?Ht((()=>s(i,e))):i;null!==a&&n.addBreadcrumb(a,o)}setUser(t){const e=this.getScope();e&&e.setUser(t)}setTags(t){const e=this.getScope();e&&e.setTags(t)}setExtras(t){const e=this.getScope();e&&e.setExtras(t)}setTag(t,e){const n=this.getScope();n&&n.setTag(t,e)}setExtra(t,e){const n=this.getScope();n&&n.setExtra(t,e)}setContext(t,e){const n=this.getScope();n&&n.setContext(t,e)}configureScope(t){const{scope:e,client:n}=this.getStackTop();e&&n&&t(e)}run(t){const e=ue(this);try{t(this)}finally{ue(e)}}getIntegration(t){const e=this.getClient();if(!e)return null;try{return e.getIntegration(t)}catch(e){return("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&Wt.warn(`Cannot retrieve integration ${t.id} from the current Hub`),null}}startTransaction(t,e){return this._callExtensionMethod("startTransaction",t,e)}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(t=!1){if(t)return this.endSession();this._sendSessionUpdate()}endSession(){const t=this.getStackTop(),e=t&&t.scope,n=e&&e.getSession();n&&function(t,e){let n={};e?n={status:e}:"ok"===t.status&&(n={status:"exited"}),oe(t,n)}(n),this._sendSessionUpdate(),e&&e.setSession()}startSession(t){const{scope:e,client:n}=this.getStackTop(),{release:r,environment:s}=n&&n.getOptions()||{},{userAgent:o}=jt.navigator||{},i=se({release:r,environment:s,...e&&{user:e.getUser()},...o&&{userAgent:o},...t});if(e){const t=e.getSession&&e.getSession();t&&"ok"===t.status&&oe(t,{status:"exited"}),this.endSession(),e.setSession(i)}return i}shouldSendDefaultPii(){const t=this.getClient(),e=t&&t.getOptions();return Boolean(e&&e.sendDefaultPii)}_sendSessionUpdate(){const{scope:t,client:e}=this.getStackTop();if(!t)return;const n=t.getSession();n&&e&&e.captureSession&&e.captureSession(n)}_withClient(t){const{scope:e,client:n}=this.getStackTop();n&&t(n,e)}_callExtensionMethod(t,...e){const n=le().__SENTRY__;if(n&&n.extensions&&"function"==typeof n.extensions[t])return n.extensions[t].apply(this,e);("undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__)&&Wt.warn(`Extension method ${t} couldn't be found, doing nothing.`)}}function le(){return jt.__SENTRY__=jt.__SENTRY__||{extensions:{},hub:void 0},jt}function ue(t){const e=le(),n=pe(e);return fe(e,t),n}function de(){const t=le();return he(t)&&!pe(t).isOlderThan(4)||fe(t,new ce),Qt()?function(t){try{const e=le().__SENTRY__,n=e&&e.extensions&&e.extensions.domain&&e.extensions.domain.active;if(!n)return pe(t);if(!he(n)||pe(n).isOlderThan(4)){const e=pe(t).getStackTop();fe(n,new ce(e.client,ie.clone(e.scope)))}return pe(n)}catch(e){return pe(t)}}(t):pe(t)}function he(t){return!!(t&&t.__SENTRY__&&t.__SENTRY__.hub)}function pe(t){return Ut("hub",(()=>new ce),t)}function fe(t,e){if(!t)return!1;return(t.__SENTRY__=t.__SENTRY__||{}).hub=e,!0}function me(t,e,n){var r,s;void 0===e&&(e=!0),void 0===n&&(n=!1),t instanceof F&&Array.isArray(t.errors)?t.errors.map((function(e){var r=e.userMessage,s=e.internalMessage;403===t.code&&"unauthorized"===r?n||Rt():Nt.error(r||s)})):(403!==t.code&&408!==t.code&&(r=t,de().captureException(r,{captureContext:s})),e&&(t.message?Nt.error(t.message):Nt.error("Some Error Occurred")))}var ge=function(e){var r=e.condition,s=e.wrap,o=e.children;return r?s(o):t(n,{children:o})};function ve(n){var r=n.pageLoader,s=n.size,o=n.theme,i=n.styles,a=s?"".concat(s,"px"):r?"48px":"20px";return t("div",x({className:"loader ".concat(o||"default","-background"),style:i},{children:t("div",x({style:{width:a,height:a}},{children:t("svg",x({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"loader__svg"},{children:e("g",x({fill:"none",fillRule:"evenodd",strokeLinecap:"round"},{children:[t("animateTransform",{attributeName:"transform",attributeType:"XML",dur:"0.5s",from:"0 12 12",repeatCount:"indefinite",to:"360 12 12",type:"rotate"}),t("path",{fill:"#06C",fillRule:"nonzero",d:"M12 2.5A9.5 9.5 0 1 1 2.5 12a1.5 1.5 0 0 1 3 0A6.5 6.5 0 1 0 12 5.5a1.5 1.5 0 0 1 0-3z"})]}))}))}))}))}function _e(n){var r=n.loadingText,s=n.size,o=void 0===s?24:s,i=n.fullHeight,a=void 0!==i&&i,c=n.children,l=n.styles;return e("div",x({className:"details-loader bcn-0 flex column fs-14 fw-6 ".concat(a?"h-100":"details-loader-height"),style:l},{children:[t("span",x({style:{width:"".concat(o,"px"),height:"".concat(o,"px")}},{children:t(ve,{size:o})})),r&&t("span",x({className:"mt-10"},{children:r})),c]}))}var ye=function(e){function n(t){var n=e.call(this,t)||this;return n.modalRef=document.getElementById("visible-modal"),n.escFunction=n.escFunction.bind(n),n}return D(n,e),n.prototype.escFunction=function(t){27!==t.keyCode&&"Escape"!==t.key||(this.props.onEscape?this.props.onEscape(t):this.props.close&&this.props.close(t))},n.prototype.componentDidMount=function(){document.addEventListener("keydown",this.escFunction),this.modalRef.classList.add(this.props.noBackground?"show":"show-with-bg"),this.props.parentClassName&&this.modalRef.classList.add(this.props.parentClassName)},n.prototype.componentWillUnmount=function(){document.removeEventListener("keydown",this.escFunction),this.modalRef.classList.remove("show"),this.modalRef.classList.remove("show-with-bg"),this.props.parentClassName&&this.modalRef.classList.remove(this.props.parentClassName)},n.prototype.render=function(){var e;return g.createPortal(t("div",x({className:"visible-modal__body ".concat(this.props.className),onClick:null===(e=this.props)||void 0===e?void 0:e.close},{children:this.props.children})),document.getElementById("visible-modal"))},n}(s.Component);B(".drawer {\n position: absolute;\n overflow: hidden;\n}\n.drawer.left, .drawer.right {\n top: 0;\n bottom: 0;\n width: 0;\n transition: width 200ms;\n}\n.drawer.left.show, .drawer.right.show {\n min-width: var(--minWidth);\n width: var(--width);\n max-width: var(--maxWidth);\n}\n.drawer.top, .drawer.bottom {\n left: 0;\n right: 0;\n height: 0;\n transition: height 200ms;\n}\n.drawer.top.show, .drawer.bottom.show {\n height: var(--height);\n}\n.drawer.right {\n right: 0;\n}\n.drawer.left {\n left: 0;\n}\n.drawer.top {\n top: 0;\n}\n.drawer.bottom {\n bottom: 0;\n}");var be=function(e){var n=e.children,r=e.position,s=e.height,o=e.width,a=e.minWidth,l=e.maxWidth,u=e.parentClassName,d=e.onEscape,h=i(null);c((function(){return setTimeout((function(){var t,e;return null===(e=null===(t=h.current)||void 0===t?void 0:t.classList)||void 0===e?void 0:e.add("show")}),1),function(){var t,e;return null===(e=null===(t=h.current)||void 0===t?void 0:t.classList)||void 0===e?void 0:e.remove("show")}}),[]);var p={};return"left"!==r&&"right"!==r||(p["--width"]=o,p["--minWidth"]=a,p["--maxWidth"]=l),"top"!==r&&"bottom"!==r||(p["--height"]=s),t(ye,x({className:"drawer--container",parentClassName:u||"",onEscape:d},{children:t("aside",x({style:p,ref:h,className:"drawer ".concat(r)},{children:n}))}))},Ee=function(e){var n=e.style,r=void 0===n?{}:n,o=e.children,i=e.modal,a=void 0!==i&&i,l=e.rootClassName,u=void 0===l?"":l,d=e.onClick,h=void 0===d?null:d,p=e.callbackRef,f=void 0===p?null:p,m=s.useRef(null);function v(t){"function"==typeof h&&(m&&m.current.contains(t.target)?h(t,"in"):h(t,"out"))}function _(t){m&&m.current.contains(t.target)?m.current.clientHeight===m.current.scrollHeight&&t.preventDefault():t.preventDefault()}return c((function(){document.addEventListener("click",v);var t=document.getElementById("visible-modal");return t&&t.classList.add("show"),document.body.addEventListener("wheel",_,{passive:!1}),function(){document.body.removeEventListener("wheel",_),document.removeEventListener("click",v),t&&t.classList.remove("show")}}),[]),g.createPortal(t("div",x({tabIndex:0,onClick:h,ref:function(t){"function"==typeof f&&f(t),m.current=t},id:"popup",className:"".concat(u," popup ").concat(a?"modal":""),style:x({},r)},{children:o})),document.getElementById("visible-modal"))},we=function(n){function r(){var t=null!==n&&n.apply(this,arguments)||this;return t.modalRef=document.getElementById("full-screen-modal"),t}return D(r,n),r.prototype.componentDidMount=function(){this.props.noBackground?this.modalRef.classList.add("show"):this.modalRef.classList.add("show-with-bg")},r.prototype.componentWillUnmount=function(){this.modalRef.classList.remove("show"),this.modalRef.classList.remove("show-with-bg")},r.prototype.render=function(){var n=x({},this.props),r=n.className,s=void 0===r?"":r,o=n.onHide,i=void 0===o?null:o;return g.createPortal(e("div",x({className:"full-screen-modal__body-container ".concat(s)},{children:[this.props.children,"function"==typeof i&&t("div",x({className:"close-btn icon-dim-24",onClick:function(t){return i(!1)}},{children:t("img",{className:"close-img",src:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%20%20%20%20%3Cdefs%3E%20%20%20%20%20%20%20%20%3Cpath%20id%3D%22a%22%20class%3D%22stroke-color%22%20d%3D%22M18.295%205.705a.997.997%200%200%200-1.41%200L12%2010.59%207.115%205.705a.997.997%200%201%200-1.41%201.41L10.59%2012l-4.885%204.885a.997.997%200%201%200%201.41%201.41L12%2013.41l4.885%204.885a.997.997%200%200%200%201.41-1.41L13.41%2012l4.885-4.885a.997.997%200%200%200%200-1.41z%22%2F%3E%20%20%20%20%3C%2Fdefs%3E%20%20%20%20%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22%22%2F%3E%20%20%20%20%20%20%20%20%3Cuse%20fill%3D%22%23999%22%20xlink%3Ahref%3D%22%23a%22%2F%3E%20%20%20%20%3C%2Fg%3E%3C%2Fsvg%3E",alt:"close"})}))]})),document.getElementById("full-screen-modal"))},r}(s.Component),Ce=function(e){function n(t){var n=e.call(this,t)||this;return n.modalRef=document.getElementById("visible-modal-2"),n.escFunction=n.escFunction.bind(n),n}return D(n,e),n.prototype.escFunction=function(t){27===t.keyCode&&this.props.close&&this.props.close(t)},n.prototype.componentDidMount=function(){document.addEventListener("keydown",this.escFunction),this.modalRef.classList.add("show-with-bg")},n.prototype.componentWillUnmount=function(){document.removeEventListener("keydown",this.escFunction),this.modalRef.classList.remove("show-with-bg")},n.prototype.render=function(){var e;return g.createPortal(t("div",x({className:"visible-modal__body ".concat(this.props.className),onClick:null===(e=this.props)||void 0===e?void 0:e.close},{children:this.props.children})),document.getElementById("visible-modal-2"))},n}(s.Component),De={alias:{}},xe=function(e){var n=e.children,r=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,s,o=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(t){s={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(s)throw s.error}}return i}(u(De),2),s=r[0],o=r[1];return t(Te.Provider,x({value:{state:s,setState:o}},{children:n}))},Te=f({state:{alias:{}},setState:null});function Se(t,e){var n=(null==t?void 0:t.sep)||"/";e=e||[];var r=_(),o=r.url,i=r.path,a=y(),l=function(){var t=s.useContext(Te);if(!t)throw new Error("breadcrumb components cannot be used outside Breadcrumb context");return t}(),u=l.state,d=l.setState;function h(t){var e=t.reduce((function(t,e,n){return delete t[e],t}),u.alias);d((function(t){return x(x({},t),{alias:e})}))}c((function(){if(t&&t.alias)return d((function(e){return x(x({},e),{alias:x(x({},e.alias),t.alias)})})),function(){return h(Object.keys(t.alias))}}),e);var p=m((function(){var t=i.split("/").filter(Boolean),e=o.split("/").filter(Boolean);return t.map((function(t,n){var r={to:e[n],name:t};return t.startsWith(":")&&a[t.replace(":","")]&&(r.className="param"),r}))}),[i,o]),f=m((function(){return p.reduce((function(t,e,r){var s,o,i,a,c=t.res,l=t.prefix,d=e.to,h=e.name;return c.push({to:!(null===(s=u.alias[h])||void 0===s?void 0:s.component)||(null===(o=u.alias[h])||void 0===o?void 0:o.component)&&(null===(i=u.alias[h])||void 0===i?void 0:i.linked)?"".concat(l).concat(d):null,name:"object"==typeof u.alias[h]?(null===(a=u.alias[h])||void 0===a?void 0:a.component)?u.alias[h].component:null:u.alias[h]||h,className:e.className||""}),{res:c,prefix:"".concat(l).concat(e.to).concat(n)}}),{res:[],prefix:"/"})}),[p,u]).res;return{breadcrumbs:f,setCrumb:function(t){d((function(e){return x(x({},e),{alias:x(x({},e.alias),t)})}))},resetCrumb:h}}s.createContext(null);var Ne=function(n){var r=n.breadcrumbs,o=n.sep,i=void 0===o?"/":o,a=n.className,c=void 0===a?"dc__devtron-breadcrumb__item":a,l=_().url,u=r.filter((function(t){return!!t.name}));return t(s.Fragment,{children:u.map((function(n,r){return e(s.Fragment,{children:[t(ge,x({condition:!!n.to,wrap:function(e){return t(b,x({className:"".concat(l===n.to?"active":""," ").concat(c," ").concat(n.className||""),to:n.to},{children:e}))}},{children:n.name})),r+1!==u.length&&n.name&&t("span",x({className:"".concat(c,"__separator cn-5")},{children:i}))]},r)}))})};export{Ne as BreadCrumb,xe as BreadcrumbStore,ge as ConditionalWrap,_e as DetailsProgressing,be as Drawer,Mt as ErrorScreenManager,At as ErrorScreenNotAuthorized,w as Host,Ee as Modal,we as OpaqueModal,ve as Progressing,E as RequestTimeout,N as ServerError,F as ServerErrors,Ft as ToastBody,kt as ToastBody3,Lt as ToastBodyWithButton,ye as VisibleModal,Ce as VisibleModal2,P as get,M as post,A as put,me as showError,Rt as toastAccessDenied,I as trash,Se as useBreadcrumb};
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default, { createElement, useRef, useLayoutEffect, useEffect, useReducer, useState, isValidElement, cloneElement, Component, createContext, useMemo } from 'react';
|
|
4
|
+
import ReactDOM, { render } from 'react-dom';
|
|
5
|
+
import { useRouteMatch, useParams, Link } from 'react-router-dom';
|
|
6
|
+
|
|
7
|
+
const RequestTimeout = 60000;
|
|
8
|
+
const Host = process.env.REACT_APP_ORCHESTRATOR_ROOT;
|
|
9
|
+
const PATTERNS = {
|
|
10
|
+
KUBERNETES_KEY_PREFIX: /^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/,
|
|
11
|
+
KUBERNETES_KEY_NAME: /^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$/,
|
|
12
|
+
START_END_ALPHANUMERIC: /^([A-Za-z0-9].*[A-Za-z0-9])$|[A-Za-z0-9]$/,
|
|
13
|
+
ALPHANUMERIC_WITH_SPECIAL_CHAR: /^[A-Za-z0-9._-]+$/, // allow alphanumeric,(.) ,(-),(_)
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
class ServerError {
|
|
17
|
+
constructor(error) {
|
|
18
|
+
this.code = error.code || 0;
|
|
19
|
+
this.userMessage = error.userMessage || '';
|
|
20
|
+
this.internalMessage = error.internalMessage || '';
|
|
21
|
+
this.moreInfo = error.moreInfo || '';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
class ServerErrors extends Error {
|
|
25
|
+
constructor(obj) {
|
|
26
|
+
super();
|
|
27
|
+
this.code = obj.code;
|
|
28
|
+
let message = obj.errors.reduce((str, err) => {
|
|
29
|
+
str += `${err.internalMessage || err.userMessage}`;
|
|
30
|
+
return str;
|
|
31
|
+
}, '');
|
|
32
|
+
this.name = `[${obj.code.toString()}]`;
|
|
33
|
+
this.message = message;
|
|
34
|
+
this.errors = obj.errors.map((err) => new ServerError(err));
|
|
35
|
+
Object.setPrototypeOf(this, ServerErrors.prototype);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/******************************************************************************
|
|
40
|
+
Copyright (c) Microsoft Corporation.
|
|
41
|
+
|
|
42
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
43
|
+
purpose with or without fee is hereby granted.
|
|
44
|
+
|
|
45
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
46
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
47
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
48
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
49
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
50
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
51
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
52
|
+
***************************************************************************** */
|
|
53
|
+
|
|
54
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
55
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
56
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
57
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
58
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
59
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
60
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const responseMessages = {
|
|
65
|
+
100: 'Continue',
|
|
66
|
+
101: 'Switching Protocols',
|
|
67
|
+
102: 'Processing(WebDAV)',
|
|
68
|
+
200: 'OK',
|
|
69
|
+
201: 'Created',
|
|
70
|
+
202: 'Accepted',
|
|
71
|
+
203: 'Non - Authoritative Information',
|
|
72
|
+
204: 'No Content',
|
|
73
|
+
205: 'Reset Content',
|
|
74
|
+
206: 'Partial Content',
|
|
75
|
+
207: 'Multi - Status(WebDAV)',
|
|
76
|
+
208: 'Already Reported(WebDAV)',
|
|
77
|
+
226: 'IM Used',
|
|
78
|
+
300: 'Multiple Choices',
|
|
79
|
+
301: 'Moved Permanently',
|
|
80
|
+
302: 'Found',
|
|
81
|
+
303: 'See Other',
|
|
82
|
+
304: 'Not Modified',
|
|
83
|
+
305: 'Use Proxy',
|
|
84
|
+
307: 'Temporary Redirect',
|
|
85
|
+
308: 'Permanent Redirect(experimental)',
|
|
86
|
+
400: 'Bad Request',
|
|
87
|
+
401: 'Unauthorized',
|
|
88
|
+
402: 'Payment Required',
|
|
89
|
+
403: 'Forbidden',
|
|
90
|
+
404: 'Not Found',
|
|
91
|
+
405: 'Method Not Allowed',
|
|
92
|
+
406: 'Not Acceptable',
|
|
93
|
+
407: 'Proxy Authentication Required',
|
|
94
|
+
408: 'Request Timeout',
|
|
95
|
+
409: 'Conflict',
|
|
96
|
+
410: 'Gone',
|
|
97
|
+
411: 'Length Required',
|
|
98
|
+
412: 'Precondition Failed',
|
|
99
|
+
413: 'Request Entity Too Large',
|
|
100
|
+
414: 'Request - URI Too Long',
|
|
101
|
+
415: 'Unsupported Media Type',
|
|
102
|
+
416: 'Requested Range Not Satisfiable',
|
|
103
|
+
417: 'Expectation Failed',
|
|
104
|
+
418: "I'm a teapot",
|
|
105
|
+
420: 'Enhance Your Calm(Twitter)',
|
|
106
|
+
422: 'Unprocessable Entity(WebDAV)',
|
|
107
|
+
423: 'Locked(WebDAV)',
|
|
108
|
+
424: 'Failed Dependency(WebDAV)',
|
|
109
|
+
425: 'Reserved for WebDAV',
|
|
110
|
+
426: 'Upgrade Required',
|
|
111
|
+
428: 'Precondition Required',
|
|
112
|
+
429: 'Too Many Requests',
|
|
113
|
+
431: 'Request Header Fields Too Large',
|
|
114
|
+
444: 'No Response(Nginx)',
|
|
115
|
+
449: 'Retry With(Microsoft)',
|
|
116
|
+
450: 'Blocked by Windows Parental Controls(Microsoft)',
|
|
117
|
+
451: 'Unavailable For Legal Reasons',
|
|
118
|
+
499: 'Client Closed Request(Nginx)',
|
|
119
|
+
500: 'Internal Server Error',
|
|
120
|
+
501: 'Not Implemented',
|
|
121
|
+
502: 'Bad Gateway',
|
|
122
|
+
503: 'Service Unavailable',
|
|
123
|
+
504: 'Gateway Timeout',
|
|
124
|
+
505: 'HTTP Version Not Supported',
|
|
125
|
+
506: 'Variant Also Negotiates(Experimental)',
|
|
126
|
+
507: 'Insufficient Storage(WebDAV)',
|
|
127
|
+
508: 'Loop Detected(WebDAV)',
|
|
128
|
+
509: 'Bandwidth Limit Exceeded(Apache)',
|
|
129
|
+
510: 'Not Extended',
|
|
130
|
+
511: 'Network Authentication Required',
|
|
131
|
+
598: 'Network read timeout error',
|
|
132
|
+
599: 'Network connect timeout error',
|
|
133
|
+
};
|
|
134
|
+
function handleServerError(contentType, response) {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
//Test for HTTP Status Code
|
|
137
|
+
let code = response.status;
|
|
138
|
+
let status = response.statusText || responseMessages[code];
|
|
139
|
+
let serverError = new ServerErrors({ code, errors: [] });
|
|
140
|
+
if (contentType !== 'application/json') {
|
|
141
|
+
//used for better debugging,
|
|
142
|
+
status = `${responseMessages[code]}. Please try again.`;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
const responseBody = yield response.json();
|
|
146
|
+
if (responseBody.errors) {
|
|
147
|
+
serverError.errors = responseBody.errors;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
serverError.errors =
|
|
151
|
+
serverError.errors.length > 0 ? serverError.errors : [{ code, internalMessage: status, userMessage: status }];
|
|
152
|
+
throw serverError;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function fetchAPI(url, type, data, signal, preventAutoLogout = false, isMultipartRequest) {
|
|
156
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
let options = {
|
|
158
|
+
method: type,
|
|
159
|
+
signal,
|
|
160
|
+
body: data ? JSON.stringify(data) : undefined,
|
|
161
|
+
};
|
|
162
|
+
options['credentials'] = 'include';
|
|
163
|
+
return fetch(`${Host}/${url}`, !isMultipartRequest
|
|
164
|
+
? options
|
|
165
|
+
: {
|
|
166
|
+
method: type,
|
|
167
|
+
body: data,
|
|
168
|
+
}).then((response) => __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
let contentType = response.headers.get('Content-Type');
|
|
170
|
+
if (response.status === 401) {
|
|
171
|
+
if (preventAutoLogout) {
|
|
172
|
+
throw new ServerErrors({
|
|
173
|
+
code: 401,
|
|
174
|
+
errors: [
|
|
175
|
+
{ code: 401, internalMessage: 'Please login again', userMessage: 'Please login again' },
|
|
176
|
+
],
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
return { code: 401, status: 'Unauthorized', result: [] };
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else if (response.status >= 300 && response.status <= 599) {
|
|
184
|
+
return yield handleServerError(contentType, response);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
if (contentType === 'application/json') {
|
|
188
|
+
return response.json().then((responseBody) => {
|
|
189
|
+
if (responseBody.code >= 300 && responseBody.code <= 599) {
|
|
190
|
+
//Test Code in Response Body, despite successful HTTP Response Code
|
|
191
|
+
throw new ServerErrors({ code: responseBody.code, errors: responseBody.errors });
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
//Successfull Response. Expected Response Type {code, result, status}
|
|
195
|
+
return responseBody;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
else if (contentType === 'octet-stream' || contentType === 'application/octet-stream') {
|
|
200
|
+
//used in getArtifact() API only
|
|
201
|
+
return response;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}), (error) => {
|
|
205
|
+
//Network call fails. Handle Failed to Fetch
|
|
206
|
+
let err = {
|
|
207
|
+
code: 0,
|
|
208
|
+
userMessage: error.message,
|
|
209
|
+
internalMessage: error.message,
|
|
210
|
+
moreInfo: error.message,
|
|
211
|
+
};
|
|
212
|
+
throw new ServerErrors({ code: 0, errors: [err] });
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function fetchInTime(url, type, data, options, isMultipartRequest) {
|
|
217
|
+
const controller = new AbortController();
|
|
218
|
+
const { signal } = controller;
|
|
219
|
+
const timeoutPromise = new Promise((resolve, reject) => {
|
|
220
|
+
let timeout = (options === null || options === void 0 ? void 0 : options.timeout) ? options.timeout : RequestTimeout;
|
|
221
|
+
setTimeout(() => {
|
|
222
|
+
controller.abort();
|
|
223
|
+
reject({
|
|
224
|
+
code: 408,
|
|
225
|
+
errors: [{ code: 408, internalMessage: 'Request cancelled', userMessage: 'Request Cancelled' }],
|
|
226
|
+
});
|
|
227
|
+
}, timeout);
|
|
228
|
+
});
|
|
229
|
+
return Promise.race([
|
|
230
|
+
fetchAPI(url, type, data, (options === null || options === void 0 ? void 0 : options.signal) || signal, (options === null || options === void 0 ? void 0 : options.preventAutoLogout) || false, isMultipartRequest),
|
|
231
|
+
timeoutPromise,
|
|
232
|
+
]).catch((err) => {
|
|
233
|
+
if (err instanceof ServerErrors) {
|
|
234
|
+
throw err;
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
throw new ServerErrors({
|
|
238
|
+
code: 408,
|
|
239
|
+
errors: [
|
|
240
|
+
{
|
|
241
|
+
code: 408,
|
|
242
|
+
internalMessage: 'That took longer than expected.',
|
|
243
|
+
userMessage: 'That took longer than expected.',
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
const post = (url, data, options, isMultipartRequest) => {
|
|
251
|
+
return fetchInTime(url, 'POST', data, options, isMultipartRequest);
|
|
252
|
+
};
|
|
253
|
+
const put = (url, data, options) => {
|
|
254
|
+
return fetchInTime(url, 'PUT', data, options);
|
|
255
|
+
};
|
|
256
|
+
const get = (url, options) => {
|
|
257
|
+
return fetchInTime(url, 'GET', null, options);
|
|
258
|
+
};
|
|
259
|
+
const trash = (url, data, options) => {
|
|
260
|
+
return fetchInTime(url, 'DELETE', data, options);
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
function styleInject(css, ref) {
|
|
264
|
+
if ( ref === void 0 ) ref = {};
|
|
265
|
+
var insertAt = ref.insertAt;
|
|
266
|
+
|
|
267
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
268
|
+
|
|
269
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
270
|
+
var style = document.createElement('style');
|
|
271
|
+
style.type = 'text/css';
|
|
272
|
+
|
|
273
|
+
if (insertAt === 'top') {
|
|
274
|
+
if (head.firstChild) {
|
|
275
|
+
head.insertBefore(style, head.firstChild);
|
|
276
|
+
} else {
|
|
277
|
+
head.appendChild(style);
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
head.appendChild(style);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if (style.styleSheet) {
|
|
284
|
+
style.styleSheet.cssText = css;
|
|
285
|
+
} else {
|
|
286
|
+
style.appendChild(document.createTextNode(css));
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
var css_248z$2 = ".empty-state {\n height: 100%;\n}\n.empty-state img {\n height: 40%;\n max-height: 200px;\n width: auto;\n max-width: 250px;\n}\n.empty-state svg {\n height: 40%;\n max-height: 200px;\n width: auto;\n}\n.empty-state h1,\n.empty-state h2,\n.empty-state h3,\n.empty-state h4,\n.empty-state h5,\n.empty-state h6 {\n color: var(--N900);\n}\n.empty-state .title {\n font-weight: 600;\n}\n.empty-state .subtitle {\n font-size: 13px;\n width: 250px;\n font-weight: 400;\n text-align: center;\n line-height: 1.5;\n margin-bottom: 20px;\n}\n.empty-state .cta {\n height: 36px;\n}\n.empty-state p {\n width: 250px;\n text-align: center;\n font-size: 13px;\n color: var(--N700);\n}\n.empty-state strong {\n font-size: 16px;\n margin-bottom: 4px;\n color: var(--N900);\n font-weight: normal;\n}\n.empty-state .select-popup {\n height: min-content;\n max-height: 250px;\n overflow: auto;\n padding: 8px 0;\n}\n.empty-state .empty-state__loader {\n width: 34px;\n height: 34px;\n margin-bottom: 16px;\n}\n.empty-state .empty-state__loading-text {\n font-size: 12px;\n width: 200px;\n font-weight: normal;\n font-stretch: normal;\n font-style: normal;\n line-height: 1.5;\n letter-spacing: normal;\n text-align: center;\n color: var(--N900);\n}\n.empty-state .button__icon {\n width: 16px;\n height: 16px;\n margin-left: 8px;\n}";
|
|
291
|
+
styleInject(css_248z$2);
|
|
292
|
+
|
|
293
|
+
var _g;
|
|
294
|
+
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
295
|
+
var SvgIcProgressing = function SvgIcProgressing(props) {
|
|
296
|
+
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
297
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
298
|
+
viewBox: "0 0 24 24"
|
|
299
|
+
}, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
|
|
300
|
+
fill: "none"
|
|
301
|
+
}, /*#__PURE__*/React.createElement("animateTransform", {
|
|
302
|
+
attributeName: "transform",
|
|
303
|
+
attributeType: "XML",
|
|
304
|
+
dur: "0.5s",
|
|
305
|
+
from: "0 12 12",
|
|
306
|
+
repeatCount: "indefinite",
|
|
307
|
+
to: "360 12 12",
|
|
308
|
+
type: "rotate"
|
|
309
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
310
|
+
fill: "#06C",
|
|
311
|
+
d: "M12 2.5A9.5 9.5 0 1 1 2.5 12a1.5 1.5 0 0 1 3 0A6.5 6.5 0 1 0 12 5.5a1.5 1.5 0 0 1 0-3z"
|
|
312
|
+
}))));
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
function EmptyState({ children }) {
|
|
316
|
+
return (jsx("div", Object.assign({ className: "flex column empty-state", style: { width: '100%', height: '100%' } }, { children: children })));
|
|
317
|
+
}
|
|
318
|
+
function Image({ children }) {
|
|
319
|
+
return children;
|
|
320
|
+
}
|
|
321
|
+
function Title({ children }) {
|
|
322
|
+
return children;
|
|
323
|
+
}
|
|
324
|
+
function Subtitle({ children, className }) {
|
|
325
|
+
return jsx("p", Object.assign({ className: `subtitle ${className}` }, { children: children }));
|
|
326
|
+
}
|
|
327
|
+
function Button({ children }) {
|
|
328
|
+
return children;
|
|
329
|
+
}
|
|
330
|
+
const Loading = function (props) {
|
|
331
|
+
return jsxs(Fragment, { children: [jsx(SvgIcProgressing, { className: "dc__block empty-state__loader" }), jsx("p", Object.assign({ className: "empty-state__loading-text" }, { children: props.text }))] });
|
|
332
|
+
};
|
|
333
|
+
EmptyState.Image = Image;
|
|
334
|
+
EmptyState.Title = Title;
|
|
335
|
+
EmptyState.Subtitle = Subtitle;
|
|
336
|
+
EmptyState.Button = Button;
|
|
337
|
+
EmptyState.Loading = Loading;
|
|
338
|
+
|
|
339
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
340
|
+
|
|
341
|
+
function _extends() {
|
|
342
|
+
_extends = Object.assign || function (target) {
|
|
343
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
344
|
+
var source = arguments[i];
|
|
345
|
+
|
|
346
|
+
for (var key in source) {
|
|
347
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
348
|
+
target[key] = source[key];
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
return target;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
return _extends.apply(this, arguments);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
360
|
+
if (source == null) return {};
|
|
361
|
+
var target = {};
|
|
362
|
+
var sourceKeys = Object.keys(source);
|
|
363
|
+
var key, i;
|
|
364
|
+
|
|
365
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
366
|
+
key = sourceKeys[i];
|
|
367
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
368
|
+
target[key] = source[key];
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
return target;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function isNum(v) {
|
|
375
|
+
return typeof v === 'number' && !isNaN(v);
|
|
376
|
+
}
|
|
377
|
+
function isBool(v) {
|
|
378
|
+
return typeof v === 'boolean';
|
|
379
|
+
}
|
|
380
|
+
function isStr(v) {
|
|
381
|
+
return typeof v === 'string';
|
|
382
|
+
}
|
|
383
|
+
function isFn(v) {
|
|
384
|
+
return typeof v === 'function';
|
|
385
|
+
}
|
|
386
|
+
function parseClassName(v) {
|
|
387
|
+
return isStr(v) || isFn(v) ? v : null;
|
|
388
|
+
}
|
|
389
|
+
function isToastIdValid(toastId) {
|
|
390
|
+
return toastId === 0 || toastId;
|
|
391
|
+
}
|
|
392
|
+
function getAutoCloseDelay(toastAutoClose, containerAutoClose) {
|
|
393
|
+
return toastAutoClose === false || isNum(toastAutoClose) && toastAutoClose > 0 ? toastAutoClose : containerAutoClose;
|
|
394
|
+
}
|
|
395
|
+
var canUseDom = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
396
|
+
function canBeRendered(content) {
|
|
397
|
+
return isValidElement(content) || isStr(content) || isFn(content) || isNum(content);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
var POSITION = {
|
|
401
|
+
TOP_LEFT: 'top-left',
|
|
402
|
+
TOP_RIGHT: 'top-right',
|
|
403
|
+
TOP_CENTER: 'top-center',
|
|
404
|
+
BOTTOM_LEFT: 'bottom-left',
|
|
405
|
+
BOTTOM_RIGHT: 'bottom-right',
|
|
406
|
+
BOTTOM_CENTER: 'bottom-center'
|
|
407
|
+
};
|
|
408
|
+
var TYPE = {
|
|
409
|
+
INFO: 'info',
|
|
410
|
+
SUCCESS: 'success',
|
|
411
|
+
WARNING: 'warning',
|
|
412
|
+
ERROR: 'error',
|
|
413
|
+
DEFAULT: 'default'
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Used to collapse toast after exit animation
|
|
418
|
+
*/
|
|
419
|
+
function collapseToast(node, done, duration
|
|
420
|
+
/* COLLAPSE_DURATION */
|
|
421
|
+
) {
|
|
422
|
+
if (duration === void 0) {
|
|
423
|
+
duration = 300;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
var scrollHeight = node.scrollHeight,
|
|
427
|
+
style = node.style;
|
|
428
|
+
requestAnimationFrame(function () {
|
|
429
|
+
style.minHeight = 'initial';
|
|
430
|
+
style.height = scrollHeight + 'px';
|
|
431
|
+
style.transition = "all " + duration + "ms";
|
|
432
|
+
requestAnimationFrame(function () {
|
|
433
|
+
style.height = '0';
|
|
434
|
+
style.padding = '0';
|
|
435
|
+
style.margin = '0';
|
|
436
|
+
setTimeout(done, duration);
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Css animation that just work.
|
|
443
|
+
* You could use animate.css for instance
|
|
444
|
+
*
|
|
445
|
+
*
|
|
446
|
+
* ```
|
|
447
|
+
* cssTransition({
|
|
448
|
+
* enter: "animate__animated animate__bounceIn",
|
|
449
|
+
* exit: "animate__animated animate__bounceOut"
|
|
450
|
+
* })
|
|
451
|
+
* ```
|
|
452
|
+
*
|
|
453
|
+
*/
|
|
454
|
+
|
|
455
|
+
function cssTransition(_ref) {
|
|
456
|
+
var enter = _ref.enter,
|
|
457
|
+
exit = _ref.exit,
|
|
458
|
+
_ref$appendPosition = _ref.appendPosition,
|
|
459
|
+
appendPosition = _ref$appendPosition === void 0 ? false : _ref$appendPosition,
|
|
460
|
+
_ref$collapse = _ref.collapse,
|
|
461
|
+
collapse = _ref$collapse === void 0 ? true : _ref$collapse,
|
|
462
|
+
_ref$collapseDuration = _ref.collapseDuration,
|
|
463
|
+
collapseDuration = _ref$collapseDuration === void 0 ? 300 : _ref$collapseDuration;
|
|
464
|
+
return function ToastTransition(_ref2) {
|
|
465
|
+
var children = _ref2.children,
|
|
466
|
+
position = _ref2.position,
|
|
467
|
+
preventExitTransition = _ref2.preventExitTransition,
|
|
468
|
+
done = _ref2.done,
|
|
469
|
+
nodeRef = _ref2.nodeRef,
|
|
470
|
+
isIn = _ref2.isIn;
|
|
471
|
+
var enterClassName = appendPosition ? enter + "--" + position : enter;
|
|
472
|
+
var exitClassName = appendPosition ? exit + "--" + position : exit;
|
|
473
|
+
var baseClassName = useRef();
|
|
474
|
+
var animationStep = useRef(0
|
|
475
|
+
/* Enter */
|
|
476
|
+
);
|
|
477
|
+
useLayoutEffect(function () {
|
|
478
|
+
onEnter();
|
|
479
|
+
}, []);
|
|
480
|
+
useEffect(function () {
|
|
481
|
+
if (!isIn) preventExitTransition ? onExited() : onExit();
|
|
482
|
+
}, [isIn]);
|
|
483
|
+
|
|
484
|
+
function onEnter() {
|
|
485
|
+
var node = nodeRef.current;
|
|
486
|
+
baseClassName.current = node.className;
|
|
487
|
+
node.className += " " + enterClassName;
|
|
488
|
+
node.addEventListener('animationend', onEntered);
|
|
489
|
+
node.addEventListener('animationcancel', onEntered);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
function onEntered(e) {
|
|
493
|
+
if (e.target !== nodeRef.current) return;
|
|
494
|
+
var node = nodeRef.current;
|
|
495
|
+
node.dispatchEvent(new Event("d"
|
|
496
|
+
/* ENTRANCE_ANIMATION_END */
|
|
497
|
+
));
|
|
498
|
+
node.removeEventListener('animationend', onEntered);
|
|
499
|
+
node.removeEventListener('animationcancel', onEntered);
|
|
500
|
+
|
|
501
|
+
if (animationStep.current === 0
|
|
502
|
+
/* Enter */
|
|
503
|
+
) {
|
|
504
|
+
node.className = baseClassName.current;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
function onExit() {
|
|
509
|
+
animationStep.current = 1
|
|
510
|
+
/* Exit */
|
|
511
|
+
;
|
|
512
|
+
var node = nodeRef.current;
|
|
513
|
+
node.className += " " + exitClassName;
|
|
514
|
+
node.addEventListener('animationend', onExited);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
function onExited() {
|
|
518
|
+
var node = nodeRef.current;
|
|
519
|
+
node.removeEventListener('animationend', onExited);
|
|
520
|
+
collapse ? collapseToast(node, done, collapseDuration) : done();
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
return React__default.createElement(React__default.Fragment, null, children);
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
var eventManager = {
|
|
528
|
+
list: /*#__PURE__*/new Map(),
|
|
529
|
+
emitQueue: /*#__PURE__*/new Map(),
|
|
530
|
+
on: function on(event, callback) {
|
|
531
|
+
this.list.has(event) || this.list.set(event, []);
|
|
532
|
+
this.list.get(event).push(callback);
|
|
533
|
+
return this;
|
|
534
|
+
},
|
|
535
|
+
off: function off(event, callback) {
|
|
536
|
+
if (callback) {
|
|
537
|
+
var cb = this.list.get(event).filter(function (cb) {
|
|
538
|
+
return cb !== callback;
|
|
539
|
+
});
|
|
540
|
+
this.list.set(event, cb);
|
|
541
|
+
return this;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
this.list["delete"](event);
|
|
545
|
+
return this;
|
|
546
|
+
},
|
|
547
|
+
cancelEmit: function cancelEmit(event) {
|
|
548
|
+
var timers = this.emitQueue.get(event);
|
|
549
|
+
|
|
550
|
+
if (timers) {
|
|
551
|
+
timers.forEach(clearTimeout);
|
|
552
|
+
this.emitQueue["delete"](event);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
return this;
|
|
556
|
+
},
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Enqueue the event at the end of the call stack
|
|
560
|
+
* Doing so let the user call toast as follow:
|
|
561
|
+
* toast('1')
|
|
562
|
+
* toast('2')
|
|
563
|
+
* toast('3')
|
|
564
|
+
* Without setTimemout the code above will not work
|
|
565
|
+
*/
|
|
566
|
+
emit: function emit(event) {
|
|
567
|
+
var _this = this;
|
|
568
|
+
|
|
569
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
570
|
+
args[_key - 1] = arguments[_key];
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
this.list.has(event) && this.list.get(event).forEach(function (callback) {
|
|
574
|
+
var timer = setTimeout(function () {
|
|
575
|
+
// @ts-ignore
|
|
576
|
+
callback.apply(void 0, args);
|
|
577
|
+
}, 0);
|
|
578
|
+
_this.emitQueue.has(event) || _this.emitQueue.set(event, []);
|
|
579
|
+
|
|
580
|
+
_this.emitQueue.get(event).push(timer);
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
var _excluded = ["delay", "staleId"];
|
|
586
|
+
function useToastContainer(props) {
|
|
587
|
+
var _useReducer = useReducer(function (x) {
|
|
588
|
+
return x + 1;
|
|
589
|
+
}, 0),
|
|
590
|
+
forceUpdate = _useReducer[1];
|
|
591
|
+
|
|
592
|
+
var _useState = useState([]),
|
|
593
|
+
toastIds = _useState[0],
|
|
594
|
+
setToastIds = _useState[1];
|
|
595
|
+
|
|
596
|
+
var containerRef = useRef(null);
|
|
597
|
+
var toastToRender = useRef(new Map()).current;
|
|
598
|
+
|
|
599
|
+
var isToastActive = function isToastActive(id) {
|
|
600
|
+
return toastIds.indexOf(id) !== -1;
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
var instance = useRef({
|
|
604
|
+
toastKey: 1,
|
|
605
|
+
displayedToast: 0,
|
|
606
|
+
count: 0,
|
|
607
|
+
queue: [],
|
|
608
|
+
props: props,
|
|
609
|
+
containerId: null,
|
|
610
|
+
isToastActive: isToastActive,
|
|
611
|
+
getToast: function getToast(id) {
|
|
612
|
+
return toastToRender.get(id);
|
|
613
|
+
}
|
|
614
|
+
}).current;
|
|
615
|
+
useEffect(function () {
|
|
616
|
+
instance.containerId = props.containerId;
|
|
617
|
+
eventManager.cancelEmit(3
|
|
618
|
+
/* WillUnmount */
|
|
619
|
+
).on(0
|
|
620
|
+
/* Show */
|
|
621
|
+
, buildToast).on(1
|
|
622
|
+
/* Clear */
|
|
623
|
+
, function (toastId) {
|
|
624
|
+
return containerRef.current && removeToast(toastId);
|
|
625
|
+
}).on(5
|
|
626
|
+
/* ClearWaitingQueue */
|
|
627
|
+
, clearWaitingQueue).emit(2
|
|
628
|
+
/* DidMount */
|
|
629
|
+
, instance);
|
|
630
|
+
return function () {
|
|
631
|
+
return eventManager.emit(3
|
|
632
|
+
/* WillUnmount */
|
|
633
|
+
, instance);
|
|
634
|
+
};
|
|
635
|
+
}, []);
|
|
636
|
+
useEffect(function () {
|
|
637
|
+
instance.isToastActive = isToastActive;
|
|
638
|
+
instance.displayedToast = toastIds.length;
|
|
639
|
+
eventManager.emit(4
|
|
640
|
+
/* Change */
|
|
641
|
+
, toastIds.length, props.containerId);
|
|
642
|
+
}, [toastIds]);
|
|
643
|
+
useEffect(function () {
|
|
644
|
+
instance.props = props;
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
function clearWaitingQueue(_ref) {
|
|
648
|
+
var containerId = _ref.containerId;
|
|
649
|
+
var limit = instance.props.limit;
|
|
650
|
+
|
|
651
|
+
if (limit && (!containerId || instance.containerId === containerId)) {
|
|
652
|
+
instance.count -= instance.queue.length;
|
|
653
|
+
instance.queue = [];
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
function removeToast(toastId) {
|
|
658
|
+
setToastIds(function (state) {
|
|
659
|
+
return isToastIdValid(toastId) ? state.filter(function (id) {
|
|
660
|
+
return id !== toastId;
|
|
661
|
+
}) : [];
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
function dequeueToast() {
|
|
666
|
+
var _instance$queue$shift = instance.queue.shift(),
|
|
667
|
+
toastContent = _instance$queue$shift.toastContent,
|
|
668
|
+
toastProps = _instance$queue$shift.toastProps,
|
|
669
|
+
staleId = _instance$queue$shift.staleId;
|
|
670
|
+
|
|
671
|
+
appendToast(toastContent, toastProps, staleId);
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* check if a container is attached to the dom
|
|
675
|
+
* check for multi-container, build only if associated
|
|
676
|
+
* check for duplicate toastId if no update
|
|
677
|
+
*/
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
function isNotValid(options) {
|
|
681
|
+
return !containerRef.current || instance.props.enableMultiContainer && options.containerId !== instance.props.containerId || toastToRender.has(options.toastId) && options.updateId == null;
|
|
682
|
+
} // this function and all the function called inside needs to rely on refs
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
function buildToast(content, _ref2) {
|
|
686
|
+
var delay = _ref2.delay,
|
|
687
|
+
staleId = _ref2.staleId,
|
|
688
|
+
options = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
689
|
+
|
|
690
|
+
if (!canBeRendered(content) || isNotValid(options)) return;
|
|
691
|
+
var toastId = options.toastId,
|
|
692
|
+
updateId = options.updateId,
|
|
693
|
+
data = options.data;
|
|
694
|
+
var props = instance.props;
|
|
695
|
+
|
|
696
|
+
var closeToast = function closeToast() {
|
|
697
|
+
return removeToast(toastId);
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
var isNotAnUpdate = updateId == null;
|
|
701
|
+
if (isNotAnUpdate) instance.count++;
|
|
702
|
+
var toastProps = {
|
|
703
|
+
toastId: toastId,
|
|
704
|
+
updateId: updateId,
|
|
705
|
+
isLoading: options.isLoading,
|
|
706
|
+
theme: options.theme || props.theme,
|
|
707
|
+
icon: options.icon != null ? options.icon : props.icon,
|
|
708
|
+
isIn: false,
|
|
709
|
+
key: options.key || instance.toastKey++,
|
|
710
|
+
type: options.type,
|
|
711
|
+
closeToast: closeToast,
|
|
712
|
+
closeButton: options.closeButton,
|
|
713
|
+
rtl: props.rtl,
|
|
714
|
+
position: options.position || props.position,
|
|
715
|
+
transition: options.transition || props.transition,
|
|
716
|
+
className: parseClassName(options.className || props.toastClassName),
|
|
717
|
+
bodyClassName: parseClassName(options.bodyClassName || props.bodyClassName),
|
|
718
|
+
style: options.style || props.toastStyle,
|
|
719
|
+
bodyStyle: options.bodyStyle || props.bodyStyle,
|
|
720
|
+
onClick: options.onClick || props.onClick,
|
|
721
|
+
pauseOnHover: isBool(options.pauseOnHover) ? options.pauseOnHover : props.pauseOnHover,
|
|
722
|
+
pauseOnFocusLoss: isBool(options.pauseOnFocusLoss) ? options.pauseOnFocusLoss : props.pauseOnFocusLoss,
|
|
723
|
+
draggable: isBool(options.draggable) ? options.draggable : props.draggable,
|
|
724
|
+
draggablePercent: options.draggablePercent || props.draggablePercent,
|
|
725
|
+
draggableDirection: options.draggableDirection || props.draggableDirection,
|
|
726
|
+
closeOnClick: isBool(options.closeOnClick) ? options.closeOnClick : props.closeOnClick,
|
|
727
|
+
progressClassName: parseClassName(options.progressClassName || props.progressClassName),
|
|
728
|
+
progressStyle: options.progressStyle || props.progressStyle,
|
|
729
|
+
autoClose: options.isLoading ? false : getAutoCloseDelay(options.autoClose, props.autoClose),
|
|
730
|
+
hideProgressBar: isBool(options.hideProgressBar) ? options.hideProgressBar : props.hideProgressBar,
|
|
731
|
+
progress: options.progress,
|
|
732
|
+
role: options.role || props.role,
|
|
733
|
+
deleteToast: function deleteToast() {
|
|
734
|
+
toastToRender["delete"](toastId);
|
|
735
|
+
var queueLen = instance.queue.length;
|
|
736
|
+
instance.count = isToastIdValid(toastId) ? instance.count - 1 : instance.count - instance.displayedToast;
|
|
737
|
+
if (instance.count < 0) instance.count = 0;
|
|
738
|
+
|
|
739
|
+
if (queueLen > 0) {
|
|
740
|
+
var freeSlot = isToastIdValid(toastId) ? 1 : instance.props.limit;
|
|
741
|
+
|
|
742
|
+
if (queueLen === 1 || freeSlot === 1) {
|
|
743
|
+
instance.displayedToast++;
|
|
744
|
+
dequeueToast();
|
|
745
|
+
} else {
|
|
746
|
+
var toDequeue = freeSlot > queueLen ? queueLen : freeSlot;
|
|
747
|
+
instance.displayedToast = toDequeue;
|
|
748
|
+
|
|
749
|
+
for (var i = 0; i < toDequeue; i++) {
|
|
750
|
+
dequeueToast();
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
} else {
|
|
754
|
+
forceUpdate();
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
};
|
|
758
|
+
if (isFn(options.onOpen)) toastProps.onOpen = options.onOpen;
|
|
759
|
+
if (isFn(options.onClose)) toastProps.onClose = options.onClose;
|
|
760
|
+
toastProps.closeButton = props.closeButton;
|
|
761
|
+
|
|
762
|
+
if (options.closeButton === false || canBeRendered(options.closeButton)) {
|
|
763
|
+
toastProps.closeButton = options.closeButton;
|
|
764
|
+
} else if (options.closeButton === true) {
|
|
765
|
+
toastProps.closeButton = canBeRendered(props.closeButton) ? props.closeButton : true;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
var toastContent = content;
|
|
769
|
+
|
|
770
|
+
if (isValidElement(content) && !isStr(content.type)) {
|
|
771
|
+
toastContent = cloneElement(content, {
|
|
772
|
+
closeToast: closeToast,
|
|
773
|
+
toastProps: toastProps,
|
|
774
|
+
data: data
|
|
775
|
+
});
|
|
776
|
+
} else if (isFn(content)) {
|
|
777
|
+
toastContent = content({
|
|
778
|
+
closeToast: closeToast,
|
|
779
|
+
toastProps: toastProps,
|
|
780
|
+
data: data
|
|
781
|
+
});
|
|
782
|
+
} // not handling limit + delay by design. Waiting for user feedback first
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
if (props.limit && props.limit > 0 && instance.count > props.limit && isNotAnUpdate) {
|
|
786
|
+
instance.queue.push({
|
|
787
|
+
toastContent: toastContent,
|
|
788
|
+
toastProps: toastProps,
|
|
789
|
+
staleId: staleId
|
|
790
|
+
});
|
|
791
|
+
} else if (isNum(delay) && delay > 0) {
|
|
792
|
+
setTimeout(function () {
|
|
793
|
+
appendToast(toastContent, toastProps, staleId);
|
|
794
|
+
}, delay);
|
|
795
|
+
} else {
|
|
796
|
+
appendToast(toastContent, toastProps, staleId);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
function appendToast(content, toastProps, staleId) {
|
|
801
|
+
var toastId = toastProps.toastId;
|
|
802
|
+
if (staleId) toastToRender["delete"](staleId);
|
|
803
|
+
toastToRender.set(toastId, {
|
|
804
|
+
content: content,
|
|
805
|
+
props: toastProps
|
|
806
|
+
});
|
|
807
|
+
setToastIds(function (state) {
|
|
808
|
+
return [].concat(state, [toastId]).filter(function (id) {
|
|
809
|
+
return id !== staleId;
|
|
810
|
+
});
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
function getToastToRender(cb) {
|
|
815
|
+
var toRender = new Map();
|
|
816
|
+
var collection = Array.from(toastToRender.values());
|
|
817
|
+
if (props.newestOnTop) collection.reverse();
|
|
818
|
+
collection.forEach(function (toast) {
|
|
819
|
+
var position = toast.props.position;
|
|
820
|
+
toRender.has(position) || toRender.set(position, []);
|
|
821
|
+
toRender.get(position).push(toast);
|
|
822
|
+
});
|
|
823
|
+
return Array.from(toRender, function (p) {
|
|
824
|
+
return cb(p[0], p[1]);
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
return {
|
|
829
|
+
getToastToRender: getToastToRender,
|
|
830
|
+
containerRef: containerRef,
|
|
831
|
+
isToastActive: isToastActive
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
function getX(e) {
|
|
836
|
+
return e.targetTouches && e.targetTouches.length >= 1 ? e.targetTouches[0].clientX : e.clientX;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
function getY(e) {
|
|
840
|
+
return e.targetTouches && e.targetTouches.length >= 1 ? e.targetTouches[0].clientY : e.clientY;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
function useToast(props) {
|
|
844
|
+
var _useState = useState(false),
|
|
845
|
+
isRunning = _useState[0],
|
|
846
|
+
setIsRunning = _useState[1];
|
|
847
|
+
|
|
848
|
+
var _useState2 = useState(false),
|
|
849
|
+
preventExitTransition = _useState2[0],
|
|
850
|
+
setPreventExitTransition = _useState2[1];
|
|
851
|
+
|
|
852
|
+
var toastRef = useRef(null);
|
|
853
|
+
var drag = useRef({
|
|
854
|
+
start: 0,
|
|
855
|
+
x: 0,
|
|
856
|
+
y: 0,
|
|
857
|
+
delta: 0,
|
|
858
|
+
removalDistance: 0,
|
|
859
|
+
canCloseOnClick: true,
|
|
860
|
+
canDrag: false,
|
|
861
|
+
boundingRect: null,
|
|
862
|
+
didMove: false
|
|
863
|
+
}).current;
|
|
864
|
+
var syncProps = useRef(props);
|
|
865
|
+
var autoClose = props.autoClose,
|
|
866
|
+
pauseOnHover = props.pauseOnHover,
|
|
867
|
+
closeToast = props.closeToast,
|
|
868
|
+
onClick = props.onClick,
|
|
869
|
+
closeOnClick = props.closeOnClick;
|
|
870
|
+
useEffect(function () {
|
|
871
|
+
syncProps.current = props;
|
|
872
|
+
});
|
|
873
|
+
useEffect(function () {
|
|
874
|
+
if (toastRef.current) toastRef.current.addEventListener("d"
|
|
875
|
+
/* ENTRANCE_ANIMATION_END */
|
|
876
|
+
, playToast, {
|
|
877
|
+
once: true
|
|
878
|
+
});
|
|
879
|
+
if (isFn(props.onOpen)) props.onOpen(isValidElement(props.children) && props.children.props);
|
|
880
|
+
return function () {
|
|
881
|
+
var props = syncProps.current;
|
|
882
|
+
if (isFn(props.onClose)) props.onClose(isValidElement(props.children) && props.children.props);
|
|
883
|
+
};
|
|
884
|
+
}, []);
|
|
885
|
+
useEffect(function () {
|
|
886
|
+
props.pauseOnFocusLoss && bindFocusEvents();
|
|
887
|
+
return function () {
|
|
888
|
+
props.pauseOnFocusLoss && unbindFocusEvents();
|
|
889
|
+
};
|
|
890
|
+
}, [props.pauseOnFocusLoss]);
|
|
891
|
+
|
|
892
|
+
function onDragStart(e) {
|
|
893
|
+
if (props.draggable) {
|
|
894
|
+
bindDragEvents();
|
|
895
|
+
var toast = toastRef.current;
|
|
896
|
+
drag.canCloseOnClick = true;
|
|
897
|
+
drag.canDrag = true;
|
|
898
|
+
drag.boundingRect = toast.getBoundingClientRect();
|
|
899
|
+
toast.style.transition = '';
|
|
900
|
+
drag.x = getX(e.nativeEvent);
|
|
901
|
+
drag.y = getY(e.nativeEvent);
|
|
902
|
+
|
|
903
|
+
if (props.draggableDirection === "x"
|
|
904
|
+
/* X */
|
|
905
|
+
) {
|
|
906
|
+
drag.start = drag.x;
|
|
907
|
+
drag.removalDistance = toast.offsetWidth * (props.draggablePercent / 100);
|
|
908
|
+
} else {
|
|
909
|
+
drag.start = drag.y;
|
|
910
|
+
drag.removalDistance = toast.offsetHeight * (props.draggablePercent === 80
|
|
911
|
+
/* DRAGGABLE_PERCENT */
|
|
912
|
+
? props.draggablePercent * 1.5 : props.draggablePercent / 100);
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
function onDragTransitionEnd() {
|
|
918
|
+
if (drag.boundingRect) {
|
|
919
|
+
var _drag$boundingRect = drag.boundingRect,
|
|
920
|
+
top = _drag$boundingRect.top,
|
|
921
|
+
bottom = _drag$boundingRect.bottom,
|
|
922
|
+
left = _drag$boundingRect.left,
|
|
923
|
+
right = _drag$boundingRect.right;
|
|
924
|
+
|
|
925
|
+
if (props.pauseOnHover && drag.x >= left && drag.x <= right && drag.y >= top && drag.y <= bottom) {
|
|
926
|
+
pauseToast();
|
|
927
|
+
} else {
|
|
928
|
+
playToast();
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
function playToast() {
|
|
934
|
+
setIsRunning(true);
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
function pauseToast() {
|
|
938
|
+
setIsRunning(false);
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
function bindFocusEvents() {
|
|
942
|
+
if (!document.hasFocus()) pauseToast();
|
|
943
|
+
window.addEventListener('focus', playToast);
|
|
944
|
+
window.addEventListener('blur', pauseToast);
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
function unbindFocusEvents() {
|
|
948
|
+
window.removeEventListener('focus', playToast);
|
|
949
|
+
window.removeEventListener('blur', pauseToast);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
function bindDragEvents() {
|
|
953
|
+
drag.didMove = false;
|
|
954
|
+
document.addEventListener('mousemove', onDragMove);
|
|
955
|
+
document.addEventListener('mouseup', onDragEnd);
|
|
956
|
+
document.addEventListener('touchmove', onDragMove);
|
|
957
|
+
document.addEventListener('touchend', onDragEnd);
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
function unbindDragEvents() {
|
|
961
|
+
document.removeEventListener('mousemove', onDragMove);
|
|
962
|
+
document.removeEventListener('mouseup', onDragEnd);
|
|
963
|
+
document.removeEventListener('touchmove', onDragMove);
|
|
964
|
+
document.removeEventListener('touchend', onDragEnd);
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
function onDragMove(e) {
|
|
968
|
+
var toast = toastRef.current;
|
|
969
|
+
|
|
970
|
+
if (drag.canDrag && toast) {
|
|
971
|
+
drag.didMove = true;
|
|
972
|
+
if (isRunning) pauseToast();
|
|
973
|
+
drag.x = getX(e);
|
|
974
|
+
drag.y = getY(e);
|
|
975
|
+
|
|
976
|
+
if (props.draggableDirection === "x"
|
|
977
|
+
/* X */
|
|
978
|
+
) {
|
|
979
|
+
drag.delta = drag.x - drag.start;
|
|
980
|
+
} else {
|
|
981
|
+
drag.delta = drag.y - drag.start;
|
|
982
|
+
} // prevent false positif during a toast click
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
if (drag.start !== drag.x) drag.canCloseOnClick = false;
|
|
986
|
+
toast.style.transform = "translate" + props.draggableDirection + "(" + drag.delta + "px)";
|
|
987
|
+
toast.style.opacity = "" + (1 - Math.abs(drag.delta / drag.removalDistance));
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
function onDragEnd() {
|
|
992
|
+
unbindDragEvents();
|
|
993
|
+
var toast = toastRef.current;
|
|
994
|
+
|
|
995
|
+
if (drag.canDrag && drag.didMove && toast) {
|
|
996
|
+
drag.canDrag = false;
|
|
997
|
+
|
|
998
|
+
if (Math.abs(drag.delta) > drag.removalDistance) {
|
|
999
|
+
setPreventExitTransition(true);
|
|
1000
|
+
props.closeToast();
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
toast.style.transition = 'transform 0.2s, opacity 0.2s';
|
|
1005
|
+
toast.style.transform = "translate" + props.draggableDirection + "(0)";
|
|
1006
|
+
toast.style.opacity = '1';
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
var eventHandlers = {
|
|
1011
|
+
onMouseDown: onDragStart,
|
|
1012
|
+
onTouchStart: onDragStart,
|
|
1013
|
+
onMouseUp: onDragTransitionEnd,
|
|
1014
|
+
onTouchEnd: onDragTransitionEnd
|
|
1015
|
+
};
|
|
1016
|
+
|
|
1017
|
+
if (autoClose && pauseOnHover) {
|
|
1018
|
+
eventHandlers.onMouseEnter = pauseToast;
|
|
1019
|
+
eventHandlers.onMouseLeave = playToast;
|
|
1020
|
+
} // prevent toast from closing when user drags the toast
|
|
1021
|
+
|
|
1022
|
+
|
|
1023
|
+
if (closeOnClick) {
|
|
1024
|
+
eventHandlers.onClick = function (e) {
|
|
1025
|
+
onClick && onClick(e);
|
|
1026
|
+
drag.canCloseOnClick && closeToast();
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
return {
|
|
1031
|
+
playToast: playToast,
|
|
1032
|
+
pauseToast: pauseToast,
|
|
1033
|
+
isRunning: isRunning,
|
|
1034
|
+
preventExitTransition: preventExitTransition,
|
|
1035
|
+
toastRef: toastRef,
|
|
1036
|
+
eventHandlers: eventHandlers
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
function CloseButton(_ref) {
|
|
1041
|
+
var closeToast = _ref.closeToast,
|
|
1042
|
+
theme = _ref.theme,
|
|
1043
|
+
_ref$ariaLabel = _ref.ariaLabel,
|
|
1044
|
+
ariaLabel = _ref$ariaLabel === void 0 ? 'close' : _ref$ariaLabel;
|
|
1045
|
+
return createElement("button", {
|
|
1046
|
+
className: "Toastify"
|
|
1047
|
+
/* CSS_NAMESPACE */
|
|
1048
|
+
+ "__close-button " + "Toastify"
|
|
1049
|
+
/* CSS_NAMESPACE */
|
|
1050
|
+
+ "__close-button--" + theme,
|
|
1051
|
+
type: "button",
|
|
1052
|
+
onClick: function onClick(e) {
|
|
1053
|
+
e.stopPropagation();
|
|
1054
|
+
closeToast(e);
|
|
1055
|
+
},
|
|
1056
|
+
"aria-label": ariaLabel
|
|
1057
|
+
}, createElement("svg", {
|
|
1058
|
+
"aria-hidden": "true",
|
|
1059
|
+
viewBox: "0 0 14 16"
|
|
1060
|
+
}, createElement("path", {
|
|
1061
|
+
fillRule: "evenodd",
|
|
1062
|
+
d: "M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"
|
|
1063
|
+
})));
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
function ProgressBar(_ref) {
|
|
1067
|
+
var _cx, _animationEvent;
|
|
1068
|
+
|
|
1069
|
+
var delay = _ref.delay,
|
|
1070
|
+
isRunning = _ref.isRunning,
|
|
1071
|
+
closeToast = _ref.closeToast,
|
|
1072
|
+
type = _ref.type,
|
|
1073
|
+
hide = _ref.hide,
|
|
1074
|
+
className = _ref.className,
|
|
1075
|
+
userStyle = _ref.style,
|
|
1076
|
+
controlledProgress = _ref.controlledProgress,
|
|
1077
|
+
progress = _ref.progress,
|
|
1078
|
+
rtl = _ref.rtl,
|
|
1079
|
+
isIn = _ref.isIn,
|
|
1080
|
+
theme = _ref.theme;
|
|
1081
|
+
|
|
1082
|
+
var style = _extends({}, userStyle, {
|
|
1083
|
+
animationDuration: delay + "ms",
|
|
1084
|
+
animationPlayState: isRunning ? 'running' : 'paused',
|
|
1085
|
+
opacity: hide ? 0 : 1
|
|
1086
|
+
});
|
|
1087
|
+
|
|
1088
|
+
if (controlledProgress) style.transform = "scaleX(" + progress + ")";
|
|
1089
|
+
var defaultClassName = clsx("Toastify"
|
|
1090
|
+
/* CSS_NAMESPACE */
|
|
1091
|
+
+ "__progress-bar", controlledProgress ? "Toastify"
|
|
1092
|
+
/* CSS_NAMESPACE */
|
|
1093
|
+
+ "__progress-bar--controlled" : "Toastify"
|
|
1094
|
+
/* CSS_NAMESPACE */
|
|
1095
|
+
+ "__progress-bar--animated", "Toastify"
|
|
1096
|
+
/* CSS_NAMESPACE */
|
|
1097
|
+
+ "__progress-bar-theme--" + theme, "Toastify"
|
|
1098
|
+
/* CSS_NAMESPACE */
|
|
1099
|
+
+ "__progress-bar--" + type, (_cx = {}, _cx["Toastify"
|
|
1100
|
+
/* CSS_NAMESPACE */
|
|
1101
|
+
+ "__progress-bar--rtl"] = rtl, _cx));
|
|
1102
|
+
var classNames = isFn(className) ? className({
|
|
1103
|
+
rtl: rtl,
|
|
1104
|
+
type: type,
|
|
1105
|
+
defaultClassName: defaultClassName
|
|
1106
|
+
}) : clsx(defaultClassName, className); // 🧐 controlledProgress is derived from progress
|
|
1107
|
+
// so if controlledProgress is set
|
|
1108
|
+
// it means that this is also the case for progress
|
|
1109
|
+
|
|
1110
|
+
var animationEvent = (_animationEvent = {}, _animationEvent[controlledProgress && progress >= 1 ? 'onTransitionEnd' : 'onAnimationEnd'] = controlledProgress && progress < 1 ? null : function () {
|
|
1111
|
+
isIn && closeToast();
|
|
1112
|
+
}, _animationEvent); // TODO: add aria-valuenow, aria-valuemax, aria-valuemin
|
|
1113
|
+
|
|
1114
|
+
return createElement("div", Object.assign({
|
|
1115
|
+
role: "progressbar",
|
|
1116
|
+
"aria-hidden": hide ? 'true' : 'false',
|
|
1117
|
+
"aria-label": "notification timer",
|
|
1118
|
+
className: classNames,
|
|
1119
|
+
style: style
|
|
1120
|
+
}, animationEvent));
|
|
1121
|
+
}
|
|
1122
|
+
ProgressBar.defaultProps = {
|
|
1123
|
+
type: TYPE.DEFAULT,
|
|
1124
|
+
hide: false
|
|
1125
|
+
};
|
|
1126
|
+
|
|
1127
|
+
var _excluded$1 = ["theme", "type"];
|
|
1128
|
+
|
|
1129
|
+
var Svg = function Svg(_ref) {
|
|
1130
|
+
var theme = _ref.theme,
|
|
1131
|
+
type = _ref.type,
|
|
1132
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
1133
|
+
|
|
1134
|
+
return createElement("svg", Object.assign({
|
|
1135
|
+
viewBox: "0 0 24 24",
|
|
1136
|
+
width: "100%",
|
|
1137
|
+
height: "100%",
|
|
1138
|
+
fill: theme === 'colored' ? 'currentColor' : "var(--toastify-icon-color-" + type + ")"
|
|
1139
|
+
}, rest));
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1142
|
+
function Warning(props) {
|
|
1143
|
+
return createElement(Svg, Object.assign({}, props), createElement("path", {
|
|
1144
|
+
d: "M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"
|
|
1145
|
+
}));
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
function Info(props) {
|
|
1149
|
+
return createElement(Svg, Object.assign({}, props), createElement("path", {
|
|
1150
|
+
d: "M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"
|
|
1151
|
+
}));
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
function Success(props) {
|
|
1155
|
+
return createElement(Svg, Object.assign({}, props), createElement("path", {
|
|
1156
|
+
d: "M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"
|
|
1157
|
+
}));
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
function Error$1(props) {
|
|
1161
|
+
return createElement(Svg, Object.assign({}, props), createElement("path", {
|
|
1162
|
+
d: "M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"
|
|
1163
|
+
}));
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
function Spinner() {
|
|
1167
|
+
return createElement("div", {
|
|
1168
|
+
className: "Toastify"
|
|
1169
|
+
/* CSS_NAMESPACE */
|
|
1170
|
+
+ "__spinner"
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
var Icons = {
|
|
1175
|
+
info: Info,
|
|
1176
|
+
warning: Warning,
|
|
1177
|
+
success: Success,
|
|
1178
|
+
error: Error$1,
|
|
1179
|
+
spinner: Spinner
|
|
1180
|
+
};
|
|
1181
|
+
|
|
1182
|
+
var Toast = function Toast(props) {
|
|
1183
|
+
var _cx, _cx2;
|
|
1184
|
+
|
|
1185
|
+
var _useToast = useToast(props),
|
|
1186
|
+
isRunning = _useToast.isRunning,
|
|
1187
|
+
preventExitTransition = _useToast.preventExitTransition,
|
|
1188
|
+
toastRef = _useToast.toastRef,
|
|
1189
|
+
eventHandlers = _useToast.eventHandlers;
|
|
1190
|
+
|
|
1191
|
+
var closeButton = props.closeButton,
|
|
1192
|
+
children = props.children,
|
|
1193
|
+
autoClose = props.autoClose,
|
|
1194
|
+
onClick = props.onClick,
|
|
1195
|
+
type = props.type,
|
|
1196
|
+
hideProgressBar = props.hideProgressBar,
|
|
1197
|
+
closeToast = props.closeToast,
|
|
1198
|
+
Transition = props.transition,
|
|
1199
|
+
position = props.position,
|
|
1200
|
+
className = props.className,
|
|
1201
|
+
style = props.style,
|
|
1202
|
+
bodyClassName = props.bodyClassName,
|
|
1203
|
+
bodyStyle = props.bodyStyle,
|
|
1204
|
+
progressClassName = props.progressClassName,
|
|
1205
|
+
progressStyle = props.progressStyle,
|
|
1206
|
+
updateId = props.updateId,
|
|
1207
|
+
role = props.role,
|
|
1208
|
+
progress = props.progress,
|
|
1209
|
+
rtl = props.rtl,
|
|
1210
|
+
toastId = props.toastId,
|
|
1211
|
+
deleteToast = props.deleteToast,
|
|
1212
|
+
isIn = props.isIn,
|
|
1213
|
+
isLoading = props.isLoading,
|
|
1214
|
+
icon = props.icon,
|
|
1215
|
+
theme = props.theme;
|
|
1216
|
+
var defaultClassName = clsx("Toastify"
|
|
1217
|
+
/* CSS_NAMESPACE */
|
|
1218
|
+
+ "__toast", "Toastify"
|
|
1219
|
+
/* CSS_NAMESPACE */
|
|
1220
|
+
+ "__toast-theme--" + theme, "Toastify"
|
|
1221
|
+
/* CSS_NAMESPACE */
|
|
1222
|
+
+ "__toast--" + type, (_cx = {}, _cx["Toastify"
|
|
1223
|
+
/* CSS_NAMESPACE */
|
|
1224
|
+
+ "__toast--rtl"] = rtl, _cx));
|
|
1225
|
+
var cssClasses = isFn(className) ? className({
|
|
1226
|
+
rtl: rtl,
|
|
1227
|
+
position: position,
|
|
1228
|
+
type: type,
|
|
1229
|
+
defaultClassName: defaultClassName
|
|
1230
|
+
}) : clsx(defaultClassName, className);
|
|
1231
|
+
var isProgressControlled = !!progress;
|
|
1232
|
+
var maybeIcon = Icons[type];
|
|
1233
|
+
var iconProps = {
|
|
1234
|
+
theme: theme,
|
|
1235
|
+
type: type
|
|
1236
|
+
};
|
|
1237
|
+
var Icon = maybeIcon && maybeIcon(iconProps);
|
|
1238
|
+
|
|
1239
|
+
if (icon === false) {
|
|
1240
|
+
Icon = void 0;
|
|
1241
|
+
} else if (isFn(icon)) {
|
|
1242
|
+
Icon = icon(iconProps);
|
|
1243
|
+
} else if (isValidElement(icon)) {
|
|
1244
|
+
Icon = cloneElement(icon, iconProps);
|
|
1245
|
+
} else if (isStr(icon)) {
|
|
1246
|
+
Icon = icon;
|
|
1247
|
+
} else if (isLoading) {
|
|
1248
|
+
Icon = Icons.spinner();
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
function renderCloseButton(closeButton) {
|
|
1252
|
+
if (!closeButton) return;
|
|
1253
|
+
var props = {
|
|
1254
|
+
closeToast: closeToast,
|
|
1255
|
+
type: type,
|
|
1256
|
+
theme: theme
|
|
1257
|
+
};
|
|
1258
|
+
if (isFn(closeButton)) return closeButton(props);
|
|
1259
|
+
if (isValidElement(closeButton)) return cloneElement(closeButton, props);
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
return createElement(Transition, {
|
|
1263
|
+
isIn: isIn,
|
|
1264
|
+
done: deleteToast,
|
|
1265
|
+
position: position,
|
|
1266
|
+
preventExitTransition: preventExitTransition,
|
|
1267
|
+
nodeRef: toastRef
|
|
1268
|
+
}, createElement("div", Object.assign({
|
|
1269
|
+
id: toastId,
|
|
1270
|
+
onClick: onClick,
|
|
1271
|
+
className: cssClasses
|
|
1272
|
+
}, eventHandlers, {
|
|
1273
|
+
style: style,
|
|
1274
|
+
ref: toastRef
|
|
1275
|
+
}), createElement("div", Object.assign({}, isIn && {
|
|
1276
|
+
role: role
|
|
1277
|
+
}, {
|
|
1278
|
+
className: isFn(bodyClassName) ? bodyClassName({
|
|
1279
|
+
type: type
|
|
1280
|
+
}) : clsx("Toastify"
|
|
1281
|
+
/* CSS_NAMESPACE */
|
|
1282
|
+
+ "__toast-body", bodyClassName),
|
|
1283
|
+
style: bodyStyle
|
|
1284
|
+
}), Icon && createElement("div", {
|
|
1285
|
+
className: clsx("Toastify"
|
|
1286
|
+
/* CSS_NAMESPACE */
|
|
1287
|
+
+ "__toast-icon", (_cx2 = {}, _cx2["Toastify"
|
|
1288
|
+
/* CSS_NAMESPACE */
|
|
1289
|
+
+ "--animate-icon " + "Toastify"
|
|
1290
|
+
/* CSS_NAMESPACE */
|
|
1291
|
+
+ "__zoom-enter"] = !isLoading, _cx2))
|
|
1292
|
+
}, Icon), createElement("div", null, children)), renderCloseButton(closeButton), (autoClose || isProgressControlled) && createElement(ProgressBar, Object.assign({}, updateId && !isProgressControlled ? {
|
|
1293
|
+
key: "pb-" + updateId
|
|
1294
|
+
} : {}, {
|
|
1295
|
+
rtl: rtl,
|
|
1296
|
+
theme: theme,
|
|
1297
|
+
delay: autoClose,
|
|
1298
|
+
isRunning: isRunning,
|
|
1299
|
+
isIn: isIn,
|
|
1300
|
+
closeToast: closeToast,
|
|
1301
|
+
hide: hideProgressBar,
|
|
1302
|
+
type: type,
|
|
1303
|
+
style: progressStyle,
|
|
1304
|
+
className: progressClassName,
|
|
1305
|
+
controlledProgress: isProgressControlled,
|
|
1306
|
+
progress: progress
|
|
1307
|
+
}))));
|
|
1308
|
+
};
|
|
1309
|
+
|
|
1310
|
+
var Bounce = /*#__PURE__*/cssTransition({
|
|
1311
|
+
enter: "Toastify"
|
|
1312
|
+
/* CSS_NAMESPACE */
|
|
1313
|
+
+ "--animate " + "Toastify"
|
|
1314
|
+
/* CSS_NAMESPACE */
|
|
1315
|
+
+ "__bounce-enter",
|
|
1316
|
+
exit: "Toastify"
|
|
1317
|
+
/* CSS_NAMESPACE */
|
|
1318
|
+
+ "--animate " + "Toastify"
|
|
1319
|
+
/* CSS_NAMESPACE */
|
|
1320
|
+
+ "__bounce-exit",
|
|
1321
|
+
appendPosition: true
|
|
1322
|
+
});
|
|
1323
|
+
|
|
1324
|
+
var ToastContainer = function ToastContainer(props) {
|
|
1325
|
+
var _useToastContainer = useToastContainer(props),
|
|
1326
|
+
getToastToRender = _useToastContainer.getToastToRender,
|
|
1327
|
+
containerRef = _useToastContainer.containerRef,
|
|
1328
|
+
isToastActive = _useToastContainer.isToastActive;
|
|
1329
|
+
|
|
1330
|
+
var className = props.className,
|
|
1331
|
+
style = props.style,
|
|
1332
|
+
rtl = props.rtl,
|
|
1333
|
+
containerId = props.containerId;
|
|
1334
|
+
|
|
1335
|
+
function getClassName(position) {
|
|
1336
|
+
var _cx;
|
|
1337
|
+
|
|
1338
|
+
var defaultClassName = clsx("Toastify"
|
|
1339
|
+
/* CSS_NAMESPACE */
|
|
1340
|
+
+ "__toast-container", "Toastify"
|
|
1341
|
+
/* CSS_NAMESPACE */
|
|
1342
|
+
+ "__toast-container--" + position, (_cx = {}, _cx["Toastify"
|
|
1343
|
+
/* CSS_NAMESPACE */
|
|
1344
|
+
+ "__toast-container--rtl"] = rtl, _cx));
|
|
1345
|
+
return isFn(className) ? className({
|
|
1346
|
+
position: position,
|
|
1347
|
+
rtl: rtl,
|
|
1348
|
+
defaultClassName: defaultClassName
|
|
1349
|
+
}) : clsx(defaultClassName, parseClassName(className));
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
return createElement("div", {
|
|
1353
|
+
ref: containerRef,
|
|
1354
|
+
className: "Toastify"
|
|
1355
|
+
/* CSS_NAMESPACE */
|
|
1356
|
+
,
|
|
1357
|
+
id: containerId
|
|
1358
|
+
}, getToastToRender(function (position, toastList) {
|
|
1359
|
+
var containerStyle = !toastList.length ? _extends({}, style, {
|
|
1360
|
+
pointerEvents: 'none'
|
|
1361
|
+
}) : _extends({}, style);
|
|
1362
|
+
return createElement("div", {
|
|
1363
|
+
className: getClassName(position),
|
|
1364
|
+
style: containerStyle,
|
|
1365
|
+
key: "container-" + position
|
|
1366
|
+
}, toastList.map(function (_ref) {
|
|
1367
|
+
var content = _ref.content,
|
|
1368
|
+
toastProps = _ref.props;
|
|
1369
|
+
return createElement(Toast, Object.assign({}, toastProps, {
|
|
1370
|
+
isIn: isToastActive(toastProps.toastId),
|
|
1371
|
+
key: "toast-" + toastProps.key,
|
|
1372
|
+
closeButton: toastProps.closeButton === true ? CloseButton : toastProps.closeButton
|
|
1373
|
+
}), content);
|
|
1374
|
+
}));
|
|
1375
|
+
}));
|
|
1376
|
+
};
|
|
1377
|
+
ToastContainer.defaultProps = {
|
|
1378
|
+
position: POSITION.TOP_RIGHT,
|
|
1379
|
+
transition: Bounce,
|
|
1380
|
+
rtl: false,
|
|
1381
|
+
autoClose: 5000,
|
|
1382
|
+
hideProgressBar: false,
|
|
1383
|
+
closeButton: CloseButton,
|
|
1384
|
+
pauseOnHover: true,
|
|
1385
|
+
pauseOnFocusLoss: true,
|
|
1386
|
+
closeOnClick: true,
|
|
1387
|
+
newestOnTop: false,
|
|
1388
|
+
draggable: true,
|
|
1389
|
+
draggablePercent: 80
|
|
1390
|
+
/* DRAGGABLE_PERCENT */
|
|
1391
|
+
,
|
|
1392
|
+
draggableDirection: "x"
|
|
1393
|
+
/* X */
|
|
1394
|
+
,
|
|
1395
|
+
role: 'alert',
|
|
1396
|
+
theme: 'light'
|
|
1397
|
+
};
|
|
1398
|
+
|
|
1399
|
+
var containers = /*#__PURE__*/new Map();
|
|
1400
|
+
var latestInstance;
|
|
1401
|
+
var containerDomNode;
|
|
1402
|
+
var containerConfig;
|
|
1403
|
+
var queue = [];
|
|
1404
|
+
var lazy = false;
|
|
1405
|
+
/**
|
|
1406
|
+
* Get the toast by id, given it's in the DOM, otherwise returns null
|
|
1407
|
+
*/
|
|
1408
|
+
|
|
1409
|
+
function getToast(toastId, _ref) {
|
|
1410
|
+
var containerId = _ref.containerId;
|
|
1411
|
+
var container = containers.get(containerId || latestInstance);
|
|
1412
|
+
if (!container) return null;
|
|
1413
|
+
return container.getToast(toastId);
|
|
1414
|
+
}
|
|
1415
|
+
/**
|
|
1416
|
+
* Generate a random toastId
|
|
1417
|
+
*/
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
function generateToastId() {
|
|
1421
|
+
return Math.random().toString(36).substring(2, 9);
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* Generate a toastId or use the one provided
|
|
1425
|
+
*/
|
|
1426
|
+
|
|
1427
|
+
|
|
1428
|
+
function getToastId(options) {
|
|
1429
|
+
if (options && (isStr(options.toastId) || isNum(options.toastId))) {
|
|
1430
|
+
return options.toastId;
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
return generateToastId();
|
|
1434
|
+
}
|
|
1435
|
+
/**
|
|
1436
|
+
* If the container is not mounted, the toast is enqueued and
|
|
1437
|
+
* the container lazy mounted
|
|
1438
|
+
*/
|
|
1439
|
+
|
|
1440
|
+
|
|
1441
|
+
function dispatchToast(content, options) {
|
|
1442
|
+
if (containers.size > 0) {
|
|
1443
|
+
eventManager.emit(0
|
|
1444
|
+
/* Show */
|
|
1445
|
+
, content, options);
|
|
1446
|
+
} else {
|
|
1447
|
+
queue.push({
|
|
1448
|
+
content: content,
|
|
1449
|
+
options: options
|
|
1450
|
+
});
|
|
1451
|
+
|
|
1452
|
+
if (lazy && canUseDom) {
|
|
1453
|
+
lazy = false;
|
|
1454
|
+
containerDomNode = document.createElement('div');
|
|
1455
|
+
document.body.appendChild(containerDomNode);
|
|
1456
|
+
render(createElement(ToastContainer, Object.assign({}, containerConfig)), containerDomNode);
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
return options.toastId;
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Merge provided options with the defaults settings and generate the toastId
|
|
1464
|
+
*/
|
|
1465
|
+
|
|
1466
|
+
|
|
1467
|
+
function mergeOptions(type, options) {
|
|
1468
|
+
return _extends({}, options, {
|
|
1469
|
+
type: options && options.type || type,
|
|
1470
|
+
toastId: getToastId(options)
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
function createToastByType(type) {
|
|
1475
|
+
return function (content, options) {
|
|
1476
|
+
return dispatchToast(content, mergeOptions(type, options));
|
|
1477
|
+
};
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
function toast(content, options) {
|
|
1481
|
+
return dispatchToast(content, mergeOptions(TYPE.DEFAULT, options));
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
toast.loading = function (content, options) {
|
|
1485
|
+
return dispatchToast(content, mergeOptions(TYPE.DEFAULT, _extends({
|
|
1486
|
+
isLoading: true,
|
|
1487
|
+
autoClose: false,
|
|
1488
|
+
closeOnClick: false,
|
|
1489
|
+
closeButton: false,
|
|
1490
|
+
draggable: false
|
|
1491
|
+
}, options)));
|
|
1492
|
+
};
|
|
1493
|
+
|
|
1494
|
+
function handlePromise(promise, _ref2, options) {
|
|
1495
|
+
var pending = _ref2.pending,
|
|
1496
|
+
error = _ref2.error,
|
|
1497
|
+
success = _ref2.success;
|
|
1498
|
+
var id;
|
|
1499
|
+
|
|
1500
|
+
if (pending) {
|
|
1501
|
+
id = isStr(pending) ? toast.loading(pending, options) : toast.loading(pending.render, _extends({}, options, pending));
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
var resetParams = {
|
|
1505
|
+
isLoading: null,
|
|
1506
|
+
autoClose: null,
|
|
1507
|
+
closeOnClick: null,
|
|
1508
|
+
closeButton: null,
|
|
1509
|
+
draggable: null
|
|
1510
|
+
};
|
|
1511
|
+
|
|
1512
|
+
var resolver = function resolver(type, input, result) {
|
|
1513
|
+
// Remove the toast if the input has not been provided. This prevents the toast from hanging
|
|
1514
|
+
// in the pending state if a success/error toast has not been provided.
|
|
1515
|
+
if (input == null) {
|
|
1516
|
+
toast.dismiss(id);
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
var baseParams = _extends({
|
|
1521
|
+
type: type
|
|
1522
|
+
}, resetParams, options, {
|
|
1523
|
+
data: result
|
|
1524
|
+
});
|
|
1525
|
+
|
|
1526
|
+
var params = isStr(input) ? {
|
|
1527
|
+
render: input
|
|
1528
|
+
} : input; // if the id is set we know that it's an update
|
|
1529
|
+
|
|
1530
|
+
if (id) {
|
|
1531
|
+
toast.update(id, _extends({}, baseParams, params));
|
|
1532
|
+
} else {
|
|
1533
|
+
// using toast.promise without loading
|
|
1534
|
+
toast(params.render, _extends({}, baseParams, params));
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
return result;
|
|
1538
|
+
};
|
|
1539
|
+
|
|
1540
|
+
var p = isFn(promise) ? promise() : promise; //call the resolvers only when needed
|
|
1541
|
+
|
|
1542
|
+
p.then(function (result) {
|
|
1543
|
+
return resolver('success', success, result);
|
|
1544
|
+
})["catch"](function (err) {
|
|
1545
|
+
return resolver('error', error, err);
|
|
1546
|
+
});
|
|
1547
|
+
return p;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
toast.promise = handlePromise;
|
|
1551
|
+
toast.success = /*#__PURE__*/createToastByType(TYPE.SUCCESS);
|
|
1552
|
+
toast.info = /*#__PURE__*/createToastByType(TYPE.INFO);
|
|
1553
|
+
toast.error = /*#__PURE__*/createToastByType(TYPE.ERROR);
|
|
1554
|
+
toast.warning = /*#__PURE__*/createToastByType(TYPE.WARNING);
|
|
1555
|
+
toast.warn = toast.warning;
|
|
1556
|
+
|
|
1557
|
+
toast.dark = function (content, options) {
|
|
1558
|
+
return dispatchToast(content, mergeOptions(TYPE.DEFAULT, _extends({
|
|
1559
|
+
theme: 'dark'
|
|
1560
|
+
}, options)));
|
|
1561
|
+
};
|
|
1562
|
+
/**
|
|
1563
|
+
* Remove toast programmaticaly
|
|
1564
|
+
*/
|
|
1565
|
+
|
|
1566
|
+
|
|
1567
|
+
toast.dismiss = function (id) {
|
|
1568
|
+
return eventManager.emit(1
|
|
1569
|
+
/* Clear */
|
|
1570
|
+
, id);
|
|
1571
|
+
};
|
|
1572
|
+
/**
|
|
1573
|
+
* Clear waiting queue when limit is used
|
|
1574
|
+
*/
|
|
1575
|
+
|
|
1576
|
+
|
|
1577
|
+
toast.clearWaitingQueue = function (params) {
|
|
1578
|
+
if (params === void 0) {
|
|
1579
|
+
params = {};
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
return eventManager.emit(5
|
|
1583
|
+
/* ClearWaitingQueue */
|
|
1584
|
+
, params);
|
|
1585
|
+
};
|
|
1586
|
+
/**
|
|
1587
|
+
* return true if one container is displaying the toast
|
|
1588
|
+
*/
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
toast.isActive = function (id) {
|
|
1592
|
+
var isToastActive = false;
|
|
1593
|
+
containers.forEach(function (container) {
|
|
1594
|
+
if (container.isToastActive && container.isToastActive(id)) {
|
|
1595
|
+
isToastActive = true;
|
|
1596
|
+
}
|
|
1597
|
+
});
|
|
1598
|
+
return isToastActive;
|
|
1599
|
+
};
|
|
1600
|
+
|
|
1601
|
+
toast.update = function (toastId, options) {
|
|
1602
|
+
if (options === void 0) {
|
|
1603
|
+
options = {};
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
// if you call toast and toast.update directly nothing will be displayed
|
|
1607
|
+
// this is why I defered the update
|
|
1608
|
+
setTimeout(function () {
|
|
1609
|
+
var toast = getToast(toastId, options);
|
|
1610
|
+
|
|
1611
|
+
if (toast) {
|
|
1612
|
+
var oldOptions = toast.props,
|
|
1613
|
+
oldContent = toast.content;
|
|
1614
|
+
|
|
1615
|
+
var nextOptions = _extends({}, oldOptions, options, {
|
|
1616
|
+
toastId: options.toastId || toastId,
|
|
1617
|
+
updateId: generateToastId()
|
|
1618
|
+
});
|
|
1619
|
+
|
|
1620
|
+
if (nextOptions.toastId !== toastId) nextOptions.staleId = toastId;
|
|
1621
|
+
var content = nextOptions.render || oldContent;
|
|
1622
|
+
delete nextOptions.render;
|
|
1623
|
+
dispatchToast(content, nextOptions);
|
|
1624
|
+
}
|
|
1625
|
+
}, 0);
|
|
1626
|
+
};
|
|
1627
|
+
/**
|
|
1628
|
+
* Used for controlled progress bar.
|
|
1629
|
+
*/
|
|
1630
|
+
|
|
1631
|
+
|
|
1632
|
+
toast.done = function (id) {
|
|
1633
|
+
toast.update(id, {
|
|
1634
|
+
progress: 1
|
|
1635
|
+
});
|
|
1636
|
+
};
|
|
1637
|
+
/**
|
|
1638
|
+
* @deprecated
|
|
1639
|
+
* API will change in the next major release
|
|
1640
|
+
*
|
|
1641
|
+
* Track changes. The callback get the number of toast displayed
|
|
1642
|
+
*/
|
|
1643
|
+
|
|
1644
|
+
|
|
1645
|
+
toast.onChange = function (callback) {
|
|
1646
|
+
if (isFn(callback)) {
|
|
1647
|
+
eventManager.on(4
|
|
1648
|
+
/* Change */
|
|
1649
|
+
, callback);
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
return function () {
|
|
1653
|
+
isFn(callback) && eventManager.off(4
|
|
1654
|
+
/* Change */
|
|
1655
|
+
, callback);
|
|
1656
|
+
};
|
|
1657
|
+
};
|
|
1658
|
+
/**
|
|
1659
|
+
* @deprecated
|
|
1660
|
+
* will be removed in the next major release
|
|
1661
|
+
*
|
|
1662
|
+
* Configure the ToastContainer when lazy mounted
|
|
1663
|
+
* Prefer ToastContainer over this one
|
|
1664
|
+
*/
|
|
1665
|
+
|
|
1666
|
+
|
|
1667
|
+
toast.configure = function (config) {
|
|
1668
|
+
if (config === void 0) {
|
|
1669
|
+
config = {};
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
lazy = true;
|
|
1673
|
+
containerConfig = config;
|
|
1674
|
+
};
|
|
1675
|
+
|
|
1676
|
+
toast.POSITION = POSITION;
|
|
1677
|
+
toast.TYPE = TYPE;
|
|
1678
|
+
/**
|
|
1679
|
+
* Wait until the ToastContainer is mounted to dispatch the toast
|
|
1680
|
+
* and attach isActive method
|
|
1681
|
+
*/
|
|
1682
|
+
|
|
1683
|
+
eventManager.on(2
|
|
1684
|
+
/* DidMount */
|
|
1685
|
+
, function (containerInstance) {
|
|
1686
|
+
latestInstance = containerInstance.containerId || containerInstance;
|
|
1687
|
+
containers.set(latestInstance, containerInstance);
|
|
1688
|
+
queue.forEach(function (item) {
|
|
1689
|
+
eventManager.emit(0
|
|
1690
|
+
/* Show */
|
|
1691
|
+
, item.content, item.options);
|
|
1692
|
+
});
|
|
1693
|
+
queue = [];
|
|
1694
|
+
}).on(3
|
|
1695
|
+
/* WillUnmount */
|
|
1696
|
+
, function (containerInstance) {
|
|
1697
|
+
containers["delete"](containerInstance.containerId || containerInstance);
|
|
1698
|
+
|
|
1699
|
+
if (containers.size === 0) {
|
|
1700
|
+
eventManager.off(0
|
|
1701
|
+
/* Show */
|
|
1702
|
+
).off(1
|
|
1703
|
+
/* Clear */
|
|
1704
|
+
).off(5
|
|
1705
|
+
/* ClearWaitingQueue */
|
|
1706
|
+
);
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
if (canUseDom && containerDomNode) {
|
|
1710
|
+
document.body.removeChild(containerDomNode);
|
|
1711
|
+
}
|
|
1712
|
+
});
|
|
1713
|
+
|
|
1714
|
+
class ToastBody extends React__default.Component {
|
|
1715
|
+
render() {
|
|
1716
|
+
return (jsxs("div", Object.assign({ className: "toast" }, { children: [jsx("div", Object.assign({ className: "toast__title" }, { children: this.props.title })), this.props.subtitle && jsx("div", Object.assign({ className: "toast__subtitle" }, { children: this.props.subtitle }))] })));
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
class ToastBody3 extends React__default.Component {
|
|
1720
|
+
render() {
|
|
1721
|
+
return (jsxs("div", Object.assign({ className: "flex left column dc__app-update-toast" }, { children: [jsx("span", Object.assign({ className: "info" }, { children: this.props.text })), jsx("button", Object.assign({ type: "button", onClick: this.props.onClick }, { children: this.props.buttonText }))] })));
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
class ToastBodyWithButton extends React__default.Component {
|
|
1725
|
+
render() {
|
|
1726
|
+
return (jsxs("div", Object.assign({ className: "toast dc__app-update-toast" }, { children: [jsx("div", Object.assign({ className: "toast__title" }, { children: this.props.title })), this.props.subtitle && jsx("div", Object.assign({ className: "toast__subtitle" }, { children: this.props.subtitle })), jsx("button", Object.assign({ type: "button", onClick: this.props.onClick, style: { float: 'right' } }, { children: this.props.buttonText }))] })));
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
const toastAccessDenied = (subtitle) => {
|
|
1730
|
+
return toast.info(jsx(ToastBody, { title: "Access denied", subtitle: subtitle || "You do not have required access to perform this action" }), {
|
|
1731
|
+
className: 'devtron-toast unauthorized',
|
|
1732
|
+
});
|
|
1733
|
+
};
|
|
1734
|
+
|
|
1735
|
+
var loadingFailure = "b5d52f036bdcd3ed.png";
|
|
1736
|
+
|
|
1737
|
+
function Reload({ reload = null, className = '' }) {
|
|
1738
|
+
function refresh(e) {
|
|
1739
|
+
window.location.reload();
|
|
1740
|
+
}
|
|
1741
|
+
return (jsx("article", Object.assign({ className: `flex ${className}`, style: { width: '100%', height: '100%' } }, { children: jsxs("div", Object.assign({ className: "flex column", style: { width: '250px', textAlign: 'center' } }, { children: [jsx("img", { src: loadingFailure, style: { width: '100%', height: 'auto', marginBottom: '12px' }, alt: "load-error" }), jsx("h3", Object.assign({ className: "title dc__bold" }, { children: "Failed to load" })), jsx("div", Object.assign({ className: "dc__empty__subtitle", style: { marginBottom: '20px' } }, { children: "We could not load this page. Please give us another try." })), jsx("button", Object.assign({ type: "button", className: "cta ghosted", onClick: typeof reload === 'function' ? reload : refresh }, { children: "Retry" }))] })) })));
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
var notAuthorized = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%22250%22%20height%3D%22200%22%20viewBox%3D%220%200%20250%20200%22%3E%20%20%20%20%3Cdefs%3E%20%20%20%20%20%20%20%20%3ClinearGradient%20id%3D%22ho9etwod5c%22%20x1%3D%2255.01%25%22%20x2%3D%2240.976%25%22%20y1%3D%220%25%22%20y2%3D%22100%25%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20offset%3D%220%25%22%20stop-color%3D%22%232A318C%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20offset%3D%22100%25%22%20stop-color%3D%22%231D225F%22%2F%3E%20%20%20%20%20%20%20%20%3C%2FlinearGradient%3E%20%20%20%20%20%20%20%20%3ClinearGradient%20id%3D%22mdhg2gjypd%22%20x1%3D%2250%25%22%20x2%3D%2250%25%22%20y1%3D%220%25%22%20y2%3D%22100%25%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20offset%3D%220%25%22%20stop-color%3D%22%23EEE%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20offset%3D%22100%25%22%20stop-color%3D%22%23D6D7D8%22%2F%3E%20%20%20%20%20%20%20%20%3C%2FlinearGradient%3E%20%20%20%20%20%20%20%20%3ClinearGradient%20id%3D%22xe2mx0bk0e%22%20x1%3D%220%25%22%20x2%3D%22100%25%22%20y1%3D%2218%25%22%20y2%3D%2282%25%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20offset%3D%220%25%22%20stop-color%3D%22%23E8B73F%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cstop%20offset%3D%22100%25%22%20stop-color%3D%22%23CF9F36%22%2F%3E%20%20%20%20%20%20%20%20%3C%2FlinearGradient%3E%20%20%20%20%20%20%20%20%3Cpath%20id%3D%2288gkjk6cca%22%20d%3D%22M0%200H250V200H0z%22%2F%3E%20%20%20%20%3C%2Fdefs%3E%20%20%20%20%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%20%20%20%20%20%20%20%20%3Cg%3E%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20transform%3D%22translate%28-590%20-308%29%20translate%28590%20308%29%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cmask%20id%3D%22pitr2853ub%22%20fill%3D%22%23fff%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cuse%20xlink%3Ahref%3D%22%2388gkjk6cca%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fmask%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20mask%3D%22url%28%23pitr2853ub%29%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23FFF%22%20fill-rule%3D%22nonzero%22%20d%3D%22M47.646%200c2.598%200%205.717%201.017%207.994%202.74%202.276%201.722%203.845%203.02%204.55%205.097.465%201.372.252%203.282-.641%205.728l.008-.072c-.013.145-.039.269-.071.387.574-1.048%201.638-1.624%202.576-1.283%201.07.39%201.5%201.803%201.013%203.14-.487%201.337-1.723%202.144-2.794%201.754-.536-.195-.91-.646-1.09-1.216.023.975.09%202.117.203%203.427l-2.317.161c-2.223%202.412-4.574%203.48-7.055%203.207-.6-.067-1.158-.18-1.675-.339-.588%201.007-1.177%202.688-1.766%205.043l-.064.031.005-.043c-.585%205.627-1.014%2011.07-1.287%2016.327l.001-.108c-.013.958-.003%201.853.028%202.684l.109-1.533c2.141%201.735%204.344%202.776%206.608%203.123%202.263.348%205.76-.128%2010.49-1.426%202.808-.962%205.555-2.299%208.243-4.011H63.94l16.84-20.83h2.756c0-1.439%201.165-2.604%202.604-2.604%201.378%200%202.506%201.07%202.597%202.425l.006.178h1.736c0-1.438%201.166-2.603%202.604-2.603%201.378%200%202.506%201.07%202.598%202.425l.006.178h5.284L89.832%2035.292c.097-.07.17-.106.212-.106.692%200%20.692%205.306-.057%207.152-.289.865-4.73%205.71-9.864%2010.844-2.78%202.78-6.605%206.366-11.477%2010.759l2.511%2011.858c-.568%201.157-2.01%201.928-4.324%202.314-5.208.579-10.415-1.736-16.78-1.736-1.852%200-3.142.343-4.269.744.841%208.545%202.264%2016.398%204.269%2023.558-1.157%201.157-1.946%201.682-2.808%202.052-1.015.394-2.305.789-3.009.86.776%202.429%201.318%204.584%201.627%206.464.38%202.322%202.518%2022.156%206.411%2059.5h-.044l2.037%201.697c2.308%201.962%2012.796%207.547%2014.132%208.307.891.506%202.067%201.794%203.526%203.864-16.575-.025-27.78-.05-33.613-.075l.053.075C12.788%20183.385%200%20183.346%200%20183.308c0-.116%201.154-3.288%202.538-7.095l2.44-6.658H1.761c-.4-1.385-.792-3.254-1.175-5.606-.75-4.788-.18-7.96%203.05-14.536%203.23-6.518%204.866-10.072%204.866-13.764.058-5.768%201.222-11.316%204.28-17.315%202.364-4.73%203.495-5.086%203.725-7.97l.367-5.421c-2.382-.231-5.928-.988-8.045-1.693l-4.21-1.385-.116-4.326C4.214%2085.6%205.08%2076.89%207.79%2065.757%2011.482%2050.47%2022.096%2034.84%2034.959%2025.668c3.055-2.203%204.272-3.049%205.093-2.807.79-.548%201.483-1.096%202.077-1.645-1.685-.52-3.275-1.222-4.77-2.105-2.311-1.366-4.444-3.194-6.398-5.483.397-.834.904-1.524%201.522-2.07.671-.592%201.935-1.108%203.169-1.822l-.065.021-1.204.401c-1.26.424-1.956.713-2.396%201.032-.829.601-1.259%201.275-1.312%202.032l-.005.191-.579.007c-.012-1.039.516-1.943%201.557-2.699.427-.31%201.013-.573%201.983-.916l1.755-.59.612-.213c.593-.213%201.063-.401%201.438-.584%201.296-1.399%202.17-3.971%204.089-5.678C43.642.855%2045.048%200%2047.646%200zM27.999%20144.476l-.189.512c-2.603%207.055-5.679%2015.219-9.228%2024.493l2.126%201.771c2.307%201.962%2012.795%207.547%2014.132%208.307l.035.021c.364-1.006.782-2.154%201.223-3.367l2.44-6.658h-4.242c-1.444-2.617-2.166-4.456-2.166-5.517%200-1.59.913-3.77.913-6.068%200-1.393-1.68-5.89-5.044-13.494zM78.827%2042.819l-1.242-.001c-2.375%202.17-3.972%203.706-4.791%204.61-.72.793-2.112%202.23-4.176%204.309%203.033-1.194%205.06-2.078%206.083-2.65%201.5-.865%202.077-1.673%203.807-5.307.082-.163.192-.506.319-.961zm7.313-22.857c-1.119%200-2.026.907-2.026%202.025h4.05c0-1.118-.906-2.025-2.024-2.025zm6.943%200c-1.119%200-2.025.907-2.025%202.025h4.05c0-1.118-.907-2.025-2.025-2.025zm-33.27-5.413c-.388%201.066-.065%202.132.666%202.398.73.266%201.664-.343%202.052-1.408.388-1.065.064-2.132-.667-2.398-.73-.266-1.664.343-2.052%201.408z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%2380AEF2%22%20fill-rule%3D%22nonzero%22%20d%3D%22M36.56%20183.308c0-.116%201.153-3.288%202.538-7.095l2.538-6.922%206.46-.173%206.403-.173%202.768%202.307c2.308%201.962%2012.796%207.547%2014.132%208.307.891.506%202.067%201.794%203.526%203.864-25.577-.038-38.365-.077-38.365-.115z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%2394BBF8%22%20fill-rule%3D%22nonzero%22%20d%3D%22M3%20183.308c0-.116%201.154-3.288%202.538-7.095l2.538-6.922%206.46-.173%206.403-.173%202.769%202.307c2.307%201.962%2012.795%207.547%2014.132%208.307.89.506%202.066%201.794%203.525%203.864C15.788%20183.385%203%20183.346%203%20183.308z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%231D225F%22%20fill-rule%3D%22nonzero%22%20d%3D%22M46.655%20101.836c1.09%203.158%201.826%205.898%202.208%208.22.38%202.321%202.518%2022.155%206.411%2059.5H37.296c-1.444-2.618-2.166-4.457-2.166-5.518%200-1.59.913-3.77.913-6.068%200-1.532-2.034-6.823-6.104-15.871l3.931-39.349%2012.785-.914z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22url%28%23ho9etwod5c%29%22%20d%3D%22M21.554%20169.555H4.76c-.4-1.385-.792-3.254-1.175-5.606-.75-4.788-.18-7.96%203.05-14.536%203.23-6.518%204.866-10.072%204.866-13.764.058-5.768%201.222-11.316%204.28-17.315%202.364-4.73%203.495-5.086%203.725-7.97l.42-6.202h21.078c.512%201.433.696%204.075.55%207.925-.145%203.85-6.812%2023.006-20.001%2057.468z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20fill-rule%3D%22nonzero%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%2398BDF9%22%20d%3D%22M0%2024.302L16.84%203.472%2037.031%203.472%2019.592%2024.302z%22%20transform%3D%22translate%2829%208%29%20translate%2866.94%2018.516%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%232174DB%22%20d%3D%22M22.2.868c1.378%200%202.506%201.07%202.597%202.425l.006.179h-.578c0-1.119-.907-2.025-2.025-2.025-1.119%200-2.025.906-2.025%202.025%200%201.062.818%201.934%201.859%202.018l.166.007v.578c-1.438%200-2.604-1.165-2.604-2.603%200-1.438%201.166-2.604%202.604-2.604zM29.143.868c1.378%200%202.506%201.07%202.598%202.425l.006.179h-.579c0-1.119-.906-2.025-2.025-2.025-1.118%200-2.025.906-2.025%202.025%200%201.062.818%201.934%201.859%202.018l.166.007v.578c-1.438%200-2.604-1.165-2.604-2.603%200-1.438%201.166-2.604%202.604-2.604z%22%20transform%3D%22translate%2829%208%29%20translate%2866.94%2018.516%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23F3A29D%22%20fill-rule%3D%22nonzero%22%20d%3D%22M65.472%2046.829c2.807-.962%205.554-2.299%208.242-4.011h6.871c-2.375%202.17-3.972%203.706-4.791%204.61-.82.903-2.509%202.638-5.068%205.205-1.091%205.781-2.254%208.21-3.487%207.285-1.85-1.386-7.939-10.897-1.767-13.09z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23FAB6AF%22%20fill-rule%3D%22nonzero%22%20d%3D%22M69.254%2052.654c4.363-1.668%207.179-2.857%208.447-3.567%201.5-.865%202.077-1.673%203.807-5.307.23-.461.692-2.365%201.096-4.153.923-4.557%202.423-4.326%202.538.346.058%201.27.346%202.423.692%202.538.288.116%201.961-1.5%203.634-3.576%201.673-2.077%203.288-3.75%203.576-3.75.692%200%20.692%205.307-.057%207.153-.289.865-4.73%205.71-9.864%2010.844-3.422%203.423-8.431%208.068-15.026%2013.937l1.157-14.465z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23F3A29D%22%20fill-rule%3D%22nonzero%22%20d%3D%22M49.581%2027.774c.772-3.086%201.543-5.015%202.315-5.787-1.157-1.157-2.315-2.314-4.63-3.471-.77%201.543-2.314%203.086-4.628%204.629%200%202.314.771%203.857%202.314%204.629%201.543.771%203.086.771%204.63%200z%22%20transform%3D%22translate%2829%208%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22url%28%23mdhg2gjypd%29%22%20fill-rule%3D%22nonzero%22%20d%3D%22M12.858%2082.16c-2.365-.174-6.23-.981-8.48-1.731l-4.21-1.385-.115-4.326c-.289-11.94.577-20.65%203.288-31.782C7.032%2027.65%2017.646%2012.019%2030.509%202.847c4.96-3.576%205.076-3.576%206.518-1.153.634%201.153%201.96%202.307%202.884%202.653l2.161.594c-3.046%2029.324-1.87%2053.63%203.531%2072.917-1.157%201.158-1.946%201.682-2.808%202.052-1.039.403-2.365.807-3.057.865-.693.058-3%20.519-5.25%201.038-4.21.923-13.382%201.096-21.63.346z%22%20transform%3D%22translate%2829%208%29%20translate%287.45%2022.82%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23D6D7D8%22%20d%3D%22M58.022%2024.008l1.767%2011.311-19.972%202.645%201.106-15.653c2.141%201.735%204.344%202.776%206.608%203.123%202.263.348%205.76-.128%2010.49-1.426z%22%20transform%3D%22translate%2829%208%29%20translate%287.45%2022.82%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23E9E9E9%22%20fill-rule%3D%22nonzero%22%20d%3D%22M61.804%2029.833l4.903%2023.145c-.568%201.157-2.01%201.929-4.324%202.314-5.208.579-10.415-1.736-16.78-1.736-6.365%200-6.09%204.05-15.348.58-6.172-2.315-8.68-12.73-7.523-31.246l18.054-1.73c-.078%205.782.655%209.252%202.198%2010.409%201.512%201.134%207.569.601%2018.17-1.6l.65-.136z%22%20transform%3D%22translate%2829%208%29%20translate%287.45%2022.82%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23FAB6AF%22%20fill-rule%3D%22nonzero%22%20d%3D%22M29.082%207.444c1.07%201.52%201.488%203.536%201.253%206.049-.062.656-.376.883-.376%202.052%200%201.12.07%202.506.212%204.157l-2.317.161c-2.222%202.412-4.574%203.48-7.055%203.207-2.48-.275-4.251-1.343-5.31-3.207-2.18-4.023-1.621-7.444%201.675-10.262%203.296-2.818%207.269-3.537%2011.918-2.157z%22%20transform%3D%22translate%2829%208%29%20translate%2832.223%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23E94A47%22%20d%3D%22M18.423%200c2.598%200%205.717%201.017%207.994%202.74%202.277%201.722%203.845%203.02%204.55%205.097.47%201.384.248%203.314-.664%205.791.13-2.345-.048-3.647-.533-3.906-.67%201.653-1.595%201.987-2.703%202.787-.62.448-2.791.518-4.917.897-2.628%201.722-4.303%203.33-4.867%204.86-.448%201.218-.402%202.608.148%204.177l.126.339-.54.21c-.714-1.833-.81-3.478-.277-4.925.522-1.417%201.85-2.838%203.894-4.321-1.09.307-2.051.754-2.634%201.449-1.279%201.526-2.028%203.765-2.246%206.716-2.766-.5-5.305-1.433-7.617-2.8-2.312-1.366-4.445-3.194-6.398-5.483.396-.834.904-1.524%201.521-2.07.671-.592%201.935-1.108%203.169-1.822l-.065.021-1.204.401c-1.26.424-1.956.713-2.395%201.032-.83.601-1.26%201.275-1.313%202.032l-.005.191-.579.007c-.012-1.039.516-1.943%201.557-2.699.427-.31%201.013-.573%201.983-.916l1.756-.59.61-.213c.594-.213%201.064-.401%201.439-.584%201.296-1.399%202.17-3.971%204.09-5.678C14.418.855%2015.825%200%2018.422%200z%22%20transform%3D%22translate%2829%208%29%20translate%2832.223%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20fill%3D%22%23222768%22%20fill-rule%3D%22nonzero%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M1.025%203.16C1.622%201.52%203.194.563%204.56%201.06c1.061.386%201.653%201.524%201.586%202.781.36-.092.688-.137.988-.137l.208.008c.254.02.466.056.636.114.511-1.271%201.708-2.023%202.749-1.644%201.07.39%201.5%201.802%201.013%203.14-.487%201.337-1.723%202.143-2.794%201.754-.953-.347-1.397-1.504-1.14-2.697-.103-.038-.274-.072-.508-.09-.334-.025-.737.029-1.209.165l-.03.01c-.036.159-.083.318-.14.477-.597%201.64-2.17%202.597-3.536%202.1C1.017%206.543.428%204.8%201.025%203.16zm9.504-.434c-.73-.266-1.664.343-2.052%201.408-.388%201.065-.064%202.132.667%202.398.73.266%201.664-.343%202.052-1.408.387-1.066.064-2.132-.667-2.398zM4.362%201.604c-1.036-.378-2.297.39-2.793%201.754-.496%201.363-.024%202.762%201.012%203.14%201.036.376%202.298-.392%202.794-1.755s.023-2.762-1.013-3.14z%22%20transform%3D%22translate%2829%208%29%20translate%2832.223%29%20translate%2822.112%2010.415%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%20mask%3D%22url%28%23pitr2853ub%29%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23FFF%22%20d%3D%22M30%200c12.15%200%2022%209.85%2022%2022v11h8v48H0V33h8V22C8%209.973%2017.654.198%2029.637.004zm0%207.934c-7.755%200-14.067%206.309-14.067%2014.067V33h28.133V22c0-7.652-6.14-13.896-13.752-14.063z%22%20transform%3D%22translate%28134%2061%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%23D6D7D8%22%20d%3D%22M55%2034.3V22C55%209.85%2045.15%200%2033%200S11%209.85%2011%2022v12.3m7.933%200V22c0-7.757%206.312-14.066%2014.068-14.066%207.756%200%2014.065%206.31%2014.065%2014.067v12.298%22%20transform%3D%22translate%28134%2061%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22url%28%23xe2mx0bk0e%29%22%20d%3D%22M3%2033H63V81H3z%22%20transform%3D%22translate%28134%2061%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20fill%3D%22%233E3D4C%22%20fill-rule%3D%22nonzero%22%20d%3D%22M39%2056c0-3.314-2.686-6-6-6s-6%202.686-6%206c0%202.282%201.275%204.267%203.15%205.281l-.965%207.386h7.63l-.965-7.386C37.726%2060.267%2039%2058.282%2039%2056z%22%20transform%3D%22translate%28134%2061%29%22%2F%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%20%20%20%20%3C%2Fg%3E%20%20%20%20%3C%2Fg%3E%3C%2Fsvg%3E";
|
|
1745
|
+
|
|
1746
|
+
class ErrorScreenManager extends Component {
|
|
1747
|
+
getMessage() {
|
|
1748
|
+
switch (this.props.code) {
|
|
1749
|
+
case 400:
|
|
1750
|
+
return 'Bad Request';
|
|
1751
|
+
case 401:
|
|
1752
|
+
return 'Unauthorized';
|
|
1753
|
+
case 403:
|
|
1754
|
+
return jsx(ErrorScreenNotAuthorized, { subtitle: this.props.subtitle });
|
|
1755
|
+
case 404:
|
|
1756
|
+
return 'Not Found';
|
|
1757
|
+
case 500:
|
|
1758
|
+
return 'Internal Server Error';
|
|
1759
|
+
case 502:
|
|
1760
|
+
return 'Bad Gateway';
|
|
1761
|
+
case 503:
|
|
1762
|
+
return 'Service Temporarily Unavailable';
|
|
1763
|
+
default:
|
|
1764
|
+
return jsx(Reload, { className: this.props.reloadClass });
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
render() {
|
|
1768
|
+
let msg = this.getMessage();
|
|
1769
|
+
return (jsx("div", { children: jsx("h1", { children: msg }) }));
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
class ErrorScreenNotAuthorized extends Component {
|
|
1773
|
+
render() {
|
|
1774
|
+
return (jsxs(EmptyState, { children: [jsx(EmptyState.Image, { children: jsx("img", { src: notAuthorized, alt: "Not Authorized" }) }), jsx(EmptyState.Title, { children: jsx("h3", Object.assign({ className: "title" }, { children: "Not authorized" })) }), jsx(EmptyState.Subtitle, { children: this.props.subtitle
|
|
1775
|
+
? this.props.subtitle
|
|
1776
|
+
: "Looks like you don't have access to information on this page. Please contact your manager to request access." })] }));
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
1781
|
+
const objectToString = Object.prototype.toString;
|
|
1782
|
+
/**
|
|
1783
|
+
* Checks whether given value is an instance of the given built-in class.
|
|
1784
|
+
*
|
|
1785
|
+
* @param wat The value to be checked
|
|
1786
|
+
* @param className
|
|
1787
|
+
* @returns A boolean representing the result.
|
|
1788
|
+
*/
|
|
1789
|
+
function isBuiltin(wat, className) {
|
|
1790
|
+
return objectToString.call(wat) === `[object ${className}]`;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
/**
|
|
1794
|
+
* Checks whether given value's type is an object literal
|
|
1795
|
+
* {@link isPlainObject}.
|
|
1796
|
+
*
|
|
1797
|
+
* @param wat A value to be checked.
|
|
1798
|
+
* @returns A boolean representing the result.
|
|
1799
|
+
*/
|
|
1800
|
+
function isPlainObject(wat) {
|
|
1801
|
+
return isBuiltin(wat, 'Object');
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
/**
|
|
1805
|
+
* Checks whether given value has a then function.
|
|
1806
|
+
* @param wat A value to be checked.
|
|
1807
|
+
*/
|
|
1808
|
+
function isThenable(wat) {
|
|
1809
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
1810
|
+
return Boolean(wat && wat.then && typeof wat.then === 'function');
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
/** Internal global with common properties and Sentry extensions */
|
|
1814
|
+
|
|
1815
|
+
// The code below for 'isGlobalObj' and 'GLOBAL_OBJ' was copied from core-js before modification
|
|
1816
|
+
// https://github.com/zloirock/core-js/blob/1b944df55282cdc99c90db5f49eb0b6eda2cc0a3/packages/core-js/internals/global.js
|
|
1817
|
+
// core-js has the following licence:
|
|
1818
|
+
//
|
|
1819
|
+
// Copyright (c) 2014-2022 Denis Pushkarev
|
|
1820
|
+
//
|
|
1821
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1822
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
1823
|
+
// in the Software without restriction, including without limitation the rights
|
|
1824
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1825
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
1826
|
+
// furnished to do so, subject to the following conditions:
|
|
1827
|
+
//
|
|
1828
|
+
// The above copyright notice and this permission notice shall be included in
|
|
1829
|
+
// all copies or substantial portions of the Software.
|
|
1830
|
+
//
|
|
1831
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1832
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1833
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1834
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1835
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1836
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1837
|
+
// THE SOFTWARE.
|
|
1838
|
+
|
|
1839
|
+
/** Returns 'obj' if it's the global object, otherwise returns undefined */
|
|
1840
|
+
function isGlobalObj(obj) {
|
|
1841
|
+
return obj && obj.Math == Math ? obj : undefined;
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
/** Get's the global object for the current JavaScript runtime */
|
|
1845
|
+
const GLOBAL_OBJ =
|
|
1846
|
+
(typeof globalThis == 'object' && isGlobalObj(globalThis)) ||
|
|
1847
|
+
// eslint-disable-next-line no-restricted-globals
|
|
1848
|
+
(typeof window == 'object' && isGlobalObj(window)) ||
|
|
1849
|
+
(typeof self == 'object' && isGlobalObj(self)) ||
|
|
1850
|
+
(typeof global == 'object' && isGlobalObj(global)) ||
|
|
1851
|
+
(function () {
|
|
1852
|
+
return this;
|
|
1853
|
+
})() ||
|
|
1854
|
+
{};
|
|
1855
|
+
|
|
1856
|
+
/**
|
|
1857
|
+
* @deprecated Use GLOBAL_OBJ instead or WINDOW from @sentry/browser. This will be removed in v8
|
|
1858
|
+
*/
|
|
1859
|
+
function getGlobalObject() {
|
|
1860
|
+
return GLOBAL_OBJ ;
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
/**
|
|
1864
|
+
* Returns a global singleton contained in the global `__SENTRY__` object.
|
|
1865
|
+
*
|
|
1866
|
+
* If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory
|
|
1867
|
+
* function and added to the `__SENTRY__` object.
|
|
1868
|
+
*
|
|
1869
|
+
* @param name name of the global singleton on __SENTRY__
|
|
1870
|
+
* @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__`
|
|
1871
|
+
* @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `GLOBAL_OBJ`'s return value
|
|
1872
|
+
* @returns the singleton
|
|
1873
|
+
*/
|
|
1874
|
+
function getGlobalSingleton(name, creator, obj) {
|
|
1875
|
+
const gbl = (obj || GLOBAL_OBJ) ;
|
|
1876
|
+
const __SENTRY__ = (gbl.__SENTRY__ = gbl.__SENTRY__ || {});
|
|
1877
|
+
const singleton = __SENTRY__[name] || (__SENTRY__[name] = creator());
|
|
1878
|
+
return singleton;
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
/** Prefix for logging strings */
|
|
1882
|
+
const PREFIX = 'Sentry Logger ';
|
|
1883
|
+
|
|
1884
|
+
const CONSOLE_LEVELS = ['debug', 'info', 'warn', 'error', 'log', 'assert', 'trace'] ;
|
|
1885
|
+
|
|
1886
|
+
/**
|
|
1887
|
+
* Temporarily disable sentry console instrumentations.
|
|
1888
|
+
*
|
|
1889
|
+
* @param callback The function to run against the original `console` messages
|
|
1890
|
+
* @returns The results of the callback
|
|
1891
|
+
*/
|
|
1892
|
+
function consoleSandbox(callback) {
|
|
1893
|
+
if (!('console' in GLOBAL_OBJ)) {
|
|
1894
|
+
return callback();
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
const originalConsole = GLOBAL_OBJ.console ;
|
|
1898
|
+
const wrappedLevels = {};
|
|
1899
|
+
|
|
1900
|
+
// Restore all wrapped console methods
|
|
1901
|
+
CONSOLE_LEVELS.forEach(level => {
|
|
1902
|
+
// TODO(v7): Remove this check as it's only needed for Node 6
|
|
1903
|
+
const originalWrappedFunc =
|
|
1904
|
+
originalConsole[level] && (originalConsole[level] ).__sentry_original__;
|
|
1905
|
+
if (level in originalConsole && originalWrappedFunc) {
|
|
1906
|
+
wrappedLevels[level] = originalConsole[level] ;
|
|
1907
|
+
originalConsole[level] = originalWrappedFunc ;
|
|
1908
|
+
}
|
|
1909
|
+
});
|
|
1910
|
+
|
|
1911
|
+
try {
|
|
1912
|
+
return callback();
|
|
1913
|
+
} finally {
|
|
1914
|
+
// Revert restoration to wrapped state
|
|
1915
|
+
Object.keys(wrappedLevels).forEach(level => {
|
|
1916
|
+
originalConsole[level] = wrappedLevels[level ];
|
|
1917
|
+
});
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
function makeLogger() {
|
|
1922
|
+
let enabled = false;
|
|
1923
|
+
const logger = {
|
|
1924
|
+
enable: () => {
|
|
1925
|
+
enabled = true;
|
|
1926
|
+
},
|
|
1927
|
+
disable: () => {
|
|
1928
|
+
enabled = false;
|
|
1929
|
+
},
|
|
1930
|
+
};
|
|
1931
|
+
|
|
1932
|
+
if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {
|
|
1933
|
+
CONSOLE_LEVELS.forEach(name => {
|
|
1934
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1935
|
+
logger[name] = (...args) => {
|
|
1936
|
+
if (enabled) {
|
|
1937
|
+
consoleSandbox(() => {
|
|
1938
|
+
GLOBAL_OBJ.console[name](`${PREFIX}[${name}]:`, ...args);
|
|
1939
|
+
});
|
|
1940
|
+
}
|
|
1941
|
+
};
|
|
1942
|
+
});
|
|
1943
|
+
} else {
|
|
1944
|
+
CONSOLE_LEVELS.forEach(name => {
|
|
1945
|
+
logger[name] = () => undefined;
|
|
1946
|
+
});
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
return logger ;
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
// Ensure we only have a single logger instance, even if multiple versions of @sentry/utils are being used
|
|
1953
|
+
let logger;
|
|
1954
|
+
if ((typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__)) {
|
|
1955
|
+
logger = getGlobalSingleton('logger', makeLogger);
|
|
1956
|
+
} else {
|
|
1957
|
+
logger = makeLogger();
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
/**
|
|
1961
|
+
* Given any object, return a new object having removed all fields whose value was `undefined`.
|
|
1962
|
+
* Works recursively on objects and arrays.
|
|
1963
|
+
*
|
|
1964
|
+
* Attention: This function keeps circular references in the returned object.
|
|
1965
|
+
*/
|
|
1966
|
+
function dropUndefinedKeys(inputValue) {
|
|
1967
|
+
// This map keeps track of what already visited nodes map to.
|
|
1968
|
+
// Our Set - based memoBuilder doesn't work here because we want to the output object to have the same circular
|
|
1969
|
+
// references as the input object.
|
|
1970
|
+
const memoizationMap = new Map();
|
|
1971
|
+
|
|
1972
|
+
// This function just proxies `_dropUndefinedKeys` to keep the `memoBuilder` out of this function's API
|
|
1973
|
+
return _dropUndefinedKeys(inputValue, memoizationMap);
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
function _dropUndefinedKeys(inputValue, memoizationMap) {
|
|
1977
|
+
if (isPlainObject(inputValue)) {
|
|
1978
|
+
// If this node has already been visited due to a circular reference, return the object it was mapped to in the new object
|
|
1979
|
+
const memoVal = memoizationMap.get(inputValue);
|
|
1980
|
+
if (memoVal !== undefined) {
|
|
1981
|
+
return memoVal ;
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
const returnValue = {};
|
|
1985
|
+
// Store the mapping of this value in case we visit it again, in case of circular data
|
|
1986
|
+
memoizationMap.set(inputValue, returnValue);
|
|
1987
|
+
|
|
1988
|
+
for (const key of Object.keys(inputValue)) {
|
|
1989
|
+
if (typeof inputValue[key] !== 'undefined') {
|
|
1990
|
+
returnValue[key] = _dropUndefinedKeys(inputValue[key], memoizationMap);
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
return returnValue ;
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
if (Array.isArray(inputValue)) {
|
|
1998
|
+
// If this node has already been visited due to a circular reference, return the array it was mapped to in the new object
|
|
1999
|
+
const memoVal = memoizationMap.get(inputValue);
|
|
2000
|
+
if (memoVal !== undefined) {
|
|
2001
|
+
return memoVal ;
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
const returnValue = [];
|
|
2005
|
+
// Store the mapping of this value in case we visit it again, in case of circular data
|
|
2006
|
+
memoizationMap.set(inputValue, returnValue);
|
|
2007
|
+
|
|
2008
|
+
inputValue.forEach((item) => {
|
|
2009
|
+
returnValue.push(_dropUndefinedKeys(item, memoizationMap));
|
|
2010
|
+
});
|
|
2011
|
+
|
|
2012
|
+
return returnValue ;
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
return inputValue;
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
/**
|
|
2019
|
+
* UUID4 generator
|
|
2020
|
+
*
|
|
2021
|
+
* @returns string Generated UUID4.
|
|
2022
|
+
*/
|
|
2023
|
+
function uuid4() {
|
|
2024
|
+
const gbl = GLOBAL_OBJ ;
|
|
2025
|
+
const crypto = gbl.crypto || gbl.msCrypto;
|
|
2026
|
+
|
|
2027
|
+
if (crypto && crypto.randomUUID) {
|
|
2028
|
+
return crypto.randomUUID().replace(/-/g, '');
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
const getRandomByte =
|
|
2032
|
+
crypto && crypto.getRandomValues ? () => crypto.getRandomValues(new Uint8Array(1))[0] : () => Math.random() * 16;
|
|
2033
|
+
|
|
2034
|
+
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523
|
|
2035
|
+
// Concatenating the following numbers as strings results in '10000000100040008000100000000000'
|
|
2036
|
+
return (([1e7] ) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, c =>
|
|
2037
|
+
// eslint-disable-next-line no-bitwise
|
|
2038
|
+
((c ) ^ ((getRandomByte() & 15) >> ((c ) / 4))).toString(16),
|
|
2039
|
+
);
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
/**
|
|
2043
|
+
* Checks whether the given input is already an array, and if it isn't, wraps it in one.
|
|
2044
|
+
*
|
|
2045
|
+
* @param maybeArray Input to turn into an array, if necessary
|
|
2046
|
+
* @returns The input, if already an array, or an array with the input as the only element, if not
|
|
2047
|
+
*/
|
|
2048
|
+
function arrayify(maybeArray) {
|
|
2049
|
+
return Array.isArray(maybeArray) ? maybeArray : [maybeArray];
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
/*
|
|
2053
|
+
* This module exists for optimizations in the build process through rollup and terser. We define some global
|
|
2054
|
+
* constants, which can be overridden during build. By guarding certain pieces of code with functions that return these
|
|
2055
|
+
* constants, we can control whether or not they appear in the final bundle. (Any code guarded by a false condition will
|
|
2056
|
+
* never run, and will hence be dropped during treeshaking.) The two primary uses for this are stripping out calls to
|
|
2057
|
+
* `logger` and preventing node-related code from appearing in browser bundles.
|
|
2058
|
+
*
|
|
2059
|
+
* Attention:
|
|
2060
|
+
* This file should not be used to define constants/flags that are intended to be used for tree-shaking conducted by
|
|
2061
|
+
* users. These fags should live in their respective packages, as we identified user tooling (specifically webpack)
|
|
2062
|
+
* having issues tree-shaking these constants across package boundaries.
|
|
2063
|
+
* An example for this is the __SENTRY_DEBUG__ constant. It is declared in each package individually because we want
|
|
2064
|
+
* users to be able to shake away expressions that it guards.
|
|
2065
|
+
*/
|
|
2066
|
+
|
|
2067
|
+
/**
|
|
2068
|
+
* Figures out if we're building a browser bundle.
|
|
2069
|
+
*
|
|
2070
|
+
* @returns true if this is a browser bundle build.
|
|
2071
|
+
*/
|
|
2072
|
+
function isBrowserBundle() {
|
|
2073
|
+
return typeof __SENTRY_BROWSER_BUNDLE__ !== 'undefined' && !!__SENTRY_BROWSER_BUNDLE__;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
/**
|
|
2077
|
+
* NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,
|
|
2078
|
+
* you must either a) use `console.log` rather than the logger, or b) put your function elsewhere.
|
|
2079
|
+
*/
|
|
2080
|
+
|
|
2081
|
+
/**
|
|
2082
|
+
* Checks whether we're in the Node.js or Browser environment
|
|
2083
|
+
*
|
|
2084
|
+
* @returns Answer to given question
|
|
2085
|
+
*/
|
|
2086
|
+
function isNodeEnv() {
|
|
2087
|
+
// explicitly check for browser bundles as those can be optimized statically
|
|
2088
|
+
// by terser/rollup.
|
|
2089
|
+
return (
|
|
2090
|
+
!isBrowserBundle() &&
|
|
2091
|
+
Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'
|
|
2092
|
+
);
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
/**
|
|
2096
|
+
* Requires a module which is protected against bundler minification.
|
|
2097
|
+
*
|
|
2098
|
+
* @param request The module path to resolve
|
|
2099
|
+
*/
|
|
2100
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
|
2101
|
+
function dynamicRequire(mod, request) {
|
|
2102
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2103
|
+
return mod.require(request);
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
2107
|
+
|
|
2108
|
+
/** SyncPromise internal states */
|
|
2109
|
+
var States; (function (States) {
|
|
2110
|
+
/** Pending */
|
|
2111
|
+
const PENDING = 0; States[States["PENDING"] = PENDING] = "PENDING";
|
|
2112
|
+
/** Resolved / OK */
|
|
2113
|
+
const RESOLVED = 1; States[States["RESOLVED"] = RESOLVED] = "RESOLVED";
|
|
2114
|
+
/** Rejected / Error */
|
|
2115
|
+
const REJECTED = 2; States[States["REJECTED"] = REJECTED] = "REJECTED";
|
|
2116
|
+
})(States || (States = {}));
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* Thenable class that behaves like a Promise and follows it's interface
|
|
2120
|
+
* but is not async internally
|
|
2121
|
+
*/
|
|
2122
|
+
class SyncPromise {
|
|
2123
|
+
__init() {this._state = States.PENDING;}
|
|
2124
|
+
__init2() {this._handlers = [];}
|
|
2125
|
+
|
|
2126
|
+
constructor(
|
|
2127
|
+
executor,
|
|
2128
|
+
) {SyncPromise.prototype.__init.call(this);SyncPromise.prototype.__init2.call(this);SyncPromise.prototype.__init3.call(this);SyncPromise.prototype.__init4.call(this);SyncPromise.prototype.__init5.call(this);SyncPromise.prototype.__init6.call(this);
|
|
2129
|
+
try {
|
|
2130
|
+
executor(this._resolve, this._reject);
|
|
2131
|
+
} catch (e) {
|
|
2132
|
+
this._reject(e);
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
/** JSDoc */
|
|
2137
|
+
then(
|
|
2138
|
+
onfulfilled,
|
|
2139
|
+
onrejected,
|
|
2140
|
+
) {
|
|
2141
|
+
return new SyncPromise((resolve, reject) => {
|
|
2142
|
+
this._handlers.push([
|
|
2143
|
+
false,
|
|
2144
|
+
result => {
|
|
2145
|
+
if (!onfulfilled) {
|
|
2146
|
+
// TODO: ¯\_(ツ)_/¯
|
|
2147
|
+
// TODO: FIXME
|
|
2148
|
+
resolve(result );
|
|
2149
|
+
} else {
|
|
2150
|
+
try {
|
|
2151
|
+
resolve(onfulfilled(result));
|
|
2152
|
+
} catch (e) {
|
|
2153
|
+
reject(e);
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
},
|
|
2157
|
+
reason => {
|
|
2158
|
+
if (!onrejected) {
|
|
2159
|
+
reject(reason);
|
|
2160
|
+
} else {
|
|
2161
|
+
try {
|
|
2162
|
+
resolve(onrejected(reason));
|
|
2163
|
+
} catch (e) {
|
|
2164
|
+
reject(e);
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
},
|
|
2168
|
+
]);
|
|
2169
|
+
this._executeHandlers();
|
|
2170
|
+
});
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
/** JSDoc */
|
|
2174
|
+
catch(
|
|
2175
|
+
onrejected,
|
|
2176
|
+
) {
|
|
2177
|
+
return this.then(val => val, onrejected);
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
/** JSDoc */
|
|
2181
|
+
finally(onfinally) {
|
|
2182
|
+
return new SyncPromise((resolve, reject) => {
|
|
2183
|
+
let val;
|
|
2184
|
+
let isRejected;
|
|
2185
|
+
|
|
2186
|
+
return this.then(
|
|
2187
|
+
value => {
|
|
2188
|
+
isRejected = false;
|
|
2189
|
+
val = value;
|
|
2190
|
+
if (onfinally) {
|
|
2191
|
+
onfinally();
|
|
2192
|
+
}
|
|
2193
|
+
},
|
|
2194
|
+
reason => {
|
|
2195
|
+
isRejected = true;
|
|
2196
|
+
val = reason;
|
|
2197
|
+
if (onfinally) {
|
|
2198
|
+
onfinally();
|
|
2199
|
+
}
|
|
2200
|
+
},
|
|
2201
|
+
).then(() => {
|
|
2202
|
+
if (isRejected) {
|
|
2203
|
+
reject(val);
|
|
2204
|
+
return;
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
resolve(val );
|
|
2208
|
+
});
|
|
2209
|
+
});
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2212
|
+
/** JSDoc */
|
|
2213
|
+
__init3() {this._resolve = (value) => {
|
|
2214
|
+
this._setResult(States.RESOLVED, value);
|
|
2215
|
+
};}
|
|
2216
|
+
|
|
2217
|
+
/** JSDoc */
|
|
2218
|
+
__init4() {this._reject = (reason) => {
|
|
2219
|
+
this._setResult(States.REJECTED, reason);
|
|
2220
|
+
};}
|
|
2221
|
+
|
|
2222
|
+
/** JSDoc */
|
|
2223
|
+
__init5() {this._setResult = (state, value) => {
|
|
2224
|
+
if (this._state !== States.PENDING) {
|
|
2225
|
+
return;
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
if (isThenable(value)) {
|
|
2229
|
+
void (value ).then(this._resolve, this._reject);
|
|
2230
|
+
return;
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
this._state = state;
|
|
2234
|
+
this._value = value;
|
|
2235
|
+
|
|
2236
|
+
this._executeHandlers();
|
|
2237
|
+
};}
|
|
2238
|
+
|
|
2239
|
+
/** JSDoc */
|
|
2240
|
+
__init6() {this._executeHandlers = () => {
|
|
2241
|
+
if (this._state === States.PENDING) {
|
|
2242
|
+
return;
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
const cachedHandlers = this._handlers.slice();
|
|
2246
|
+
this._handlers = [];
|
|
2247
|
+
|
|
2248
|
+
cachedHandlers.forEach(handler => {
|
|
2249
|
+
if (handler[0]) {
|
|
2250
|
+
return;
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
if (this._state === States.RESOLVED) {
|
|
2254
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
2255
|
+
handler[1](this._value );
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
if (this._state === States.REJECTED) {
|
|
2259
|
+
handler[2](this._value);
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
handler[0] = true;
|
|
2263
|
+
});
|
|
2264
|
+
};}
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
2268
|
+
const WINDOW = getGlobalObject();
|
|
2269
|
+
|
|
2270
|
+
/**
|
|
2271
|
+
* An object that can return the current timestamp in seconds since the UNIX epoch.
|
|
2272
|
+
*/
|
|
2273
|
+
|
|
2274
|
+
/**
|
|
2275
|
+
* A TimestampSource implementation for environments that do not support the Performance Web API natively.
|
|
2276
|
+
*
|
|
2277
|
+
* Note that this TimestampSource does not use a monotonic clock. A call to `nowSeconds` may return a timestamp earlier
|
|
2278
|
+
* than a previously returned value. We do not try to emulate a monotonic behavior in order to facilitate debugging. It
|
|
2279
|
+
* is more obvious to explain "why does my span have negative duration" than "why my spans have zero duration".
|
|
2280
|
+
*/
|
|
2281
|
+
const dateTimestampSource = {
|
|
2282
|
+
nowSeconds: () => Date.now() / 1000,
|
|
2283
|
+
};
|
|
2284
|
+
|
|
2285
|
+
/**
|
|
2286
|
+
* A partial definition of the [Performance Web API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance}
|
|
2287
|
+
* for accessing a high-resolution monotonic clock.
|
|
2288
|
+
*/
|
|
2289
|
+
|
|
2290
|
+
/**
|
|
2291
|
+
* Returns a wrapper around the native Performance API browser implementation, or undefined for browsers that do not
|
|
2292
|
+
* support the API.
|
|
2293
|
+
*
|
|
2294
|
+
* Wrapping the native API works around differences in behavior from different browsers.
|
|
2295
|
+
*/
|
|
2296
|
+
function getBrowserPerformance() {
|
|
2297
|
+
const { performance } = WINDOW;
|
|
2298
|
+
if (!performance || !performance.now) {
|
|
2299
|
+
return undefined;
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
// Replace performance.timeOrigin with our own timeOrigin based on Date.now().
|
|
2303
|
+
//
|
|
2304
|
+
// This is a partial workaround for browsers reporting performance.timeOrigin such that performance.timeOrigin +
|
|
2305
|
+
// performance.now() gives a date arbitrarily in the past.
|
|
2306
|
+
//
|
|
2307
|
+
// Additionally, computing timeOrigin in this way fills the gap for browsers where performance.timeOrigin is
|
|
2308
|
+
// undefined.
|
|
2309
|
+
//
|
|
2310
|
+
// The assumption that performance.timeOrigin + performance.now() ~= Date.now() is flawed, but we depend on it to
|
|
2311
|
+
// interact with data coming out of performance entries.
|
|
2312
|
+
//
|
|
2313
|
+
// Note that despite recommendations against it in the spec, browsers implement the Performance API with a clock that
|
|
2314
|
+
// might stop when the computer is asleep (and perhaps under other circumstances). Such behavior causes
|
|
2315
|
+
// performance.timeOrigin + performance.now() to have an arbitrary skew over Date.now(). In laptop computers, we have
|
|
2316
|
+
// observed skews that can be as long as days, weeks or months.
|
|
2317
|
+
//
|
|
2318
|
+
// See https://github.com/getsentry/sentry-javascript/issues/2590.
|
|
2319
|
+
//
|
|
2320
|
+
// BUG: despite our best intentions, this workaround has its limitations. It mostly addresses timings of pageload
|
|
2321
|
+
// transactions, but ignores the skew built up over time that can aversely affect timestamps of navigation
|
|
2322
|
+
// transactions of long-lived web pages.
|
|
2323
|
+
const timeOrigin = Date.now() - performance.now();
|
|
2324
|
+
|
|
2325
|
+
return {
|
|
2326
|
+
now: () => performance.now(),
|
|
2327
|
+
timeOrigin,
|
|
2328
|
+
};
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
/**
|
|
2332
|
+
* Returns the native Performance API implementation from Node.js. Returns undefined in old Node.js versions that don't
|
|
2333
|
+
* implement the API.
|
|
2334
|
+
*/
|
|
2335
|
+
function getNodePerformance() {
|
|
2336
|
+
try {
|
|
2337
|
+
const perfHooks = dynamicRequire(module, 'perf_hooks') ;
|
|
2338
|
+
return perfHooks.performance;
|
|
2339
|
+
} catch (_) {
|
|
2340
|
+
return undefined;
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
/**
|
|
2345
|
+
* The Performance API implementation for the current platform, if available.
|
|
2346
|
+
*/
|
|
2347
|
+
const platformPerformance = isNodeEnv() ? getNodePerformance() : getBrowserPerformance();
|
|
2348
|
+
|
|
2349
|
+
const timestampSource =
|
|
2350
|
+
platformPerformance === undefined
|
|
2351
|
+
? dateTimestampSource
|
|
2352
|
+
: {
|
|
2353
|
+
nowSeconds: () => (platformPerformance.timeOrigin + platformPerformance.now()) / 1000,
|
|
2354
|
+
};
|
|
2355
|
+
|
|
2356
|
+
/**
|
|
2357
|
+
* Returns a timestamp in seconds since the UNIX epoch using the Date API.
|
|
2358
|
+
*/
|
|
2359
|
+
const dateTimestampInSeconds = dateTimestampSource.nowSeconds.bind(dateTimestampSource);
|
|
2360
|
+
|
|
2361
|
+
/**
|
|
2362
|
+
* Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the
|
|
2363
|
+
* availability of the Performance API.
|
|
2364
|
+
*
|
|
2365
|
+
* See `usingPerformanceAPI` to test whether the Performance API is used.
|
|
2366
|
+
*
|
|
2367
|
+
* BUG: Note that because of how browsers implement the Performance API, the clock might stop when the computer is
|
|
2368
|
+
* asleep. This creates a skew between `dateTimestampInSeconds` and `timestampInSeconds`. The
|
|
2369
|
+
* skew can grow to arbitrary amounts like days, weeks or months.
|
|
2370
|
+
* See https://github.com/getsentry/sentry-javascript/issues/2590.
|
|
2371
|
+
*/
|
|
2372
|
+
const timestampInSeconds = timestampSource.nowSeconds.bind(timestampSource);
|
|
2373
|
+
|
|
2374
|
+
/**
|
|
2375
|
+
* The number of milliseconds since the UNIX epoch. This value is only usable in a browser, and only when the
|
|
2376
|
+
* performance API is available.
|
|
2377
|
+
*/
|
|
2378
|
+
(() => {
|
|
2379
|
+
// Unfortunately browsers may report an inaccurate time origin data, through either performance.timeOrigin or
|
|
2380
|
+
// performance.timing.navigationStart, which results in poor results in performance data. We only treat time origin
|
|
2381
|
+
// data as reliable if they are within a reasonable threshold of the current time.
|
|
2382
|
+
|
|
2383
|
+
const { performance } = WINDOW;
|
|
2384
|
+
if (!performance || !performance.now) {
|
|
2385
|
+
return undefined;
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
const threshold = 3600 * 1000;
|
|
2389
|
+
const performanceNow = performance.now();
|
|
2390
|
+
const dateNow = Date.now();
|
|
2391
|
+
|
|
2392
|
+
// if timeOrigin isn't available set delta to threshold so it isn't used
|
|
2393
|
+
const timeOriginDelta = performance.timeOrigin
|
|
2394
|
+
? Math.abs(performance.timeOrigin + performanceNow - dateNow)
|
|
2395
|
+
: threshold;
|
|
2396
|
+
const timeOriginIsReliable = timeOriginDelta < threshold;
|
|
2397
|
+
|
|
2398
|
+
// While performance.timing.navigationStart is deprecated in favor of performance.timeOrigin, performance.timeOrigin
|
|
2399
|
+
// is not as widely supported. Namely, performance.timeOrigin is undefined in Safari as of writing.
|
|
2400
|
+
// Also as of writing, performance.timing is not available in Web Workers in mainstream browsers, so it is not always
|
|
2401
|
+
// a valid fallback. In the absence of an initial time provided by the browser, fallback to the current time from the
|
|
2402
|
+
// Date API.
|
|
2403
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
2404
|
+
const navigationStart = performance.timing && performance.timing.navigationStart;
|
|
2405
|
+
const hasNavigationStart = typeof navigationStart === 'number';
|
|
2406
|
+
// if navigationStart isn't available set delta to threshold so it isn't used
|
|
2407
|
+
const navigationStartDelta = hasNavigationStart ? Math.abs(navigationStart + performanceNow - dateNow) : threshold;
|
|
2408
|
+
const navigationStartIsReliable = navigationStartDelta < threshold;
|
|
2409
|
+
|
|
2410
|
+
if (timeOriginIsReliable || navigationStartIsReliable) {
|
|
2411
|
+
// Use the more reliable time origin
|
|
2412
|
+
if (timeOriginDelta <= navigationStartDelta) {
|
|
2413
|
+
return performance.timeOrigin;
|
|
2414
|
+
} else {
|
|
2415
|
+
return navigationStart;
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
return dateNow;
|
|
2419
|
+
})();
|
|
2420
|
+
|
|
2421
|
+
/**
|
|
2422
|
+
* Creates a new `Session` object by setting certain default parameters. If optional @param context
|
|
2423
|
+
* is passed, the passed properties are applied to the session object.
|
|
2424
|
+
*
|
|
2425
|
+
* @param context (optional) additional properties to be applied to the returned session object
|
|
2426
|
+
*
|
|
2427
|
+
* @returns a new `Session` object
|
|
2428
|
+
*/
|
|
2429
|
+
function makeSession(context) {
|
|
2430
|
+
// Both timestamp and started are in seconds since the UNIX epoch.
|
|
2431
|
+
const startingTime = timestampInSeconds();
|
|
2432
|
+
|
|
2433
|
+
const session = {
|
|
2434
|
+
sid: uuid4(),
|
|
2435
|
+
init: true,
|
|
2436
|
+
timestamp: startingTime,
|
|
2437
|
+
started: startingTime,
|
|
2438
|
+
duration: 0,
|
|
2439
|
+
status: 'ok',
|
|
2440
|
+
errors: 0,
|
|
2441
|
+
ignoreDuration: false,
|
|
2442
|
+
toJSON: () => sessionToJSON(session),
|
|
2443
|
+
};
|
|
2444
|
+
|
|
2445
|
+
if (context) {
|
|
2446
|
+
updateSession(session, context);
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
return session;
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
/**
|
|
2453
|
+
* Updates a session object with the properties passed in the context.
|
|
2454
|
+
*
|
|
2455
|
+
* Note that this function mutates the passed object and returns void.
|
|
2456
|
+
* (Had to do this instead of returning a new and updated session because closing and sending a session
|
|
2457
|
+
* makes an update to the session after it was passed to the sending logic.
|
|
2458
|
+
* @see BaseClient.captureSession )
|
|
2459
|
+
*
|
|
2460
|
+
* @param session the `Session` to update
|
|
2461
|
+
* @param context the `SessionContext` holding the properties that should be updated in @param session
|
|
2462
|
+
*/
|
|
2463
|
+
// eslint-disable-next-line complexity
|
|
2464
|
+
function updateSession(session, context = {}) {
|
|
2465
|
+
if (context.user) {
|
|
2466
|
+
if (!session.ipAddress && context.user.ip_address) {
|
|
2467
|
+
session.ipAddress = context.user.ip_address;
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
if (!session.did && !context.did) {
|
|
2471
|
+
session.did = context.user.id || context.user.email || context.user.username;
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
session.timestamp = context.timestamp || timestampInSeconds();
|
|
2476
|
+
|
|
2477
|
+
if (context.ignoreDuration) {
|
|
2478
|
+
session.ignoreDuration = context.ignoreDuration;
|
|
2479
|
+
}
|
|
2480
|
+
if (context.sid) {
|
|
2481
|
+
// Good enough uuid validation. — Kamil
|
|
2482
|
+
session.sid = context.sid.length === 32 ? context.sid : uuid4();
|
|
2483
|
+
}
|
|
2484
|
+
if (context.init !== undefined) {
|
|
2485
|
+
session.init = context.init;
|
|
2486
|
+
}
|
|
2487
|
+
if (!session.did && context.did) {
|
|
2488
|
+
session.did = `${context.did}`;
|
|
2489
|
+
}
|
|
2490
|
+
if (typeof context.started === 'number') {
|
|
2491
|
+
session.started = context.started;
|
|
2492
|
+
}
|
|
2493
|
+
if (session.ignoreDuration) {
|
|
2494
|
+
session.duration = undefined;
|
|
2495
|
+
} else if (typeof context.duration === 'number') {
|
|
2496
|
+
session.duration = context.duration;
|
|
2497
|
+
} else {
|
|
2498
|
+
const duration = session.timestamp - session.started;
|
|
2499
|
+
session.duration = duration >= 0 ? duration : 0;
|
|
2500
|
+
}
|
|
2501
|
+
if (context.release) {
|
|
2502
|
+
session.release = context.release;
|
|
2503
|
+
}
|
|
2504
|
+
if (context.environment) {
|
|
2505
|
+
session.environment = context.environment;
|
|
2506
|
+
}
|
|
2507
|
+
if (!session.ipAddress && context.ipAddress) {
|
|
2508
|
+
session.ipAddress = context.ipAddress;
|
|
2509
|
+
}
|
|
2510
|
+
if (!session.userAgent && context.userAgent) {
|
|
2511
|
+
session.userAgent = context.userAgent;
|
|
2512
|
+
}
|
|
2513
|
+
if (typeof context.errors === 'number') {
|
|
2514
|
+
session.errors = context.errors;
|
|
2515
|
+
}
|
|
2516
|
+
if (context.status) {
|
|
2517
|
+
session.status = context.status;
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
/**
|
|
2522
|
+
* Closes a session by setting its status and updating the session object with it.
|
|
2523
|
+
* Internally calls `updateSession` to update the passed session object.
|
|
2524
|
+
*
|
|
2525
|
+
* Note that this function mutates the passed session (@see updateSession for explanation).
|
|
2526
|
+
*
|
|
2527
|
+
* @param session the `Session` object to be closed
|
|
2528
|
+
* @param status the `SessionStatus` with which the session was closed. If you don't pass a status,
|
|
2529
|
+
* this function will keep the previously set status, unless it was `'ok'` in which case
|
|
2530
|
+
* it is changed to `'exited'`.
|
|
2531
|
+
*/
|
|
2532
|
+
function closeSession(session, status) {
|
|
2533
|
+
let context = {};
|
|
2534
|
+
if (status) {
|
|
2535
|
+
context = { status };
|
|
2536
|
+
} else if (session.status === 'ok') {
|
|
2537
|
+
context = { status: 'exited' };
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
updateSession(session, context);
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
/**
|
|
2544
|
+
* Serializes a passed session object to a JSON object with a slightly different structure.
|
|
2545
|
+
* This is necessary because the Sentry backend requires a slightly different schema of a session
|
|
2546
|
+
* than the one the JS SDKs use internally.
|
|
2547
|
+
*
|
|
2548
|
+
* @param session the session to be converted
|
|
2549
|
+
*
|
|
2550
|
+
* @returns a JSON object of the passed session
|
|
2551
|
+
*/
|
|
2552
|
+
function sessionToJSON(session) {
|
|
2553
|
+
return dropUndefinedKeys({
|
|
2554
|
+
sid: `${session.sid}`,
|
|
2555
|
+
init: session.init,
|
|
2556
|
+
// Make sure that sec is converted to ms for date constructor
|
|
2557
|
+
started: new Date(session.started * 1000).toISOString(),
|
|
2558
|
+
timestamp: new Date(session.timestamp * 1000).toISOString(),
|
|
2559
|
+
status: session.status,
|
|
2560
|
+
errors: session.errors,
|
|
2561
|
+
did: typeof session.did === 'number' || typeof session.did === 'string' ? `${session.did}` : undefined,
|
|
2562
|
+
duration: session.duration,
|
|
2563
|
+
attrs: {
|
|
2564
|
+
release: session.release,
|
|
2565
|
+
environment: session.environment,
|
|
2566
|
+
ip_address: session.ipAddress,
|
|
2567
|
+
user_agent: session.userAgent,
|
|
2568
|
+
},
|
|
2569
|
+
});
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
/**
|
|
2573
|
+
* Default value for maximum number of breadcrumbs added to an event.
|
|
2574
|
+
*/
|
|
2575
|
+
const DEFAULT_MAX_BREADCRUMBS = 100;
|
|
2576
|
+
|
|
2577
|
+
/**
|
|
2578
|
+
* Holds additional event information. {@link Scope.applyToEvent} will be
|
|
2579
|
+
* called by the client before an event will be sent.
|
|
2580
|
+
*/
|
|
2581
|
+
class Scope {
|
|
2582
|
+
/** Flag if notifying is happening. */
|
|
2583
|
+
|
|
2584
|
+
/** Callback for client to receive scope changes. */
|
|
2585
|
+
|
|
2586
|
+
/** Callback list that will be called after {@link applyToEvent}. */
|
|
2587
|
+
|
|
2588
|
+
/** Array of breadcrumbs. */
|
|
2589
|
+
|
|
2590
|
+
/** User */
|
|
2591
|
+
|
|
2592
|
+
/** Tags */
|
|
2593
|
+
|
|
2594
|
+
/** Extra */
|
|
2595
|
+
|
|
2596
|
+
/** Contexts */
|
|
2597
|
+
|
|
2598
|
+
/** Attachments */
|
|
2599
|
+
|
|
2600
|
+
/**
|
|
2601
|
+
* A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get
|
|
2602
|
+
* sent to Sentry
|
|
2603
|
+
*/
|
|
2604
|
+
|
|
2605
|
+
/** Fingerprint */
|
|
2606
|
+
|
|
2607
|
+
/** Severity */
|
|
2608
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
2609
|
+
|
|
2610
|
+
/** Transaction Name */
|
|
2611
|
+
|
|
2612
|
+
/** Span */
|
|
2613
|
+
|
|
2614
|
+
/** Session */
|
|
2615
|
+
|
|
2616
|
+
/** Request Mode Session Status */
|
|
2617
|
+
|
|
2618
|
+
// NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.
|
|
2619
|
+
|
|
2620
|
+
constructor() {
|
|
2621
|
+
this._notifyingListeners = false;
|
|
2622
|
+
this._scopeListeners = [];
|
|
2623
|
+
this._eventProcessors = [];
|
|
2624
|
+
this._breadcrumbs = [];
|
|
2625
|
+
this._attachments = [];
|
|
2626
|
+
this._user = {};
|
|
2627
|
+
this._tags = {};
|
|
2628
|
+
this._extra = {};
|
|
2629
|
+
this._contexts = {};
|
|
2630
|
+
this._sdkProcessingMetadata = {};
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
/**
|
|
2634
|
+
* Inherit values from the parent scope.
|
|
2635
|
+
* @param scope to clone.
|
|
2636
|
+
*/
|
|
2637
|
+
static clone(scope) {
|
|
2638
|
+
const newScope = new Scope();
|
|
2639
|
+
if (scope) {
|
|
2640
|
+
newScope._breadcrumbs = [...scope._breadcrumbs];
|
|
2641
|
+
newScope._tags = { ...scope._tags };
|
|
2642
|
+
newScope._extra = { ...scope._extra };
|
|
2643
|
+
newScope._contexts = { ...scope._contexts };
|
|
2644
|
+
newScope._user = scope._user;
|
|
2645
|
+
newScope._level = scope._level;
|
|
2646
|
+
newScope._span = scope._span;
|
|
2647
|
+
newScope._session = scope._session;
|
|
2648
|
+
newScope._transactionName = scope._transactionName;
|
|
2649
|
+
newScope._fingerprint = scope._fingerprint;
|
|
2650
|
+
newScope._eventProcessors = [...scope._eventProcessors];
|
|
2651
|
+
newScope._requestSession = scope._requestSession;
|
|
2652
|
+
newScope._attachments = [...scope._attachments];
|
|
2653
|
+
newScope._sdkProcessingMetadata = { ...scope._sdkProcessingMetadata };
|
|
2654
|
+
}
|
|
2655
|
+
return newScope;
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
/**
|
|
2659
|
+
* Add internal on change listener. Used for sub SDKs that need to store the scope.
|
|
2660
|
+
* @hidden
|
|
2661
|
+
*/
|
|
2662
|
+
addScopeListener(callback) {
|
|
2663
|
+
this._scopeListeners.push(callback);
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
/**
|
|
2667
|
+
* @inheritDoc
|
|
2668
|
+
*/
|
|
2669
|
+
addEventProcessor(callback) {
|
|
2670
|
+
this._eventProcessors.push(callback);
|
|
2671
|
+
return this;
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2674
|
+
/**
|
|
2675
|
+
* @inheritDoc
|
|
2676
|
+
*/
|
|
2677
|
+
setUser(user) {
|
|
2678
|
+
this._user = user || {};
|
|
2679
|
+
if (this._session) {
|
|
2680
|
+
updateSession(this._session, { user });
|
|
2681
|
+
}
|
|
2682
|
+
this._notifyScopeListeners();
|
|
2683
|
+
return this;
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
/**
|
|
2687
|
+
* @inheritDoc
|
|
2688
|
+
*/
|
|
2689
|
+
getUser() {
|
|
2690
|
+
return this._user;
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
/**
|
|
2694
|
+
* @inheritDoc
|
|
2695
|
+
*/
|
|
2696
|
+
getRequestSession() {
|
|
2697
|
+
return this._requestSession;
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2700
|
+
/**
|
|
2701
|
+
* @inheritDoc
|
|
2702
|
+
*/
|
|
2703
|
+
setRequestSession(requestSession) {
|
|
2704
|
+
this._requestSession = requestSession;
|
|
2705
|
+
return this;
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2708
|
+
/**
|
|
2709
|
+
* @inheritDoc
|
|
2710
|
+
*/
|
|
2711
|
+
setTags(tags) {
|
|
2712
|
+
this._tags = {
|
|
2713
|
+
...this._tags,
|
|
2714
|
+
...tags,
|
|
2715
|
+
};
|
|
2716
|
+
this._notifyScopeListeners();
|
|
2717
|
+
return this;
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
/**
|
|
2721
|
+
* @inheritDoc
|
|
2722
|
+
*/
|
|
2723
|
+
setTag(key, value) {
|
|
2724
|
+
this._tags = { ...this._tags, [key]: value };
|
|
2725
|
+
this._notifyScopeListeners();
|
|
2726
|
+
return this;
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2729
|
+
/**
|
|
2730
|
+
* @inheritDoc
|
|
2731
|
+
*/
|
|
2732
|
+
setExtras(extras) {
|
|
2733
|
+
this._extra = {
|
|
2734
|
+
...this._extra,
|
|
2735
|
+
...extras,
|
|
2736
|
+
};
|
|
2737
|
+
this._notifyScopeListeners();
|
|
2738
|
+
return this;
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
/**
|
|
2742
|
+
* @inheritDoc
|
|
2743
|
+
*/
|
|
2744
|
+
setExtra(key, extra) {
|
|
2745
|
+
this._extra = { ...this._extra, [key]: extra };
|
|
2746
|
+
this._notifyScopeListeners();
|
|
2747
|
+
return this;
|
|
2748
|
+
}
|
|
2749
|
+
|
|
2750
|
+
/**
|
|
2751
|
+
* @inheritDoc
|
|
2752
|
+
*/
|
|
2753
|
+
setFingerprint(fingerprint) {
|
|
2754
|
+
this._fingerprint = fingerprint;
|
|
2755
|
+
this._notifyScopeListeners();
|
|
2756
|
+
return this;
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2759
|
+
/**
|
|
2760
|
+
* @inheritDoc
|
|
2761
|
+
*/
|
|
2762
|
+
setLevel(
|
|
2763
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
2764
|
+
level,
|
|
2765
|
+
) {
|
|
2766
|
+
this._level = level;
|
|
2767
|
+
this._notifyScopeListeners();
|
|
2768
|
+
return this;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
/**
|
|
2772
|
+
* @inheritDoc
|
|
2773
|
+
*/
|
|
2774
|
+
setTransactionName(name) {
|
|
2775
|
+
this._transactionName = name;
|
|
2776
|
+
this._notifyScopeListeners();
|
|
2777
|
+
return this;
|
|
2778
|
+
}
|
|
2779
|
+
|
|
2780
|
+
/**
|
|
2781
|
+
* @inheritDoc
|
|
2782
|
+
*/
|
|
2783
|
+
setContext(key, context) {
|
|
2784
|
+
if (context === null) {
|
|
2785
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
2786
|
+
delete this._contexts[key];
|
|
2787
|
+
} else {
|
|
2788
|
+
this._contexts[key] = context;
|
|
2789
|
+
}
|
|
2790
|
+
|
|
2791
|
+
this._notifyScopeListeners();
|
|
2792
|
+
return this;
|
|
2793
|
+
}
|
|
2794
|
+
|
|
2795
|
+
/**
|
|
2796
|
+
* @inheritDoc
|
|
2797
|
+
*/
|
|
2798
|
+
setSpan(span) {
|
|
2799
|
+
this._span = span;
|
|
2800
|
+
this._notifyScopeListeners();
|
|
2801
|
+
return this;
|
|
2802
|
+
}
|
|
2803
|
+
|
|
2804
|
+
/**
|
|
2805
|
+
* @inheritDoc
|
|
2806
|
+
*/
|
|
2807
|
+
getSpan() {
|
|
2808
|
+
return this._span;
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
/**
|
|
2812
|
+
* @inheritDoc
|
|
2813
|
+
*/
|
|
2814
|
+
getTransaction() {
|
|
2815
|
+
// Often, this span (if it exists at all) will be a transaction, but it's not guaranteed to be. Regardless, it will
|
|
2816
|
+
// have a pointer to the currently-active transaction.
|
|
2817
|
+
const span = this.getSpan();
|
|
2818
|
+
return span && span.transaction;
|
|
2819
|
+
}
|
|
2820
|
+
|
|
2821
|
+
/**
|
|
2822
|
+
* @inheritDoc
|
|
2823
|
+
*/
|
|
2824
|
+
setSession(session) {
|
|
2825
|
+
if (!session) {
|
|
2826
|
+
delete this._session;
|
|
2827
|
+
} else {
|
|
2828
|
+
this._session = session;
|
|
2829
|
+
}
|
|
2830
|
+
this._notifyScopeListeners();
|
|
2831
|
+
return this;
|
|
2832
|
+
}
|
|
2833
|
+
|
|
2834
|
+
/**
|
|
2835
|
+
* @inheritDoc
|
|
2836
|
+
*/
|
|
2837
|
+
getSession() {
|
|
2838
|
+
return this._session;
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
/**
|
|
2842
|
+
* @inheritDoc
|
|
2843
|
+
*/
|
|
2844
|
+
update(captureContext) {
|
|
2845
|
+
if (!captureContext) {
|
|
2846
|
+
return this;
|
|
2847
|
+
}
|
|
2848
|
+
|
|
2849
|
+
if (typeof captureContext === 'function') {
|
|
2850
|
+
const updatedScope = (captureContext )(this);
|
|
2851
|
+
return updatedScope instanceof Scope ? updatedScope : this;
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
if (captureContext instanceof Scope) {
|
|
2855
|
+
this._tags = { ...this._tags, ...captureContext._tags };
|
|
2856
|
+
this._extra = { ...this._extra, ...captureContext._extra };
|
|
2857
|
+
this._contexts = { ...this._contexts, ...captureContext._contexts };
|
|
2858
|
+
if (captureContext._user && Object.keys(captureContext._user).length) {
|
|
2859
|
+
this._user = captureContext._user;
|
|
2860
|
+
}
|
|
2861
|
+
if (captureContext._level) {
|
|
2862
|
+
this._level = captureContext._level;
|
|
2863
|
+
}
|
|
2864
|
+
if (captureContext._fingerprint) {
|
|
2865
|
+
this._fingerprint = captureContext._fingerprint;
|
|
2866
|
+
}
|
|
2867
|
+
if (captureContext._requestSession) {
|
|
2868
|
+
this._requestSession = captureContext._requestSession;
|
|
2869
|
+
}
|
|
2870
|
+
} else if (isPlainObject(captureContext)) {
|
|
2871
|
+
// eslint-disable-next-line no-param-reassign
|
|
2872
|
+
captureContext = captureContext ;
|
|
2873
|
+
this._tags = { ...this._tags, ...captureContext.tags };
|
|
2874
|
+
this._extra = { ...this._extra, ...captureContext.extra };
|
|
2875
|
+
this._contexts = { ...this._contexts, ...captureContext.contexts };
|
|
2876
|
+
if (captureContext.user) {
|
|
2877
|
+
this._user = captureContext.user;
|
|
2878
|
+
}
|
|
2879
|
+
if (captureContext.level) {
|
|
2880
|
+
this._level = captureContext.level;
|
|
2881
|
+
}
|
|
2882
|
+
if (captureContext.fingerprint) {
|
|
2883
|
+
this._fingerprint = captureContext.fingerprint;
|
|
2884
|
+
}
|
|
2885
|
+
if (captureContext.requestSession) {
|
|
2886
|
+
this._requestSession = captureContext.requestSession;
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
|
|
2890
|
+
return this;
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2893
|
+
/**
|
|
2894
|
+
* @inheritDoc
|
|
2895
|
+
*/
|
|
2896
|
+
clear() {
|
|
2897
|
+
this._breadcrumbs = [];
|
|
2898
|
+
this._tags = {};
|
|
2899
|
+
this._extra = {};
|
|
2900
|
+
this._user = {};
|
|
2901
|
+
this._contexts = {};
|
|
2902
|
+
this._level = undefined;
|
|
2903
|
+
this._transactionName = undefined;
|
|
2904
|
+
this._fingerprint = undefined;
|
|
2905
|
+
this._requestSession = undefined;
|
|
2906
|
+
this._span = undefined;
|
|
2907
|
+
this._session = undefined;
|
|
2908
|
+
this._notifyScopeListeners();
|
|
2909
|
+
this._attachments = [];
|
|
2910
|
+
return this;
|
|
2911
|
+
}
|
|
2912
|
+
|
|
2913
|
+
/**
|
|
2914
|
+
* @inheritDoc
|
|
2915
|
+
*/
|
|
2916
|
+
addBreadcrumb(breadcrumb, maxBreadcrumbs) {
|
|
2917
|
+
const maxCrumbs = typeof maxBreadcrumbs === 'number' ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS;
|
|
2918
|
+
|
|
2919
|
+
// No data has been changed, so don't notify scope listeners
|
|
2920
|
+
if (maxCrumbs <= 0) {
|
|
2921
|
+
return this;
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2924
|
+
const mergedBreadcrumb = {
|
|
2925
|
+
timestamp: dateTimestampInSeconds(),
|
|
2926
|
+
...breadcrumb,
|
|
2927
|
+
};
|
|
2928
|
+
this._breadcrumbs = [...this._breadcrumbs, mergedBreadcrumb].slice(-maxCrumbs);
|
|
2929
|
+
this._notifyScopeListeners();
|
|
2930
|
+
|
|
2931
|
+
return this;
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2934
|
+
/**
|
|
2935
|
+
* @inheritDoc
|
|
2936
|
+
*/
|
|
2937
|
+
getLastBreadcrumb() {
|
|
2938
|
+
return this._breadcrumbs[this._breadcrumbs.length - 1];
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
/**
|
|
2942
|
+
* @inheritDoc
|
|
2943
|
+
*/
|
|
2944
|
+
clearBreadcrumbs() {
|
|
2945
|
+
this._breadcrumbs = [];
|
|
2946
|
+
this._notifyScopeListeners();
|
|
2947
|
+
return this;
|
|
2948
|
+
}
|
|
2949
|
+
|
|
2950
|
+
/**
|
|
2951
|
+
* @inheritDoc
|
|
2952
|
+
*/
|
|
2953
|
+
addAttachment(attachment) {
|
|
2954
|
+
this._attachments.push(attachment);
|
|
2955
|
+
return this;
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2958
|
+
/**
|
|
2959
|
+
* @inheritDoc
|
|
2960
|
+
*/
|
|
2961
|
+
getAttachments() {
|
|
2962
|
+
return this._attachments;
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
/**
|
|
2966
|
+
* @inheritDoc
|
|
2967
|
+
*/
|
|
2968
|
+
clearAttachments() {
|
|
2969
|
+
this._attachments = [];
|
|
2970
|
+
return this;
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
/**
|
|
2974
|
+
* Applies data from the scope to the event and runs all event processors on it.
|
|
2975
|
+
*
|
|
2976
|
+
* @param event Event
|
|
2977
|
+
* @param hint Object containing additional information about the original exception, for use by the event processors.
|
|
2978
|
+
* @hidden
|
|
2979
|
+
*/
|
|
2980
|
+
applyToEvent(event, hint = {}) {
|
|
2981
|
+
if (this._extra && Object.keys(this._extra).length) {
|
|
2982
|
+
event.extra = { ...this._extra, ...event.extra };
|
|
2983
|
+
}
|
|
2984
|
+
if (this._tags && Object.keys(this._tags).length) {
|
|
2985
|
+
event.tags = { ...this._tags, ...event.tags };
|
|
2986
|
+
}
|
|
2987
|
+
if (this._user && Object.keys(this._user).length) {
|
|
2988
|
+
event.user = { ...this._user, ...event.user };
|
|
2989
|
+
}
|
|
2990
|
+
if (this._contexts && Object.keys(this._contexts).length) {
|
|
2991
|
+
event.contexts = { ...this._contexts, ...event.contexts };
|
|
2992
|
+
}
|
|
2993
|
+
if (this._level) {
|
|
2994
|
+
event.level = this._level;
|
|
2995
|
+
}
|
|
2996
|
+
if (this._transactionName) {
|
|
2997
|
+
event.transaction = this._transactionName;
|
|
2998
|
+
}
|
|
2999
|
+
|
|
3000
|
+
// We want to set the trace context for normal events only if there isn't already
|
|
3001
|
+
// a trace context on the event. There is a product feature in place where we link
|
|
3002
|
+
// errors with transaction and it relies on that.
|
|
3003
|
+
if (this._span) {
|
|
3004
|
+
event.contexts = { trace: this._span.getTraceContext(), ...event.contexts };
|
|
3005
|
+
const transactionName = this._span.transaction && this._span.transaction.name;
|
|
3006
|
+
if (transactionName) {
|
|
3007
|
+
event.tags = { transaction: transactionName, ...event.tags };
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
|
|
3011
|
+
this._applyFingerprint(event);
|
|
3012
|
+
|
|
3013
|
+
event.breadcrumbs = [...(event.breadcrumbs || []), ...this._breadcrumbs];
|
|
3014
|
+
event.breadcrumbs = event.breadcrumbs.length > 0 ? event.breadcrumbs : undefined;
|
|
3015
|
+
|
|
3016
|
+
event.sdkProcessingMetadata = { ...event.sdkProcessingMetadata, ...this._sdkProcessingMetadata };
|
|
3017
|
+
|
|
3018
|
+
return this._notifyEventProcessors([...getGlobalEventProcessors(), ...this._eventProcessors], event, hint);
|
|
3019
|
+
}
|
|
3020
|
+
|
|
3021
|
+
/**
|
|
3022
|
+
* Add data which will be accessible during event processing but won't get sent to Sentry
|
|
3023
|
+
*/
|
|
3024
|
+
setSDKProcessingMetadata(newData) {
|
|
3025
|
+
this._sdkProcessingMetadata = { ...this._sdkProcessingMetadata, ...newData };
|
|
3026
|
+
|
|
3027
|
+
return this;
|
|
3028
|
+
}
|
|
3029
|
+
|
|
3030
|
+
/**
|
|
3031
|
+
* This will be called after {@link applyToEvent} is finished.
|
|
3032
|
+
*/
|
|
3033
|
+
_notifyEventProcessors(
|
|
3034
|
+
processors,
|
|
3035
|
+
event,
|
|
3036
|
+
hint,
|
|
3037
|
+
index = 0,
|
|
3038
|
+
) {
|
|
3039
|
+
return new SyncPromise((resolve, reject) => {
|
|
3040
|
+
const processor = processors[index];
|
|
3041
|
+
if (event === null || typeof processor !== 'function') {
|
|
3042
|
+
resolve(event);
|
|
3043
|
+
} else {
|
|
3044
|
+
const result = processor({ ...event }, hint) ;
|
|
3045
|
+
|
|
3046
|
+
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) &&
|
|
3047
|
+
processor.id &&
|
|
3048
|
+
result === null &&
|
|
3049
|
+
logger.log(`Event processor "${processor.id}" dropped event`);
|
|
3050
|
+
|
|
3051
|
+
if (isThenable(result)) {
|
|
3052
|
+
void result
|
|
3053
|
+
.then(final => this._notifyEventProcessors(processors, final, hint, index + 1).then(resolve))
|
|
3054
|
+
.then(null, reject);
|
|
3055
|
+
} else {
|
|
3056
|
+
void this._notifyEventProcessors(processors, result, hint, index + 1)
|
|
3057
|
+
.then(resolve)
|
|
3058
|
+
.then(null, reject);
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
});
|
|
3062
|
+
}
|
|
3063
|
+
|
|
3064
|
+
/**
|
|
3065
|
+
* This will be called on every set call.
|
|
3066
|
+
*/
|
|
3067
|
+
_notifyScopeListeners() {
|
|
3068
|
+
// We need this check for this._notifyingListeners to be able to work on scope during updates
|
|
3069
|
+
// If this check is not here we'll produce endless recursion when something is done with the scope
|
|
3070
|
+
// during the callback.
|
|
3071
|
+
if (!this._notifyingListeners) {
|
|
3072
|
+
this._notifyingListeners = true;
|
|
3073
|
+
this._scopeListeners.forEach(callback => {
|
|
3074
|
+
callback(this);
|
|
3075
|
+
});
|
|
3076
|
+
this._notifyingListeners = false;
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
/**
|
|
3081
|
+
* Applies fingerprint from the scope to the event if there's one,
|
|
3082
|
+
* uses message if there's one instead or get rid of empty fingerprint
|
|
3083
|
+
*/
|
|
3084
|
+
_applyFingerprint(event) {
|
|
3085
|
+
// Make sure it's an array first and we actually have something in place
|
|
3086
|
+
event.fingerprint = event.fingerprint ? arrayify(event.fingerprint) : [];
|
|
3087
|
+
|
|
3088
|
+
// If we have something on the scope, then merge it with event
|
|
3089
|
+
if (this._fingerprint) {
|
|
3090
|
+
event.fingerprint = event.fingerprint.concat(this._fingerprint);
|
|
3091
|
+
}
|
|
3092
|
+
|
|
3093
|
+
// If we have no data at all, remove empty array default
|
|
3094
|
+
if (event.fingerprint && !event.fingerprint.length) {
|
|
3095
|
+
delete event.fingerprint;
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
|
|
3100
|
+
/**
|
|
3101
|
+
* Returns the global event processors.
|
|
3102
|
+
*/
|
|
3103
|
+
function getGlobalEventProcessors() {
|
|
3104
|
+
return getGlobalSingleton('globalEventProcessors', () => []);
|
|
3105
|
+
}
|
|
3106
|
+
|
|
3107
|
+
/**
|
|
3108
|
+
* API compatibility version of this hub.
|
|
3109
|
+
*
|
|
3110
|
+
* WARNING: This number should only be increased when the global interface
|
|
3111
|
+
* changes and new methods are introduced.
|
|
3112
|
+
*
|
|
3113
|
+
* @hidden
|
|
3114
|
+
*/
|
|
3115
|
+
const API_VERSION = 4;
|
|
3116
|
+
|
|
3117
|
+
/**
|
|
3118
|
+
* Default maximum number of breadcrumbs added to an event. Can be overwritten
|
|
3119
|
+
* with {@link Options.maxBreadcrumbs}.
|
|
3120
|
+
*/
|
|
3121
|
+
const DEFAULT_BREADCRUMBS = 100;
|
|
3122
|
+
|
|
3123
|
+
/**
|
|
3124
|
+
* A layer in the process stack.
|
|
3125
|
+
* @hidden
|
|
3126
|
+
*/
|
|
3127
|
+
|
|
3128
|
+
/**
|
|
3129
|
+
* @inheritDoc
|
|
3130
|
+
*/
|
|
3131
|
+
class Hub {
|
|
3132
|
+
/** Is a {@link Layer}[] containing the client and scope */
|
|
3133
|
+
__init() {this._stack = [{}];}
|
|
3134
|
+
|
|
3135
|
+
/** Contains the last event id of a captured event. */
|
|
3136
|
+
|
|
3137
|
+
/**
|
|
3138
|
+
* Creates a new instance of the hub, will push one {@link Layer} into the
|
|
3139
|
+
* internal stack on creation.
|
|
3140
|
+
*
|
|
3141
|
+
* @param client bound to the hub.
|
|
3142
|
+
* @param scope bound to the hub.
|
|
3143
|
+
* @param version number, higher number means higher priority.
|
|
3144
|
+
*/
|
|
3145
|
+
constructor(client, scope = new Scope(), _version = API_VERSION) {this._version = _version;Hub.prototype.__init.call(this);
|
|
3146
|
+
this.getStackTop().scope = scope;
|
|
3147
|
+
if (client) {
|
|
3148
|
+
this.bindClient(client);
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
/**
|
|
3153
|
+
* @inheritDoc
|
|
3154
|
+
*/
|
|
3155
|
+
isOlderThan(version) {
|
|
3156
|
+
return this._version < version;
|
|
3157
|
+
}
|
|
3158
|
+
|
|
3159
|
+
/**
|
|
3160
|
+
* @inheritDoc
|
|
3161
|
+
*/
|
|
3162
|
+
bindClient(client) {
|
|
3163
|
+
const top = this.getStackTop();
|
|
3164
|
+
top.client = client;
|
|
3165
|
+
if (client && client.setupIntegrations) {
|
|
3166
|
+
client.setupIntegrations();
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
|
|
3170
|
+
/**
|
|
3171
|
+
* @inheritDoc
|
|
3172
|
+
*/
|
|
3173
|
+
pushScope() {
|
|
3174
|
+
// We want to clone the content of prev scope
|
|
3175
|
+
const scope = Scope.clone(this.getScope());
|
|
3176
|
+
this.getStack().push({
|
|
3177
|
+
client: this.getClient(),
|
|
3178
|
+
scope,
|
|
3179
|
+
});
|
|
3180
|
+
return scope;
|
|
3181
|
+
}
|
|
3182
|
+
|
|
3183
|
+
/**
|
|
3184
|
+
* @inheritDoc
|
|
3185
|
+
*/
|
|
3186
|
+
popScope() {
|
|
3187
|
+
if (this.getStack().length <= 1) return false;
|
|
3188
|
+
return !!this.getStack().pop();
|
|
3189
|
+
}
|
|
3190
|
+
|
|
3191
|
+
/**
|
|
3192
|
+
* @inheritDoc
|
|
3193
|
+
*/
|
|
3194
|
+
withScope(callback) {
|
|
3195
|
+
const scope = this.pushScope();
|
|
3196
|
+
try {
|
|
3197
|
+
callback(scope);
|
|
3198
|
+
} finally {
|
|
3199
|
+
this.popScope();
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
|
|
3203
|
+
/**
|
|
3204
|
+
* @inheritDoc
|
|
3205
|
+
*/
|
|
3206
|
+
getClient() {
|
|
3207
|
+
return this.getStackTop().client ;
|
|
3208
|
+
}
|
|
3209
|
+
|
|
3210
|
+
/** Returns the scope of the top stack. */
|
|
3211
|
+
getScope() {
|
|
3212
|
+
return this.getStackTop().scope;
|
|
3213
|
+
}
|
|
3214
|
+
|
|
3215
|
+
/** Returns the scope stack for domains or the process. */
|
|
3216
|
+
getStack() {
|
|
3217
|
+
return this._stack;
|
|
3218
|
+
}
|
|
3219
|
+
|
|
3220
|
+
/** Returns the topmost scope layer in the order domain > local > process. */
|
|
3221
|
+
getStackTop() {
|
|
3222
|
+
return this._stack[this._stack.length - 1];
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3225
|
+
/**
|
|
3226
|
+
* @inheritDoc
|
|
3227
|
+
*/
|
|
3228
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
3229
|
+
captureException(exception, hint) {
|
|
3230
|
+
const eventId = (this._lastEventId = hint && hint.event_id ? hint.event_id : uuid4());
|
|
3231
|
+
const syntheticException = new Error('Sentry syntheticException');
|
|
3232
|
+
this._withClient((client, scope) => {
|
|
3233
|
+
client.captureException(
|
|
3234
|
+
exception,
|
|
3235
|
+
{
|
|
3236
|
+
originalException: exception,
|
|
3237
|
+
syntheticException,
|
|
3238
|
+
...hint,
|
|
3239
|
+
event_id: eventId,
|
|
3240
|
+
},
|
|
3241
|
+
scope,
|
|
3242
|
+
);
|
|
3243
|
+
});
|
|
3244
|
+
return eventId;
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
/**
|
|
3248
|
+
* @inheritDoc
|
|
3249
|
+
*/
|
|
3250
|
+
captureMessage(
|
|
3251
|
+
message,
|
|
3252
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
3253
|
+
level,
|
|
3254
|
+
hint,
|
|
3255
|
+
) {
|
|
3256
|
+
const eventId = (this._lastEventId = hint && hint.event_id ? hint.event_id : uuid4());
|
|
3257
|
+
const syntheticException = new Error(message);
|
|
3258
|
+
this._withClient((client, scope) => {
|
|
3259
|
+
client.captureMessage(
|
|
3260
|
+
message,
|
|
3261
|
+
level,
|
|
3262
|
+
{
|
|
3263
|
+
originalException: message,
|
|
3264
|
+
syntheticException,
|
|
3265
|
+
...hint,
|
|
3266
|
+
event_id: eventId,
|
|
3267
|
+
},
|
|
3268
|
+
scope,
|
|
3269
|
+
);
|
|
3270
|
+
});
|
|
3271
|
+
return eventId;
|
|
3272
|
+
}
|
|
3273
|
+
|
|
3274
|
+
/**
|
|
3275
|
+
* @inheritDoc
|
|
3276
|
+
*/
|
|
3277
|
+
captureEvent(event, hint) {
|
|
3278
|
+
const eventId = hint && hint.event_id ? hint.event_id : uuid4();
|
|
3279
|
+
if (!event.type) {
|
|
3280
|
+
this._lastEventId = eventId;
|
|
3281
|
+
}
|
|
3282
|
+
|
|
3283
|
+
this._withClient((client, scope) => {
|
|
3284
|
+
client.captureEvent(event, { ...hint, event_id: eventId }, scope);
|
|
3285
|
+
});
|
|
3286
|
+
return eventId;
|
|
3287
|
+
}
|
|
3288
|
+
|
|
3289
|
+
/**
|
|
3290
|
+
* @inheritDoc
|
|
3291
|
+
*/
|
|
3292
|
+
lastEventId() {
|
|
3293
|
+
return this._lastEventId;
|
|
3294
|
+
}
|
|
3295
|
+
|
|
3296
|
+
/**
|
|
3297
|
+
* @inheritDoc
|
|
3298
|
+
*/
|
|
3299
|
+
addBreadcrumb(breadcrumb, hint) {
|
|
3300
|
+
const { scope, client } = this.getStackTop();
|
|
3301
|
+
|
|
3302
|
+
if (!scope || !client) return;
|
|
3303
|
+
|
|
3304
|
+
const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } =
|
|
3305
|
+
(client.getOptions && client.getOptions()) || {};
|
|
3306
|
+
|
|
3307
|
+
if (maxBreadcrumbs <= 0) return;
|
|
3308
|
+
|
|
3309
|
+
const timestamp = dateTimestampInSeconds();
|
|
3310
|
+
const mergedBreadcrumb = { timestamp, ...breadcrumb };
|
|
3311
|
+
const finalBreadcrumb = beforeBreadcrumb
|
|
3312
|
+
? (consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) )
|
|
3313
|
+
: mergedBreadcrumb;
|
|
3314
|
+
|
|
3315
|
+
if (finalBreadcrumb === null) return;
|
|
3316
|
+
|
|
3317
|
+
scope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs);
|
|
3318
|
+
}
|
|
3319
|
+
|
|
3320
|
+
/**
|
|
3321
|
+
* @inheritDoc
|
|
3322
|
+
*/
|
|
3323
|
+
setUser(user) {
|
|
3324
|
+
const scope = this.getScope();
|
|
3325
|
+
if (scope) scope.setUser(user);
|
|
3326
|
+
}
|
|
3327
|
+
|
|
3328
|
+
/**
|
|
3329
|
+
* @inheritDoc
|
|
3330
|
+
*/
|
|
3331
|
+
setTags(tags) {
|
|
3332
|
+
const scope = this.getScope();
|
|
3333
|
+
if (scope) scope.setTags(tags);
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
/**
|
|
3337
|
+
* @inheritDoc
|
|
3338
|
+
*/
|
|
3339
|
+
setExtras(extras) {
|
|
3340
|
+
const scope = this.getScope();
|
|
3341
|
+
if (scope) scope.setExtras(extras);
|
|
3342
|
+
}
|
|
3343
|
+
|
|
3344
|
+
/**
|
|
3345
|
+
* @inheritDoc
|
|
3346
|
+
*/
|
|
3347
|
+
setTag(key, value) {
|
|
3348
|
+
const scope = this.getScope();
|
|
3349
|
+
if (scope) scope.setTag(key, value);
|
|
3350
|
+
}
|
|
3351
|
+
|
|
3352
|
+
/**
|
|
3353
|
+
* @inheritDoc
|
|
3354
|
+
*/
|
|
3355
|
+
setExtra(key, extra) {
|
|
3356
|
+
const scope = this.getScope();
|
|
3357
|
+
if (scope) scope.setExtra(key, extra);
|
|
3358
|
+
}
|
|
3359
|
+
|
|
3360
|
+
/**
|
|
3361
|
+
* @inheritDoc
|
|
3362
|
+
*/
|
|
3363
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3364
|
+
setContext(name, context) {
|
|
3365
|
+
const scope = this.getScope();
|
|
3366
|
+
if (scope) scope.setContext(name, context);
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3369
|
+
/**
|
|
3370
|
+
* @inheritDoc
|
|
3371
|
+
*/
|
|
3372
|
+
configureScope(callback) {
|
|
3373
|
+
const { scope, client } = this.getStackTop();
|
|
3374
|
+
if (scope && client) {
|
|
3375
|
+
callback(scope);
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
/**
|
|
3380
|
+
* @inheritDoc
|
|
3381
|
+
*/
|
|
3382
|
+
run(callback) {
|
|
3383
|
+
const oldHub = makeMain(this);
|
|
3384
|
+
try {
|
|
3385
|
+
callback(this);
|
|
3386
|
+
} finally {
|
|
3387
|
+
makeMain(oldHub);
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3390
|
+
|
|
3391
|
+
/**
|
|
3392
|
+
* @inheritDoc
|
|
3393
|
+
*/
|
|
3394
|
+
getIntegration(integration) {
|
|
3395
|
+
const client = this.getClient();
|
|
3396
|
+
if (!client) return null;
|
|
3397
|
+
try {
|
|
3398
|
+
return client.getIntegration(integration);
|
|
3399
|
+
} catch (_oO) {
|
|
3400
|
+
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.warn(`Cannot retrieve integration ${integration.id} from the current Hub`);
|
|
3401
|
+
return null;
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
|
|
3405
|
+
/**
|
|
3406
|
+
* @inheritDoc
|
|
3407
|
+
*/
|
|
3408
|
+
startTransaction(context, customSamplingContext) {
|
|
3409
|
+
return this._callExtensionMethod('startTransaction', context, customSamplingContext);
|
|
3410
|
+
}
|
|
3411
|
+
|
|
3412
|
+
/**
|
|
3413
|
+
* @inheritDoc
|
|
3414
|
+
*/
|
|
3415
|
+
traceHeaders() {
|
|
3416
|
+
return this._callExtensionMethod('traceHeaders');
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3419
|
+
/**
|
|
3420
|
+
* @inheritDoc
|
|
3421
|
+
*/
|
|
3422
|
+
captureSession(endSession = false) {
|
|
3423
|
+
// both send the update and pull the session from the scope
|
|
3424
|
+
if (endSession) {
|
|
3425
|
+
return this.endSession();
|
|
3426
|
+
}
|
|
3427
|
+
|
|
3428
|
+
// only send the update
|
|
3429
|
+
this._sendSessionUpdate();
|
|
3430
|
+
}
|
|
3431
|
+
|
|
3432
|
+
/**
|
|
3433
|
+
* @inheritDoc
|
|
3434
|
+
*/
|
|
3435
|
+
endSession() {
|
|
3436
|
+
const layer = this.getStackTop();
|
|
3437
|
+
const scope = layer && layer.scope;
|
|
3438
|
+
const session = scope && scope.getSession();
|
|
3439
|
+
if (session) {
|
|
3440
|
+
closeSession(session);
|
|
3441
|
+
}
|
|
3442
|
+
this._sendSessionUpdate();
|
|
3443
|
+
|
|
3444
|
+
// the session is over; take it off of the scope
|
|
3445
|
+
if (scope) {
|
|
3446
|
+
scope.setSession();
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3449
|
+
|
|
3450
|
+
/**
|
|
3451
|
+
* @inheritDoc
|
|
3452
|
+
*/
|
|
3453
|
+
startSession(context) {
|
|
3454
|
+
const { scope, client } = this.getStackTop();
|
|
3455
|
+
const { release, environment } = (client && client.getOptions()) || {};
|
|
3456
|
+
|
|
3457
|
+
// Will fetch userAgent if called from browser sdk
|
|
3458
|
+
const { userAgent } = GLOBAL_OBJ.navigator || {};
|
|
3459
|
+
|
|
3460
|
+
const session = makeSession({
|
|
3461
|
+
release,
|
|
3462
|
+
environment,
|
|
3463
|
+
...(scope && { user: scope.getUser() }),
|
|
3464
|
+
...(userAgent && { userAgent }),
|
|
3465
|
+
...context,
|
|
3466
|
+
});
|
|
3467
|
+
|
|
3468
|
+
if (scope) {
|
|
3469
|
+
// End existing session if there's one
|
|
3470
|
+
const currentSession = scope.getSession && scope.getSession();
|
|
3471
|
+
if (currentSession && currentSession.status === 'ok') {
|
|
3472
|
+
updateSession(currentSession, { status: 'exited' });
|
|
3473
|
+
}
|
|
3474
|
+
this.endSession();
|
|
3475
|
+
|
|
3476
|
+
// Afterwards we set the new session on the scope
|
|
3477
|
+
scope.setSession(session);
|
|
3478
|
+
}
|
|
3479
|
+
|
|
3480
|
+
return session;
|
|
3481
|
+
}
|
|
3482
|
+
|
|
3483
|
+
/**
|
|
3484
|
+
* Returns if default PII should be sent to Sentry and propagated in ourgoing requests
|
|
3485
|
+
* when Tracing is used.
|
|
3486
|
+
*/
|
|
3487
|
+
shouldSendDefaultPii() {
|
|
3488
|
+
const client = this.getClient();
|
|
3489
|
+
const options = client && client.getOptions();
|
|
3490
|
+
return Boolean(options && options.sendDefaultPii);
|
|
3491
|
+
}
|
|
3492
|
+
|
|
3493
|
+
/**
|
|
3494
|
+
* Sends the current Session on the scope
|
|
3495
|
+
*/
|
|
3496
|
+
_sendSessionUpdate() {
|
|
3497
|
+
const { scope, client } = this.getStackTop();
|
|
3498
|
+
if (!scope) return;
|
|
3499
|
+
|
|
3500
|
+
const session = scope.getSession();
|
|
3501
|
+
if (session) {
|
|
3502
|
+
if (client && client.captureSession) {
|
|
3503
|
+
client.captureSession(session);
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3507
|
+
|
|
3508
|
+
/**
|
|
3509
|
+
* Internal helper function to call a method on the top client if it exists.
|
|
3510
|
+
*
|
|
3511
|
+
* @param method The method to call on the client.
|
|
3512
|
+
* @param args Arguments to pass to the client function.
|
|
3513
|
+
*/
|
|
3514
|
+
_withClient(callback) {
|
|
3515
|
+
const { scope, client } = this.getStackTop();
|
|
3516
|
+
if (client) {
|
|
3517
|
+
callback(client, scope);
|
|
3518
|
+
}
|
|
3519
|
+
}
|
|
3520
|
+
|
|
3521
|
+
/**
|
|
3522
|
+
* Calls global extension method and binding current instance to the function call
|
|
3523
|
+
*/
|
|
3524
|
+
// @ts-ignore Function lacks ending return statement and return type does not include 'undefined'. ts(2366)
|
|
3525
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3526
|
+
_callExtensionMethod(method, ...args) {
|
|
3527
|
+
const carrier = getMainCarrier();
|
|
3528
|
+
const sentry = carrier.__SENTRY__;
|
|
3529
|
+
if (sentry && sentry.extensions && typeof sentry.extensions[method] === 'function') {
|
|
3530
|
+
return sentry.extensions[method].apply(this, args);
|
|
3531
|
+
}
|
|
3532
|
+
(typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.warn(`Extension method ${method} couldn't be found, doing nothing.`);
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
|
|
3536
|
+
/**
|
|
3537
|
+
* Returns the global shim registry.
|
|
3538
|
+
*
|
|
3539
|
+
* FIXME: This function is problematic, because despite always returning a valid Carrier,
|
|
3540
|
+
* it has an optional `__SENTRY__` property, which then in turn requires us to always perform an unnecessary check
|
|
3541
|
+
* at the call-site. We always access the carrier through this function, so we can guarantee that `__SENTRY__` is there.
|
|
3542
|
+
**/
|
|
3543
|
+
function getMainCarrier() {
|
|
3544
|
+
GLOBAL_OBJ.__SENTRY__ = GLOBAL_OBJ.__SENTRY__ || {
|
|
3545
|
+
extensions: {},
|
|
3546
|
+
hub: undefined,
|
|
3547
|
+
};
|
|
3548
|
+
return GLOBAL_OBJ;
|
|
3549
|
+
}
|
|
3550
|
+
|
|
3551
|
+
/**
|
|
3552
|
+
* Replaces the current main hub with the passed one on the global object
|
|
3553
|
+
*
|
|
3554
|
+
* @returns The old replaced hub
|
|
3555
|
+
*/
|
|
3556
|
+
function makeMain(hub) {
|
|
3557
|
+
const registry = getMainCarrier();
|
|
3558
|
+
const oldHub = getHubFromCarrier(registry);
|
|
3559
|
+
setHubOnCarrier(registry, hub);
|
|
3560
|
+
return oldHub;
|
|
3561
|
+
}
|
|
3562
|
+
|
|
3563
|
+
/**
|
|
3564
|
+
* Returns the default hub instance.
|
|
3565
|
+
*
|
|
3566
|
+
* If a hub is already registered in the global carrier but this module
|
|
3567
|
+
* contains a more recent version, it replaces the registered version.
|
|
3568
|
+
* Otherwise, the currently registered hub will be returned.
|
|
3569
|
+
*/
|
|
3570
|
+
function getCurrentHub() {
|
|
3571
|
+
// Get main carrier (global for every environment)
|
|
3572
|
+
const registry = getMainCarrier();
|
|
3573
|
+
|
|
3574
|
+
// If there's no hub, or its an old API, assign a new one
|
|
3575
|
+
if (!hasHubOnCarrier(registry) || getHubFromCarrier(registry).isOlderThan(API_VERSION)) {
|
|
3576
|
+
setHubOnCarrier(registry, new Hub());
|
|
3577
|
+
}
|
|
3578
|
+
|
|
3579
|
+
// Prefer domains over global if they are there (applicable only to Node environment)
|
|
3580
|
+
if (isNodeEnv()) {
|
|
3581
|
+
return getHubFromActiveDomain(registry);
|
|
3582
|
+
}
|
|
3583
|
+
// Return hub that lives on a global object
|
|
3584
|
+
return getHubFromCarrier(registry);
|
|
3585
|
+
}
|
|
3586
|
+
|
|
3587
|
+
/**
|
|
3588
|
+
* Try to read the hub from an active domain, and fallback to the registry if one doesn't exist
|
|
3589
|
+
* @returns discovered hub
|
|
3590
|
+
*/
|
|
3591
|
+
function getHubFromActiveDomain(registry) {
|
|
3592
|
+
try {
|
|
3593
|
+
const sentry = getMainCarrier().__SENTRY__;
|
|
3594
|
+
const activeDomain = sentry && sentry.extensions && sentry.extensions.domain && sentry.extensions.domain.active;
|
|
3595
|
+
|
|
3596
|
+
// If there's no active domain, just return global hub
|
|
3597
|
+
if (!activeDomain) {
|
|
3598
|
+
return getHubFromCarrier(registry);
|
|
3599
|
+
}
|
|
3600
|
+
|
|
3601
|
+
// If there's no hub on current domain, or it's an old API, assign a new one
|
|
3602
|
+
if (!hasHubOnCarrier(activeDomain) || getHubFromCarrier(activeDomain).isOlderThan(API_VERSION)) {
|
|
3603
|
+
const registryHubTopStack = getHubFromCarrier(registry).getStackTop();
|
|
3604
|
+
setHubOnCarrier(activeDomain, new Hub(registryHubTopStack.client, Scope.clone(registryHubTopStack.scope)));
|
|
3605
|
+
}
|
|
3606
|
+
|
|
3607
|
+
// Return hub that lives on a domain
|
|
3608
|
+
return getHubFromCarrier(activeDomain);
|
|
3609
|
+
} catch (_Oo) {
|
|
3610
|
+
// Return hub that lives on a global object
|
|
3611
|
+
return getHubFromCarrier(registry);
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
/**
|
|
3616
|
+
* This will tell whether a carrier has a hub on it or not
|
|
3617
|
+
* @param carrier object
|
|
3618
|
+
*/
|
|
3619
|
+
function hasHubOnCarrier(carrier) {
|
|
3620
|
+
return !!(carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub);
|
|
3621
|
+
}
|
|
3622
|
+
|
|
3623
|
+
/**
|
|
3624
|
+
* This will create a new {@link Hub} and add to the passed object on
|
|
3625
|
+
* __SENTRY__.hub.
|
|
3626
|
+
* @param carrier object
|
|
3627
|
+
* @hidden
|
|
3628
|
+
*/
|
|
3629
|
+
function getHubFromCarrier(carrier) {
|
|
3630
|
+
return getGlobalSingleton('hub', () => new Hub(), carrier);
|
|
3631
|
+
}
|
|
3632
|
+
|
|
3633
|
+
/**
|
|
3634
|
+
* This will set passed {@link Hub} on the passed object's __SENTRY__.hub attribute
|
|
3635
|
+
* @param carrier object
|
|
3636
|
+
* @param hub Hub
|
|
3637
|
+
* @returns A boolean indicating success or failure
|
|
3638
|
+
*/
|
|
3639
|
+
function setHubOnCarrier(carrier, hub) {
|
|
3640
|
+
if (!carrier) return false;
|
|
3641
|
+
const __SENTRY__ = (carrier.__SENTRY__ = carrier.__SENTRY__ || {});
|
|
3642
|
+
__SENTRY__.hub = hub;
|
|
3643
|
+
return true;
|
|
3644
|
+
}
|
|
3645
|
+
|
|
3646
|
+
// Note: All functions in this file are typed with a return value of `ReturnType<Hub[HUB_FUNCTION]>`,
|
|
3647
|
+
// where HUB_FUNCTION is some method on the Hub class.
|
|
3648
|
+
//
|
|
3649
|
+
// This is done to make sure the top level SDK methods stay in sync with the hub methods.
|
|
3650
|
+
// Although every method here has an explicit return type, some of them (that map to void returns) do not
|
|
3651
|
+
// contain `return` keywords. This is done to save on bundle size, as `return` is not minifiable.
|
|
3652
|
+
|
|
3653
|
+
/**
|
|
3654
|
+
* Captures an exception event and sends it to Sentry.
|
|
3655
|
+
*
|
|
3656
|
+
* @param exception An exception-like object.
|
|
3657
|
+
* @param captureContext Additional scope data to apply to exception event.
|
|
3658
|
+
* @returns The generated eventId.
|
|
3659
|
+
*/
|
|
3660
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
3661
|
+
function captureException(exception, captureContext) {
|
|
3662
|
+
return getCurrentHub().captureException(exception, { captureContext });
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3665
|
+
function showError(serverError, showToastOnUnknownError = true, hideAccessError = false) {
|
|
3666
|
+
if (serverError instanceof ServerErrors && Array.isArray(serverError.errors)) {
|
|
3667
|
+
serverError.errors.map(({ userMessage, internalMessage }) => {
|
|
3668
|
+
if (serverError.code === 403 && userMessage === 'unauthorized') {
|
|
3669
|
+
if (!hideAccessError) {
|
|
3670
|
+
toastAccessDenied();
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
else {
|
|
3674
|
+
toast.error(userMessage || internalMessage);
|
|
3675
|
+
}
|
|
3676
|
+
});
|
|
3677
|
+
}
|
|
3678
|
+
else {
|
|
3679
|
+
if (serverError.code !== 403 && serverError.code !== 408) {
|
|
3680
|
+
captureException(serverError);
|
|
3681
|
+
}
|
|
3682
|
+
if (showToastOnUnknownError) {
|
|
3683
|
+
if (serverError.message) {
|
|
3684
|
+
toast.error(serverError.message);
|
|
3685
|
+
}
|
|
3686
|
+
else {
|
|
3687
|
+
toast.error('Some Error Occurred');
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3691
|
+
}
|
|
3692
|
+
const ConditionalWrap = ({ condition, wrap, children }) => condition ? wrap(children) : jsx(Fragment, { children: children });
|
|
3693
|
+
|
|
3694
|
+
function Progressing({ pageLoader, size, theme, styles }) {
|
|
3695
|
+
const loaderSize = size ? `${size}px` : pageLoader ? '48px' : '20px';
|
|
3696
|
+
return (jsx("div", Object.assign({ className: `loader ${theme || 'default'}-background`, style: styles }, { children: jsx("div", Object.assign({ style: { width: loaderSize, height: loaderSize } }, { children: jsx("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", className: "loader__svg" }, { children: jsxs("g", Object.assign({ fill: "none", fillRule: "evenodd", strokeLinecap: "round" }, { children: [jsx("animateTransform", { attributeName: "transform", attributeType: "XML", dur: "0.5s", from: "0 12 12", repeatCount: "indefinite", to: "360 12 12", type: "rotate" }), jsx("path", { fill: "#06C", fillRule: "nonzero", d: "M12 2.5A9.5 9.5 0 1 1 2.5 12a1.5 1.5 0 0 1 3 0A6.5 6.5 0 1 0 12 5.5a1.5 1.5 0 0 1 0-3z" })] })) })) })) })));
|
|
3697
|
+
}
|
|
3698
|
+
function DetailsProgressing({ loadingText, size = 24, fullHeight = false, children, styles, }) {
|
|
3699
|
+
return (jsxs("div", Object.assign({ className: `details-loader bcn-0 flex column fs-14 fw-6 ${fullHeight ? 'h-100' : 'details-loader-height'}`, style: styles }, { children: [jsx("span", Object.assign({ style: { width: `${size}px`, height: `${size}px` } }, { children: jsx(Progressing, { size: size }) })), loadingText && jsx("span", Object.assign({ className: "mt-10" }, { children: loadingText })), children] })));
|
|
3700
|
+
}
|
|
3701
|
+
|
|
3702
|
+
class VisibleModal extends React__default.Component {
|
|
3703
|
+
constructor(props) {
|
|
3704
|
+
super(props);
|
|
3705
|
+
this.modalRef = document.getElementById('visible-modal');
|
|
3706
|
+
this.escFunction = this.escFunction.bind(this);
|
|
3707
|
+
}
|
|
3708
|
+
escFunction(event) {
|
|
3709
|
+
if (event.keyCode === 27 || event.key === 'Escape') {
|
|
3710
|
+
if (this.props.onEscape) {
|
|
3711
|
+
this.props.onEscape(event);
|
|
3712
|
+
}
|
|
3713
|
+
else if (this.props.close) {
|
|
3714
|
+
this.props.close(event);
|
|
3715
|
+
}
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
componentDidMount() {
|
|
3719
|
+
document.addEventListener('keydown', this.escFunction);
|
|
3720
|
+
this.modalRef.classList.add(this.props.noBackground ? 'show' : 'show-with-bg');
|
|
3721
|
+
if (this.props.parentClassName) {
|
|
3722
|
+
this.modalRef.classList.add(this.props.parentClassName);
|
|
3723
|
+
}
|
|
3724
|
+
}
|
|
3725
|
+
componentWillUnmount() {
|
|
3726
|
+
document.removeEventListener('keydown', this.escFunction);
|
|
3727
|
+
this.modalRef.classList.remove('show');
|
|
3728
|
+
this.modalRef.classList.remove('show-with-bg');
|
|
3729
|
+
if (this.props.parentClassName) {
|
|
3730
|
+
this.modalRef.classList.remove(this.props.parentClassName);
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3733
|
+
render() {
|
|
3734
|
+
var _a;
|
|
3735
|
+
return ReactDOM.createPortal(jsx("div", Object.assign({ className: `visible-modal__body ${this.props.className}`, onClick: (_a = this.props) === null || _a === void 0 ? void 0 : _a.close }, { children: this.props.children })), document.getElementById('visible-modal'));
|
|
3736
|
+
}
|
|
3737
|
+
}
|
|
3738
|
+
|
|
3739
|
+
var css_248z$1 = ".drawer {\n position: absolute;\n overflow: hidden;\n}\n.drawer.left, .drawer.right {\n top: 0;\n bottom: 0;\n width: 0;\n transition: width 200ms;\n}\n.drawer.left.show, .drawer.right.show {\n min-width: var(--minWidth);\n width: var(--width);\n max-width: var(--maxWidth);\n}\n.drawer.top, .drawer.bottom {\n left: 0;\n right: 0;\n height: 0;\n transition: height 200ms;\n}\n.drawer.top.show, .drawer.bottom.show {\n height: var(--height);\n}\n.drawer.right {\n right: 0;\n}\n.drawer.left {\n left: 0;\n}\n.drawer.top {\n top: 0;\n}\n.drawer.bottom {\n bottom: 0;\n}";
|
|
3740
|
+
styleInject(css_248z$1);
|
|
3741
|
+
|
|
3742
|
+
const Drawer = ({ children, position, height, width, minWidth, maxWidth, parentClassName, onEscape, }) => {
|
|
3743
|
+
const drawerRef = useRef(null);
|
|
3744
|
+
useEffect(() => {
|
|
3745
|
+
setTimeout(() => { var _a, _b; return (_b = (_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.add('show'); }, 1);
|
|
3746
|
+
return () => { var _a, _b; return (_b = (_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.classList) === null || _b === void 0 ? void 0 : _b.remove('show'); };
|
|
3747
|
+
}, []);
|
|
3748
|
+
const style = {};
|
|
3749
|
+
if (position === 'left' || position === 'right') {
|
|
3750
|
+
style['--width'] = width;
|
|
3751
|
+
style['--minWidth'] = minWidth;
|
|
3752
|
+
style['--maxWidth'] = maxWidth;
|
|
3753
|
+
}
|
|
3754
|
+
if (position === 'top' || position === 'bottom') {
|
|
3755
|
+
style['--height'] = height;
|
|
3756
|
+
}
|
|
3757
|
+
return (jsx(VisibleModal, Object.assign({ className: "drawer--container", parentClassName: parentClassName || '', onEscape: onEscape }, { children: jsx("aside", Object.assign({ style: style, ref: drawerRef, className: `drawer ${position}` }, { children: children })) })));
|
|
3758
|
+
};
|
|
3759
|
+
|
|
3760
|
+
const Modal = ({ style = {}, children, modal = false, rootClassName = "", onClick = null, callbackRef = null }) => {
|
|
3761
|
+
const innerRef = React__default.useRef(null);
|
|
3762
|
+
function handleClick(e) {
|
|
3763
|
+
if (typeof onClick !== 'function')
|
|
3764
|
+
return;
|
|
3765
|
+
if (innerRef && innerRef.current.contains(e.target)) {
|
|
3766
|
+
onClick(e, 'in');
|
|
3767
|
+
}
|
|
3768
|
+
else {
|
|
3769
|
+
onClick(e, 'out');
|
|
3770
|
+
}
|
|
3771
|
+
}
|
|
3772
|
+
function disableWheel(e) {
|
|
3773
|
+
if (innerRef && innerRef.current.contains(e.target)) {
|
|
3774
|
+
if (innerRef.current.clientHeight === innerRef.current.scrollHeight) {
|
|
3775
|
+
e.preventDefault();
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
else {
|
|
3779
|
+
e.preventDefault();
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
useEffect(() => {
|
|
3783
|
+
document.addEventListener('click', handleClick);
|
|
3784
|
+
let modal = document.getElementById("visible-modal");
|
|
3785
|
+
if (modal)
|
|
3786
|
+
modal.classList.add("show");
|
|
3787
|
+
document.body.addEventListener('wheel', disableWheel, { passive: false });
|
|
3788
|
+
return () => {
|
|
3789
|
+
document.body.removeEventListener('wheel', disableWheel);
|
|
3790
|
+
document.removeEventListener('click', handleClick);
|
|
3791
|
+
if (modal)
|
|
3792
|
+
modal.classList.remove("show");
|
|
3793
|
+
};
|
|
3794
|
+
}, []);
|
|
3795
|
+
return ReactDOM.createPortal(jsx("div", Object.assign({ tabIndex: 0, onClick: onClick, ref: el => {
|
|
3796
|
+
if (typeof callbackRef === 'function') {
|
|
3797
|
+
callbackRef(el);
|
|
3798
|
+
}
|
|
3799
|
+
innerRef.current = el;
|
|
3800
|
+
}, id: "popup", className: `${rootClassName} popup ${modal ? 'modal' : ''}`, style: Object.assign({}, style) }, { children: children })), document.getElementById('visible-modal'));
|
|
3801
|
+
};
|
|
3802
|
+
|
|
3803
|
+
var closeIcon = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%20%20%20%20%3Cdefs%3E%20%20%20%20%20%20%20%20%3Cpath%20id%3D%22a%22%20class%3D%22stroke-color%22%20d%3D%22M18.295%205.705a.997.997%200%200%200-1.41%200L12%2010.59%207.115%205.705a.997.997%200%201%200-1.41%201.41L10.59%2012l-4.885%204.885a.997.997%200%201%200%201.41%201.41L12%2013.41l4.885%204.885a.997.997%200%200%200%201.41-1.41L13.41%2012l4.885-4.885a.997.997%200%200%200%200-1.41z%22%2F%3E%20%20%20%20%3C%2Fdefs%3E%20%20%20%20%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22%22%2F%3E%20%20%20%20%20%20%20%20%3Cuse%20fill%3D%22%23999%22%20xlink%3Ahref%3D%22%23a%22%2F%3E%20%20%20%20%3C%2Fg%3E%3C%2Fsvg%3E";
|
|
3804
|
+
|
|
3805
|
+
class OpaqueModal extends React__default.Component {
|
|
3806
|
+
constructor() {
|
|
3807
|
+
super(...arguments);
|
|
3808
|
+
this.modalRef = document.getElementById('full-screen-modal');
|
|
3809
|
+
}
|
|
3810
|
+
componentDidMount() {
|
|
3811
|
+
if (this.props.noBackground)
|
|
3812
|
+
this.modalRef.classList.add("show");
|
|
3813
|
+
else
|
|
3814
|
+
this.modalRef.classList.add("show-with-bg");
|
|
3815
|
+
}
|
|
3816
|
+
componentWillUnmount() {
|
|
3817
|
+
this.modalRef.classList.remove("show");
|
|
3818
|
+
this.modalRef.classList.remove("show-with-bg");
|
|
3819
|
+
}
|
|
3820
|
+
render() {
|
|
3821
|
+
const { className = "", onHide = null } = Object.assign({}, this.props);
|
|
3822
|
+
return ReactDOM.createPortal(jsxs("div", Object.assign({ className: `full-screen-modal__body-container ${className}` }, { children: [this.props.children, typeof onHide === 'function' && jsx("div", Object.assign({ className: "close-btn icon-dim-24", onClick: e => onHide(false) }, { children: jsx("img", { className: "close-img", src: closeIcon, alt: "close" }) }))] })), document.getElementById('full-screen-modal'));
|
|
3823
|
+
}
|
|
3824
|
+
}
|
|
3825
|
+
|
|
3826
|
+
class VisibleModal2 extends React__default.Component {
|
|
3827
|
+
constructor(props) {
|
|
3828
|
+
super(props);
|
|
3829
|
+
this.modalRef = document.getElementById('visible-modal-2');
|
|
3830
|
+
this.escFunction = this.escFunction.bind(this);
|
|
3831
|
+
}
|
|
3832
|
+
escFunction(event) {
|
|
3833
|
+
if (event.keyCode === 27 && this.props.close) {
|
|
3834
|
+
this.props.close(event);
|
|
3835
|
+
}
|
|
3836
|
+
}
|
|
3837
|
+
componentDidMount() {
|
|
3838
|
+
document.addEventListener("keydown", this.escFunction);
|
|
3839
|
+
this.modalRef.classList.add("show-with-bg");
|
|
3840
|
+
}
|
|
3841
|
+
componentWillUnmount() {
|
|
3842
|
+
document.removeEventListener("keydown", this.escFunction);
|
|
3843
|
+
this.modalRef.classList.remove("show-with-bg");
|
|
3844
|
+
}
|
|
3845
|
+
render() {
|
|
3846
|
+
var _a;
|
|
3847
|
+
return ReactDOM.createPortal(jsx("div", Object.assign({ className: `visible-modal__body ${this.props.className}`, onClick: (_a = this.props) === null || _a === void 0 ? void 0 : _a.close }, { children: this.props.children })), document.getElementById('visible-modal-2'));
|
|
3848
|
+
}
|
|
3849
|
+
}
|
|
3850
|
+
|
|
3851
|
+
const initialState = {
|
|
3852
|
+
alias: {},
|
|
3853
|
+
};
|
|
3854
|
+
const Store = ({ children }) => {
|
|
3855
|
+
const [state, setState] = useState(initialState);
|
|
3856
|
+
return jsx(BreadcrumbContext.Provider, Object.assign({ value: { state, setState } }, { children: children }));
|
|
3857
|
+
};
|
|
3858
|
+
const BreadcrumbContext = createContext({
|
|
3859
|
+
state: { alias: {} },
|
|
3860
|
+
setState: null,
|
|
3861
|
+
});
|
|
3862
|
+
function useBreadcrumbContext() {
|
|
3863
|
+
const context = React__default.useContext(BreadcrumbContext);
|
|
3864
|
+
if (!context) {
|
|
3865
|
+
throw new Error(`breadcrumb components cannot be used outside Breadcrumb context`);
|
|
3866
|
+
}
|
|
3867
|
+
return context;
|
|
3868
|
+
}
|
|
3869
|
+
|
|
3870
|
+
React__default.createContext(null);
|
|
3871
|
+
function useBreadcrumb(props, deps) {
|
|
3872
|
+
let sep = (props === null || props === void 0 ? void 0 : props.sep) || "/";
|
|
3873
|
+
deps = deps || [];
|
|
3874
|
+
const { url, path } = useRouteMatch();
|
|
3875
|
+
const params = useParams();
|
|
3876
|
+
const { state, setState } = useBreadcrumbContext();
|
|
3877
|
+
useEffect(() => {
|
|
3878
|
+
if (!props || !props.alias)
|
|
3879
|
+
return;
|
|
3880
|
+
setState(state => (Object.assign(Object.assign({}, state), { alias: Object.assign(Object.assign({}, state.alias), props.alias) })));
|
|
3881
|
+
return () => resetCrumb(Object.keys(props.alias));
|
|
3882
|
+
}, deps);
|
|
3883
|
+
function setCrumb(props) {
|
|
3884
|
+
setState(state => (Object.assign(Object.assign({}, state), { alias: Object.assign(Object.assign({}, state.alias), props) })));
|
|
3885
|
+
}
|
|
3886
|
+
function resetCrumb(props) {
|
|
3887
|
+
const tempAlias = props.reduce((agg, curr, idx) => {
|
|
3888
|
+
delete agg[curr];
|
|
3889
|
+
return agg;
|
|
3890
|
+
}, state.alias);
|
|
3891
|
+
setState(state => (Object.assign(Object.assign({}, state), { alias: tempAlias })));
|
|
3892
|
+
}
|
|
3893
|
+
let levels = useMemo(() => {
|
|
3894
|
+
const paths = path.split("/").filter(Boolean);
|
|
3895
|
+
const urls = url.split("/").filter(Boolean);
|
|
3896
|
+
return paths.map((path, idx) => {
|
|
3897
|
+
const crumb = { to: urls[idx], name: path };
|
|
3898
|
+
if (path.startsWith(":") && params[path.replace(":", "")]) {
|
|
3899
|
+
crumb.className = "param";
|
|
3900
|
+
}
|
|
3901
|
+
return crumb;
|
|
3902
|
+
});
|
|
3903
|
+
}, [path, url]);
|
|
3904
|
+
const { res: breadcrumbs } = useMemo(() => {
|
|
3905
|
+
return levels.reduce((agg, curr, idx) => {
|
|
3906
|
+
var _a, _b, _c, _d;
|
|
3907
|
+
const { res, prefix } = agg;
|
|
3908
|
+
const { to, name } = curr;
|
|
3909
|
+
res.push({
|
|
3910
|
+
to: !((_a = state.alias[name]) === null || _a === void 0 ? void 0 : _a.component) || (((_b = state.alias[name]) === null || _b === void 0 ? void 0 : _b.component) && ((_c = state.alias[name]) === null || _c === void 0 ? void 0 : _c.linked))
|
|
3911
|
+
? `${prefix}${to}`
|
|
3912
|
+
: null,
|
|
3913
|
+
name: typeof state.alias[name] === 'object'
|
|
3914
|
+
? !!((_d = state.alias[name]) === null || _d === void 0 ? void 0 : _d.component) ? state.alias[name].component : null
|
|
3915
|
+
: state.alias[name] || name,
|
|
3916
|
+
className: curr.className || '',
|
|
3917
|
+
});
|
|
3918
|
+
return { res, prefix: `${prefix}${curr.to}${sep}` };
|
|
3919
|
+
}, { res: [], prefix: "/" });
|
|
3920
|
+
}, [levels, state]);
|
|
3921
|
+
return { breadcrumbs, setCrumb, resetCrumb };
|
|
3922
|
+
}
|
|
3923
|
+
const BreadCrumb = ({ breadcrumbs, sep = "/", className = "dc__devtron-breadcrumb__item" }) => {
|
|
3924
|
+
const { url } = useRouteMatch();
|
|
3925
|
+
const filteredCrumbs = breadcrumbs.filter(crumb => !!crumb.name);
|
|
3926
|
+
return jsx(React__default.Fragment, { children: filteredCrumbs.map((breadcrumb, idx) => jsxs(React__default.Fragment, { children: [jsx(ConditionalWrap, Object.assign({ condition: !!breadcrumb.to, wrap: children => jsx(Link, Object.assign({ className: `${url === breadcrumb.to ? 'active' : ''} ${className} ${breadcrumb.className || ""}`, to: breadcrumb.to }, { children: children })) }, { children: breadcrumb.name })), idx + 1 !== filteredCrumbs.length && breadcrumb.name && jsx("span", Object.assign({ className: `${className}__separator cn-5` }, { children: sep }))] }, idx)) });
|
|
3927
|
+
};
|
|
3928
|
+
|
|
3929
|
+
const RadioGroupContext = createContext({ name: '', value: '', disabled: false, onChange: (event) => { } });
|
|
3930
|
+
class RadioGroupItem extends Component {
|
|
3931
|
+
render() {
|
|
3932
|
+
return (jsx(RadioGroupContext.Consumer, { children: (context) => {
|
|
3933
|
+
return (jsx(Fragment, { children: jsxs("label", Object.assign({ className: context.disabled ? 'form__radio-item disabled' : 'form__radio-item' }, { children: [jsx("input", { type: "radio", className: "form__checkbox", name: context.name, disabled: context.disabled, onChange: context.onChange, value: this.props.value, checked: context.value === this.props.value }), jsxs("span", Object.assign({ className: "form__radio-item-content" }, { children: [jsx("span", { className: "radio__button" }), jsx("span", Object.assign({ className: "radio__title" }, { children: this.props.children }))] }))] })) }));
|
|
3934
|
+
} }));
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
class RadioGroup extends Component {
|
|
3938
|
+
render() {
|
|
3939
|
+
return (jsx("div", Object.assign({ className: `form__radio-group ${this.props.className || ''}` }, { children: jsx(RadioGroupContext.Provider, Object.assign({ value: {
|
|
3940
|
+
name: this.props.name,
|
|
3941
|
+
value: this.props.value,
|
|
3942
|
+
disabled: this.props.disabled,
|
|
3943
|
+
onChange: this.props.onChange,
|
|
3944
|
+
} }, { children: this.props.children })) })));
|
|
3945
|
+
}
|
|
3946
|
+
}
|
|
3947
|
+
|
|
3948
|
+
React__default.createContext(null);
|
|
3949
|
+
|
|
3950
|
+
var css_248z = ".tippy-box[data-animation=shift-toward-subtle][data-state=hidden]{opacity:0}.tippy-box[data-animation=shift-toward-subtle][data-state=hidden][data-placement^=top][data-state=hidden]{transform:translateY(-5px)}.tippy-box[data-animation=shift-toward-subtle][data-state=hidden][data-placement^=bottom][data-state=hidden]{transform:translateY(5px)}.tippy-box[data-animation=shift-toward-subtle][data-state=hidden][data-placement^=left][data-state=hidden]{transform:translateX(-5px)}.tippy-box[data-animation=shift-toward-subtle][data-state=hidden][data-placement^=right][data-state=hidden]{transform:translateX(5px)}";
|
|
3951
|
+
styleInject(css_248z);
|
|
3952
|
+
|
|
3953
|
+
var TippyTheme;
|
|
3954
|
+
(function (TippyTheme) {
|
|
3955
|
+
TippyTheme["black"] = "black";
|
|
3956
|
+
TippyTheme["white"] = "white";
|
|
3957
|
+
})(TippyTheme || (TippyTheme = {}));
|
|
3958
|
+
|
|
3959
|
+
export { BreadCrumb, Store as BreadcrumbStore, ConditionalWrap, DetailsProgressing, Drawer, ErrorScreenManager, ErrorScreenNotAuthorized, Host, Modal, OpaqueModal, PATTERNS, Progressing, RadioGroup, RadioGroupItem, RequestTimeout, ServerError, ServerErrors, TippyTheme, ToastBody, ToastBody3, ToastBodyWithButton, VisibleModal, VisibleModal2, get, post, put, showError, toastAccessDenied, trash, useBreadcrumb };
|