react-session.manager.sk 1.0.0
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/.babelrc +5 -0
- package/.gitattributes +2 -0
- package/README.md +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.LICENSE.txt +9 -0
- package/package.json +24 -0
- package/src/components/FingerPrint.js +11 -0
- package/src/components/versionCompare.js +39 -0
- package/src/index.js +273 -0
- package/webpack.config.js +30 -0
package/.babelrc
ADDED
package/.gitattributes
ADDED
package/README.md
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i(require("react")):"function"==typeof define&&define.amd?define("MyComponent",["react"],i):"object"==typeof exports?exports.MyComponent=i(require("react")):e.MyComponent=i(e.react)}(self,(e=>(()=>{var i={126:function(e,i,t){e.exports=function(e){var i={};function t(n){if(i[n])return i[n].exports;var o=i[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,i){if(1&i&&(e=t(e)),8&i)return e;if(4&i&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&i&&"string"!=typeof e)for(var o in e)t.d(n,o,function(i){return e[i]}.bind(null,o));return n},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,i){return Object.prototype.hasOwnProperty.call(e,i)},t.p="",t(t.s=0)}([function(e,i,t){"use strict";var n,o,r=t(1)(),a=t(3),s=t(4),u=t(6),l=function(){var e=new s;return n=e.getResult(),o=new u,this};l.prototype={getSoftwareVersion:function(){return"0.1.11"},getBrowserData:function(){return n},getFingerprint:function(){var e="|",i=n.ua,t=this.getScreenPrint(),o=this.getPlugins(),r=this.getFonts(),s=this.isLocalStorage(),u=this.isSessionStorage(),l=this.getTimeZone(),c=this.getLanguage(),d=this.getSystemLanguage(),f=this.isCookie(),m=this.getCanvasPrint();return a(i+e+t+e+o+e+r+e+s+e+u+e+l+e+c+e+d+e+f+e+m,256)},getCustomFingerprint:function(){for(var e="",i=0;i<arguments.length;i++)e+=arguments[i]+"|";return a(e,256)},getUserAgent:function(){return n.ua},getUserAgentLowerCase:function(){return n.ua.toLowerCase()},getBrowser:function(){return n.browser.name},getBrowserVersion:function(){return n.browser.version},getBrowserMajorVersion:function(){return n.browser.major},isIE:function(){return/IE/i.test(n.browser.name)},isChrome:function(){return/Chrome/i.test(n.browser.name)},isFirefox:function(){return/Firefox/i.test(n.browser.name)},isSafari:function(){return/Safari/i.test(n.browser.name)},isMobileSafari:function(){return/Mobile\sSafari/i.test(n.browser.name)},isOpera:function(){return/Opera/i.test(n.browser.name)},getEngine:function(){return n.engine.name},getEngineVersion:function(){return n.engine.version},getOS:function(){return n.os.name},getOSVersion:function(){return n.os.version},isWindows:function(){return/Windows/i.test(n.os.name)},isMac:function(){return/Mac/i.test(n.os.name)},isLinux:function(){return/Linux/i.test(n.os.name)},isUbuntu:function(){return/Ubuntu/i.test(n.os.name)},isSolaris:function(){return/Solaris/i.test(n.os.name)},getDevice:function(){return n.device.model},getDeviceType:function(){return n.device.type},getDeviceVendor:function(){return n.device.vendor},getCPU:function(){return n.cpu.architecture},isMobile:function(){var e=n.ua||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))},isMobileMajor:function(){return this.isMobileAndroid()||this.isMobileBlackBerry()||this.isMobileIOS()||this.isMobileOpera()||this.isMobileWindows()},isMobileAndroid:function(){return!!n.ua.match(/Android/i)},isMobileOpera:function(){return!!n.ua.match(/Opera Mini/i)},isMobileWindows:function(){return!!n.ua.match(/IEMobile/i)},isMobileBlackBerry:function(){return!!n.ua.match(/BlackBerry/i)},isMobileIOS:function(){return!!n.ua.match(/iPhone|iPad|iPod/i)},isIphone:function(){return!!n.ua.match(/iPhone/i)},isIpad:function(){return!!n.ua.match(/iPad/i)},isIpod:function(){return!!n.ua.match(/iPod/i)},getScreenPrint:function(){return"Current Resolution: "+this.getCurrentResolution()+", Available Resolution: "+this.getAvailableResolution()+", Color Depth: "+this.getColorDepth()+", Device XDPI: "+this.getDeviceXDPI()+", Device YDPI: "+this.getDeviceYDPI()},getColorDepth:function(){return screen.colorDepth},getCurrentResolution:function(){return screen.width+"x"+screen.height},getAvailableResolution:function(){return screen.availWidth+"x"+screen.availHeight},getDeviceXDPI:function(){return screen.deviceXDPI},getDeviceYDPI:function(){return screen.deviceYDPI},getPlugins:function(){for(var e="",i=0;i<navigator.plugins.length;i++)i==navigator.plugins.length-1?e+=navigator.plugins[i].name:e+=navigator.plugins[i].name+", ";return e},isJava:function(){return navigator.javaEnabled()},getJavaVersion:function(){throw new Error("Please use client.java.js or client.js if you need this functionality!")},isFlash:function(){return!!navigator.plugins["Shockwave Flash"]},getFlashVersion:function(){throw new Error("Please use client.flash.js or client.js if you need this functionality!")},isSilverlight:function(){return!!navigator.plugins["Silverlight Plug-In"]},getSilverlightVersion:function(){return this.isSilverlight()?navigator.plugins["Silverlight Plug-In"].description:""},isMimeTypes:function(){return!(!navigator.mimeTypes||!navigator.mimeTypes.length)},getMimeTypes:function(){var e="";if(navigator.mimeTypes)for(var i=0;i<navigator.mimeTypes.length;i++)i==navigator.mimeTypes.length-1?e+=navigator.mimeTypes[i].description:e+=navigator.mimeTypes[i].description+", ";return e},isFont:function(e){return o.detect(e)},getFonts:function(){for(var e=["Abadi MT Condensed Light","Adobe Fangsong Std","Adobe Hebrew","Adobe Ming Std","Agency FB","Aharoni","Andalus","Angsana New","AngsanaUPC","Aparajita","Arab","Arabic Transparent","Arabic Typesetting","Arial Baltic","Arial Black","Arial CE","Arial CYR","Arial Greek","Arial TUR","Arial","Batang","BatangChe","Bauhaus 93","Bell MT","Bitstream Vera Serif","Bodoni MT","Bookman Old Style","Braggadocio","Broadway","Browallia New","BrowalliaUPC","Calibri Light","Calibri","Californian FB","Cambria Math","Cambria","Candara","Castellar","Casual","Centaur","Century Gothic","Chalkduster","Colonna MT","Comic Sans MS","Consolas","Constantia","Copperplate Gothic Light","Corbel","Cordia New","CordiaUPC","Courier New Baltic","Courier New CE","Courier New CYR","Courier New Greek","Courier New TUR","Courier New","DFKai-SB","DaunPenh","David","DejaVu LGC Sans Mono","Desdemona","DilleniaUPC","DokChampa","Dotum","DotumChe","Ebrima","Engravers MT","Eras Bold ITC","Estrangelo Edessa","EucrosiaUPC","Euphemia","Eurostile","FangSong","Forte","FrankRuehl","Franklin Gothic Heavy","Franklin Gothic Medium","FreesiaUPC","French Script MT","Gabriola","Gautami","Georgia","Gigi","Gisha","Goudy Old Style","Gulim","GulimChe","GungSeo","Gungsuh","GungsuhChe","Haettenschweiler","Harrington","Hei S","HeiT","Heisei Kaku Gothic","Hiragino Sans GB","Impact","Informal Roman","IrisUPC","Iskoola Pota","JasmineUPC","KacstOne","KaiTi","Kalinga","Kartika","Khmer UI","Kino MT","KodchiangUPC","Kokila","Kozuka Gothic Pr6N","Lao UI","Latha","Leelawadee","Levenim MT","LilyUPC","Lohit Gujarati","Loma","Lucida Bright","Lucida Console","Lucida Fax","Lucida Sans Unicode","MS Gothic","MS Mincho","MS PGothic","MS PMincho","MS Reference Sans Serif","MS UI Gothic","MV Boli","Magneto","Malgun Gothic","Mangal","Marlett","Matura MT Script Capitals","Meiryo UI","Meiryo","Menlo","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Sans Serif","Microsoft Tai Le","Microsoft Uighur","Microsoft YaHei","Microsoft Yi Baiti","MingLiU","MingLiU-ExtB","MingLiU_HKSCS","MingLiU_HKSCS-ExtB","Miriam Fixed","Miriam","Mongolian Baiti","MoolBoran","NSimSun","Narkisim","News Gothic MT","Niagara Solid","Nyala","PMingLiU","PMingLiU-ExtB","Palace Script MT","Palatino Linotype","Papyrus","Perpetua","Plantagenet Cherokee","Playbill","Prelude Bold","Prelude Condensed Bold","Prelude Condensed Medium","Prelude Medium","PreludeCompressedWGL Black","PreludeCompressedWGL Bold","PreludeCompressedWGL Light","PreludeCompressedWGL Medium","PreludeCondensedWGL Black","PreludeCondensedWGL Bold","PreludeCondensedWGL Light","PreludeCondensedWGL Medium","PreludeWGL Black","PreludeWGL Bold","PreludeWGL Light","PreludeWGL Medium","Raavi","Rachana","Rockwell","Rod","Sakkal Majalla","Sawasdee","Script MT Bold","Segoe Print","Segoe Script","Segoe UI Light","Segoe UI Semibold","Segoe UI Symbol","Segoe UI","Shonar Bangla","Showcard Gothic","Shruti","SimHei","SimSun","SimSun-ExtB","Simplified Arabic Fixed","Simplified Arabic","Snap ITC","Sylfaen","Symbol","Tahoma","Times New Roman Baltic","Times New Roman CE","Times New Roman CYR","Times New Roman Greek","Times New Roman TUR","Times New Roman","TlwgMono","Traditional Arabic","Trebuchet MS","Tunga","Tw Cen MT Condensed Extra Bold","Ubuntu","Umpush","Univers","Utopia","Utsaah","Vani","Verdana","Vijaya","Vladimir Script","Vrinda","Webdings","Wide Latin","Wingdings"],i="",t=0;t<e.length;t++)o.detect(e[t])&&(i+=t==e.length-1?e[t]:e[t]+", ");return i},isLocalStorage:function(){try{return!!r.localStorage}catch(e){return!0}},isSessionStorage:function(){try{return!!r.sessionStorage}catch(e){return!0}},isCookie:function(){return navigator.cookieEnabled},getTimeZone:function(){var e,i;return e=new Date,(i=String(-e.getTimezoneOffset()/60))<0?"-"+("0"+(i*=-1)).slice(-2):"+"+("0"+i).slice(-2)},getLanguage:function(){return navigator.language},getSystemLanguage:function(){return navigator.systemLanguage||window.navigator.language},isCanvas:function(){var e=document.createElement("canvas");try{return!(!e.getContext||!e.getContext("2d"))}catch(e){return!1}},getCanvasPrint:function(){var e,i=document.createElement("canvas");try{e=i.getContext("2d")}catch(e){return""}var t="ClientJS,org <canvas> 1.0";return e.textBaseline="top",e.font="14px 'Arial'",e.textBaseline="alphabetic",e.fillStyle="#f60",e.fillRect(125,1,62,20),e.fillStyle="#069",e.fillText(t,2,15),e.fillStyle="rgba(102, 204, 0, 0.7)",e.fillText(t,4,17),i.toDataURL()}},i.ClientJS=l},function(e,i,n){"use strict";var o=n(2);e.exports=function(){return"object"==typeof t.g&&t.g&&t.g.Math===Math&&t.g.Array===Array?t.g:o}},function(e,i,t){"use strict";"undefined"!=typeof self?e.exports=self:"undefined"!=typeof window?e.exports=window:e.exports=Function("return this")()},function(e,i,t){e.exports=function(e,i){var t,n,o,r,a,s,u,l;for(t=3&e.length,n=e.length-t,o=i,a=3432918353,s=461845907,l=0;l<n;)u=255&e.charCodeAt(l)|(255&e.charCodeAt(++l))<<8|(255&e.charCodeAt(++l))<<16|(255&e.charCodeAt(++l))<<24,++l,o=27492+(65535&(r=5*(65535&(o=(o^=u=(65535&(u=(u=(65535&u)*a+(((u>>>16)*a&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(r>>>16)&65535)<<16);switch(u=0,t){case 3:u^=(255&e.charCodeAt(l+2))<<16;case 2:u^=(255&e.charCodeAt(l+1))<<8;case 1:o^=u=(65535&(u=(u=(65535&(u^=255&e.charCodeAt(l)))*a+(((u>>>16)*a&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295}return o^=e.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0}},function(e,i,t){var n;!function(o,r){"use strict";var a="function",s="undefined",u="object",l="string",c="model",d="name",f="type",m="vendor",g="version",p="architecture",b="console",w="mobile",h="tablet",v="smarttv",y="wearable",S="embedded",x="Amazon",k="Apple",C="ASUS",M="BlackBerry",T="Google",I="Huawei",P="LG",A="Microsoft",E="Motorola",L="Samsung",B="Sony",U="Xiaomi",_="Zebra",R="Facebook",j=function(e){var i={};for(var t in e)i[e[t].toUpperCase()]=e[t];return i},O=function(e,i){return typeof e===l&&-1!==N(i).indexOf(N(e))},N=function(e){return e.toLowerCase()},D=function(e,i){if(typeof e===l)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof i===s?e:e.substring(0,255)},z=function(e,i){for(var t,n,o,s,l,c,d=0;d<i.length&&!l;){var f=i[d],m=i[d+1];for(t=n=0;t<f.length&&!l;)if(l=f[t++].exec(e))for(o=0;o<m.length;o++)c=l[++n],typeof(s=m[o])===u&&s.length>0?2==s.length?typeof s[1]==a?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:3==s.length?typeof s[1]!==a||s[1].exec&&s[1].test?this[s[0]]=c?c.replace(s[1],s[2]):r:this[s[0]]=c?s[1].call(this,c,s[2]):r:4==s.length&&(this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):r):this[s]=c||r;d+=2}},F=function(e,i){for(var t in i)if(typeof i[t]===u&&i[t].length>0){for(var n=0;n<i[t].length;n++)if(O(i[t][n],e))return"?"===t?r:t}else if(O(i[t],e))return"?"===t?r:t;return e},G={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},V={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[g,[d,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[g,[d,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[d,g],[/opios[\/ ]+([\w\.]+)/i],[g,[d,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[g,[d,"Opera"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[d,g],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[g,[d,"UCBrowser"]],[/\bqbcore\/([\w\.]+)/i],[g,[d,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[g,[d,"WeChat"]],[/konqueror\/([\w\.]+)/i],[g,[d,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[g,[d,"IE"]],[/yabrowser\/([\w\.]+)/i],[g,[d,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[d,/(.+)/,"$1 Secure Browser"],g],[/\bfocus\/([\w\.]+)/i],[g,[d,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[g,[d,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[g,[d,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[g,[d,"Dolphin"]],[/coast\/([\w\.]+)/i],[g,[d,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[g,[d,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[g,[d,"Firefox"]],[/\bqihu|(qi?ho?o?|360)browser/i],[[d,"360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[d,/(.+)/,"$1 Browser"],g],[/(comodo_dragon)\/([\w\.]+)/i],[[d,/_/g," "],g],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[d,g],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[d],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[d,R],g],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[d,g],[/\bgsa\/([\w\.]+) .*safari\//i],[g,[d,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[g,[d,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[d,"Chrome WebView"],g],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[g,[d,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[d,g],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[g,[d,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[g,d],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[d,[g,F,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[d,g],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[d,"Netscape"],g],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[g,[d,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[d,g]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,N]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[p,/ower/,"",N]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,N]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[c,[m,L],[f,h]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[c,[m,L],[f,w]],[/\((ip(?:hone|od)[\w ]*);/i],[c,[m,k],[f,w]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[m,k],[f,h]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[m,I],[f,h]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i],[c,[m,I],[f,w]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[c,/_/g," "],[m,U],[f,w]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[m,U],[f,h]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007)\b/i],[c,[m,"OPPO"],[f,w]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[c,[m,"Vivo"],[f,w]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[c,[m,"Realme"],[f,w]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[c,[m,E],[f,w]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[m,E],[f,h]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[m,P],[f,h]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[c,[m,P],[f,w]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[c,[m,"Lenovo"],[f,h]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[c,/_/g," "],[m,"Nokia"],[f,w]],[/(pixel c)\b/i],[c,[m,T],[f,h]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[m,T],[f,w]],[/droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[c,[m,B],[f,w]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[m,B],[f,h]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[c,[m,"OnePlus"],[f,w]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[c,[m,x],[f,h]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)/g,"Fire Phone $1"],[m,x],[f,w]],[/(playbook);[-\w\),; ]+(rim)/i],[c,m,[f,h]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[m,M],[f,w]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[m,C],[f,h]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[m,C],[f,w]],[/(nexus 9)/i],[c,[m,"HTC"],[f,h]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i],[m,[c,/_/g," "],[f,w]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[c,[m,"Acer"],[f,h]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[c,[m,"Meizu"],[f,w]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[c,[m,"Sharp"],[f,w]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[m,c,[f,w]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[m,c,[f,h]],[/(surface duo)/i],[c,[m,A],[f,h]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[c,[m,"Fairphone"],[f,w]],[/(u304aa)/i],[c,[m,"AT&T"],[f,w]],[/\bsie-(\w*)/i],[c,[m,"Siemens"],[f,w]],[/\b(rct\w+) b/i],[c,[m,"RCA"],[f,h]],[/\b(venue[\d ]{2,7}) b/i],[c,[m,"Dell"],[f,h]],[/\b(q(?:mv|ta)\w+) b/i],[c,[m,"Verizon"],[f,h]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[c,[m,"Barnes & Noble"],[f,h]],[/\b(tm\d{3}\w+) b/i],[c,[m,"NuVision"],[f,h]],[/\b(k88) b/i],[c,[m,"ZTE"],[f,h]],[/\b(nx\d{3}j) b/i],[c,[m,"ZTE"],[f,w]],[/\b(gen\d{3}) b.+49h/i],[c,[m,"Swiss"],[f,w]],[/\b(zur\d{3}) b/i],[c,[m,"Swiss"],[f,h]],[/\b((zeki)?tb.*\b) b/i],[c,[m,"Zeki"],[f,h]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[m,"Dragon Touch"],c,[f,h]],[/\b(ns-?\w{0,9}) b/i],[c,[m,"Insignia"],[f,h]],[/\b((nxa|next)-?\w{0,9}) b/i],[c,[m,"NextBook"],[f,h]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[m,"Voice"],c,[f,w]],[/\b(lvtel\-)?(v1[12]) b/i],[[m,"LvTel"],c,[f,w]],[/\b(ph-1) /i],[c,[m,"Essential"],[f,w]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[c,[m,"Envizen"],[f,h]],[/\b(trio[-\w\. ]+) b/i],[c,[m,"MachSpeed"],[f,h]],[/\btu_(1491) b/i],[c,[m,"Rotor"],[f,h]],[/(shield[\w ]+) b/i],[c,[m,"Nvidia"],[f,h]],[/(sprint) (\w+)/i],[m,c,[f,w]],[/(kin\.[onetw]{3})/i],[[c,/\./g," "],[m,A],[f,w]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[m,_],[f,h]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[m,_],[f,w]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[m,c,[f,b]],[/droid.+; (shield) bui/i],[c,[m,"Nvidia"],[f,b]],[/(playstation [345portablevi]+)/i],[c,[m,B],[f,b]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[m,A],[f,b]],[/smart-tv.+(samsung)/i],[m,[f,v]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[m,L],[f,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[m,P],[f,v]],[/(apple) ?tv/i],[m,[c,"Apple TV"],[f,v]],[/crkey/i],[[c,"Chromecast"],[m,T],[f,v]],[/droid.+aft(\w)( bui|\))/i],[c,[m,x],[f,v]],[/\(dtv[\);].+(aquos)/i],[c,[m,"Sharp"],[f,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[m,D],[c,D],[f,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[f,v]],[/((pebble))app/i],[m,c,[f,y]],[/droid.+; (glass) \d/i],[c,[m,T],[f,y]],[/droid.+; (wt63?0{2,3})\)/i],[c,[m,_],[f,y]],[/(quest( 2)?)/i],[c,[m,R],[f,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[m,[f,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[c,[f,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[c,[f,h]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[f,h]],[/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i],[[f,w]],[/(android[-\w\. ]{0,9});.+buil/i],[c,[m,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[g,[d,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[g,[d,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[d,g],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[g,d]],os:[[/microsoft (windows) (vista|xp)/i],[d,g],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[d,[g,F,G]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[d,"Windows"],[g,F,G]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[g,/_/g,"."],[d,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[d,"Mac OS"],[g,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[g,d],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[d,g],[/\(bb(10);/i],[g,[d,M]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[g,[d,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[g,[d,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[g,[d,"webOS"]],[/crkey\/([\d\.]+)/i],[g,[d,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[d,"Chromium OS"],g],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[d,g],[/(sunos) ?([\w\.\d]*)/i],[[d,"Solaris"],g],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[d,g]]},q=function(e,i){if(typeof e===u&&(i=e,e=r),!(this instanceof q))return new q(e,i).getResult();var t=e||(typeof o!==s&&o.navigator&&o.navigator.userAgent?o.navigator.userAgent:""),n=i?function(e,i){var t={};for(var n in e)i[n]&&i[n].length%2==0?t[n]=i[n].concat(e[n]):t[n]=e[n];return t}(V,i):V;return this.getBrowser=function(){var e,i={};return i.name=r,i.version=r,z.call(i,t,n.browser),i.major=typeof(e=i.version)===l?e.replace(/[^\d\.]/g,"").split(".")[0]:r,i},this.getCPU=function(){var e={};return e.architecture=r,z.call(e,t,n.cpu),e},this.getDevice=function(){var e={};return e.vendor=r,e.model=r,e.type=r,z.call(e,t,n.device),e},this.getEngine=function(){var e={};return e.name=r,e.version=r,z.call(e,t,n.engine),e},this.getOS=function(){var e={};return e.name=r,e.version=r,z.call(e,t,n.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return t},this.setUA=function(e){return t=typeof e===l&&e.length>255?D(e,255):e,this},this.setUA(t),this};q.VERSION="0.7.30",q.BROWSER=j([d,g,"major"]),q.CPU=j([p]),q.DEVICE=j([c,m,f,b,w,v,h,y,S]),q.ENGINE=q.OS=j([d,g]),typeof i!==s?(typeof e!==s&&e.exports&&(i=e.exports=q),i.UAParser=q):t(5)?(n=function(){return q}.call(i,t,i,e))===r||(e.exports=n):typeof o!==s&&(o.UAParser=q);var W=typeof o!==s&&(o.jQuery||o.Zepto);if(W&&!W.ua){var H=new q;W.ua=H.getResult(),W.ua.get=function(){return H.getUA()},W.ua.set=function(e){H.setUA(e);var i=H.getResult();for(var t in i)W.ua[t]=i[t]}}}("object"==typeof window?window:this)},function(e,i){(function(i){e.exports=i}).call(this,{})},function(e,i){e.exports=function(){var e=["monospace","sans-serif","serif"],i=document.getElementsByTagName("body")[0],t=document.createElement("span");t.style.fontSize="72px",t.innerHTML="mmmmmmmmmmlli";var n={},o={};for(var r in e)t.style.fontFamily=e[r],i.appendChild(t),n[e[r]]=t.offsetWidth,o[e[r]]=t.offsetHeight,i.removeChild(t);this.detect=function(r){var a=!1;for(var s in e){t.style.fontFamily=r+","+e[s],i.appendChild(t);var u=t.offsetWidth!=n[e[s]]||t.offsetHeight!=o[e[s]];i.removeChild(t),a=a||u}return a}}}])},155:i=>{"use strict";i.exports=e}},t={};function n(e){var o=t[e];if(void 0!==o)return o.exports;var r=t[e]={exports:{}};return i[e].call(r.exports,r,r.exports,n),r.exports}n.n=e=>{var i=e&&e.__esModule?()=>e.default:()=>e;return n.d(i,{a:i}),i},n.d=(e,i)=>{for(var t in i)n.o(i,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:i[t]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{"use strict";n.r(o),n.d(o,{SessionManager:()=>M,default:()=>I});var e=n(155),i=n.n(e),t=n(126);const r=e=>"number"==typeof e&&!isNaN(e),a=e=>"string"==typeof e,s=e=>"function"==typeof e,u=i=>(0,e.isValidElement)(i)||a(i)||s(i)||r(i);function l(i){let{enter:t,exit:n,appendPosition:o=!1,collapse:r=!0,collapseDuration:a=300}=i;return function(i){let{children:s,position:u,preventExitTransition:l,done:c,nodeRef:d,isIn:f,playToast:m}=i;const g=o?`${t}--${u}`:t,p=o?`${n}--${u}`:n,b=(0,e.useRef)(0);return(0,e.useLayoutEffect)((()=>{const e=d.current,i=g.split(" "),t=n=>{n.target===d.current&&(m(),e.removeEventListener("animationend",t),e.removeEventListener("animationcancel",t),0===b.current&&"animationcancel"!==n.type&&e.classList.remove(...i))};e.classList.add(...i),e.addEventListener("animationend",t),e.addEventListener("animationcancel",t)}),[]),(0,e.useEffect)((()=>{const e=d.current,i=()=>{e.removeEventListener("animationend",i),r?function(e,i,t){void 0===t&&(t=300);const{scrollHeight:n,style:o}=e;requestAnimationFrame((()=>{o.minHeight="initial",o.height=n+"px",o.transition=`all ${t}ms`,requestAnimationFrame((()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(i,t)}))}))}(e,c,a):c()};f||(l?i():(b.current=1,e.className+=` ${p}`,e.addEventListener("animationend",i)))}),[f]),e.createElement(e.Fragment,null,s)}}const c=new Map;let d=[];const f=new Set,m=()=>c.size>0;function g(e,i){c.forEach((t=>{null!=i&&null!=i&&i.containerId?(null==i?void 0:i.containerId)===t.id&&t.toggle(e,null==i?void 0:i.id):t.toggle(e,null==i?void 0:i.id)}))}let p=1;const b=()=>""+p++;function w(e){return e&&(a(e.toastId)||r(e.toastId))?e.toastId:b()}function h(e,i){return function(e,i){u(e)&&(m()||d.push({content:e,options:i}),c.forEach((t=>{t.buildToast(e,i)})))}(e,i),i.toastId}function v(e,i){return{...i,type:i&&i.type||e,toastId:w(i)}}function y(e){return(i,t)=>h(i,v(e,t))}function S(e,i){return h(e,v("default",i))}S.loading=(e,i)=>h(e,v("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...i})),S.promise=function(e,i,t){let n,{pending:o,error:r,success:u}=i;o&&(n=a(o)?S.loading(o,t):S.loading(o.render,{...t,...o}));const l={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},c=(e,i,o)=>{if(null==i)return void S.dismiss(n);const r={type:e,...l,...t,data:o},s=a(i)?{render:i}:i;return n?S.update(n,{...r,...s}):S(s.render,{...r,...s}),o},d=s(e)?e():e;return d.then((e=>c("success",u,e))).catch((e=>c("error",r,e))),d},S.success=y("success"),S.info=y("info"),S.error=y("error"),S.warning=y("warning"),S.warn=S.warning,S.dark=(e,i)=>h(e,v("default",{theme:"dark",...i})),S.dismiss=function(e){!function(e){var i;if(m()){if(null==e||a(i=e)||r(i))c.forEach((i=>{i.removeToast(e)}));else if(e&&("containerId"in e||"id"in e)){const i=c.get(e.containerId);i?i.removeToast(e.id):c.forEach((i=>{i.removeToast(e.id)}))}}else d=d.filter((i=>null!=e&&i.options.toastId!==e))}(e)},S.clearWaitingQueue=function(e){void 0===e&&(e={}),c.forEach((i=>{!i.props.limit||e.containerId&&i.id!==e.containerId||i.clearQueue()}))},S.isActive=function(e,i){var t;if(i)return!(null==(t=c.get(i))||!t.isToastActive(e));let n=!1;return c.forEach((i=>{i.isToastActive(e)&&(n=!0)})),n},S.update=function(e,i){void 0===i&&(i={});const t=((e,i)=>{var t;let{containerId:n}=i;return null==(t=c.get(n||1))?void 0:t.toasts.get(e)})(e,i);if(t){const{props:n,content:o}=t,r={delay:100,...n,...i,toastId:i.toastId||e,updateId:b()};r.toastId!==e&&(r.staleId=e);const a=r.render||o;delete r.render,h(a,r)}},S.done=e=>{S.update(e,{progress:1})},S.onChange=function(e){return f.add(e),()=>{f.delete(e)}},S.play=e=>g(!0,e),S.pause=e=>g(!1,e),"undefined"!=typeof window?e.useLayoutEffect:e.useEffect;const x=function(e,i){return void 0===i&&(i=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:i}};function k(e,i){return function(e){if(Array.isArray(e))return e}(e)||function(e,i){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,r,a,s=[],u=!0,l=!1;try{if(r=(t=t.call(e)).next,0===i){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=r.call(t)).done)&&(s.push(n.value),s.length!==i);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,i)||function(e,i){if(e){if("string"==typeof e)return C(e,i);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?C(e,i):void 0}}(e,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,i){(null==i||i>e.length)&&(i=e.length);for(var t=0,n=Array(i);t<i;t++)n[t]=e[t];return n}l(x("bounce",!0)),l(x("slide",!0)),l(x("zoom")),l(x("flip"));var M=(0,e.createContext)({isLoggedIn:null,header:null,isAdmin:null,userInfo:null,refreshData:null,setHeader:null,setLoggedin:null,setRefreshData:null,hasRole:null,deviceUID:null,loadingUser:null});function T(){var t=sessionStorage.getItem("appVersionOld")||!1;return(0,e.useEffect)((function(){t&&sessionStorage.getItem("requiredVersion")&&function(e,i){for(var t=0,n=0,o=0,r=0;o<e.length||r<i.length;){for(;o<e.length&&"."!==e[o];)t=10*t+(e[o]-"0"),o++;for(;r<i.length&&"."!==i[r];)n=10*n+(i[r]-"0"),r++;if(t>n)return!0;if(n>t)return!1;t=n=0,o++,r++}return!0}(appVersion,sessionStorage.getItem("requiredVersion"))&&(S.success("Your application has been updated",{toastId:"appReload"}),sessionStorage.removeItem("appVersionOld"),sessionStorage.removeItem("requiredVersion"),sessionStorage.removeItem("appReloads"))}),[t]),i().createElement(i().Fragment,null)}const I=function(n){var o=n.refreshTimer,r=n.dataRefresh,a=n.userLoader,s=n.refreshToken,u=n.AuthenticatedAxiosObject,l=n.customeUpdateIcon,c=n.appVersion,d=n.children,f=k((0,e.useState)(localStorage.getItem("deviceUID")||!1),2),m=f[0],g=f[1];(0,e.useEffect)((function(){if(!m){var e=function(){if(localStorage.getItem("deviceFingerprint"))return localStorage.getItem("deviceFingerprint");var e=(new t.ClientJS).getFingerprint();return localStorage.setItem("deviceFingerprint",e),e}();g(e),u.defaults.headers.common.deviceUID=e}}),[m,u]);var p=k((0,e.useState)(""),2),b=p[0],w=p[1];u.defaults.withCredentials=!0,u.defaults.headers.common.Authorization=b,u.defaults.headers.common.deviceUID=m,u.defaults.headers.common.appVersion=c;var h=(0,e.useCallback)((function(e,i){w(e),setTimeout((function(){s().then((function(e){if(e.refreshed){var t="Bearer ".concat(e.access_token);w(t),u.defaults.headers.common.Authorization=t,i&&localStorage.setItem("Authorization",t),sessionStorage.setItem("Authorization",t)}})).catch((function(e){console.log(e),console.log("Missing/Invalid Token"),localStorage.removeItem("Authorization"),sessionStorage.removeItem("Authorization")}))}),100)}),[u,s]);(0,e.useEffect)((function(){var e=localStorage.getItem("Authorization"),i=sessionStorage.getItem("Authorization");return e?h(e,!0):i&&h(i,!1),function(){return clearInterval(h)}}),[b,h]);var v=k((0,e.useState)(!1),2),y=v[0],x=v[1],C=k((0,e.useState)(!1),2),I=C[0],P=C[1],A=k((0,e.useState)({}),2),E=A[0],L=A[1],B=k((0,e.useState)(!0),2),U=B[0],_=B[1];(0,e.useEffect)((function(){setTimeout((function(){a().then((function(e){var i=e.data;x(i.logged_in),P(i.is_admin),L(i.Info)})).catch((function(e){console.log(e)})).finally((function(){_(!1)}))}),100)}),[b,y,a]),(0,e.useEffect)((function(){var e=null;if(y){var i=!!localStorage.getItem("Authorization");e=setInterval((function(){h(sessionStorage.getItem("Authorization"),i)}),60*(o||60)*1e3||1e4)}else clearInterval(e);return function(){return clearInterval(e)}}),[b,h,y,o]),(0,e.useEffect)((function(){return function(){u.interceptors.response.use((function(e){return e}),(function(e){var i,t,n;if(455===(null==e||null===(i=e.response)||void 0===i?void 0:i.status))try{var o=e.response.data.logged_in||!1;y&&!o&&(x(!1),u.defaults.headers.common.Authorization="",S.info("Your session in no longer valid, please login again.",{toastId:"Forced_log_out"}))}catch(e){throw e}if(426===(null==e||null===(t=e.response)||void 0===t?void 0:t.status)){sessionStorage.setItem("appVersionOld",!0),sessionStorage.setItem("requiredVersion",e.response.data.minVersion);var r=sessionStorage.getItem("appReloads")||0;r<2?(sessionStorage.setItem("appReloads",r+1),setTimeout((function(){window.location.reload()}),1e3*r)):S.warning("The application needs to be updated pleaese wait for some time then reload the page.",{toastId:"appReloadError",icon:l})}throw null!=e&&null!==(n=e.response)&&void 0!==n&&n.status||"ERR_CANCELED"!==(null==e?void 0:e.code)&&"canceled"!==(null==e?void 0:e.message)&&S.error("The server is not responding, please reload or try again later.",{toastId:"ERR_CONNECTION_REFUSED"}),e}))}}));var R=k((0,e.useState)(!1),2),j=R[0],O=R[1];(0,e.useEffect)((function(){var e=setTimeout((function(){return O(!0)}),60*(r||60)*1e3||1e4);return function(){return clearTimeout(e)}}),[r]),(0,e.useEffect)((function(){j&&a().then((function(e){var i=e.data;L(i.Info),N(!1)}))}),[j,a]);var N=function(e){O(e)},D={isLoggedIn:y,header:b,isAdmin:I,userInfo:E,refreshData:j,setHeader:function(e){w(e)},setLoggedin:function(e){x(e)},setRefreshData:N,hasRole:function(e){return e.some((function(e){var i;return(null==E||null===(i=E.roles)||void 0===i?void 0:i.indexOf(e))>=0}))},deviceUID:m,loadingUser:U};return i().createElement(M.Provider,{value:D},i().createElement(T,null),d)}})(),o})()));
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-session.manager.sk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A react component used to manage token sessions with flask backend",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "webpack --mode production",
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
+
},
|
|
10
|
+
"author": "Skulldorom",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@babel/core": "^7.25.2",
|
|
14
|
+
"@babel/preset-env": "^7.25.3",
|
|
15
|
+
"@babel/preset-react": "^7.24.7",
|
|
16
|
+
"babel-loader": "^9.1.3",
|
|
17
|
+
"webpack": "^5.93.0",
|
|
18
|
+
"webpack-cli": "^5.1.4"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"clientjs": "^0.2.1",
|
|
22
|
+
"react-toastify": "^10.0.5"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClientJS } from "clientjs";
|
|
2
|
+
|
|
3
|
+
export default function getDeviceFingerprint() {
|
|
4
|
+
if (localStorage.getItem("deviceFingerprint"))
|
|
5
|
+
return localStorage.getItem("deviceFingerprint");
|
|
6
|
+
|
|
7
|
+
const client = new ClientJS();
|
|
8
|
+
const fingerprint = client.getFingerprint();
|
|
9
|
+
localStorage.setItem("deviceFingerprint", fingerprint);
|
|
10
|
+
return fingerprint;
|
|
11
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Javascript implementation
|
|
2
|
+
|
|
3
|
+
// Method to compare two versions.
|
|
4
|
+
// Returns 1 if v2 is smaller, -1
|
|
5
|
+
// if v1 is smaller, 0 if equal
|
|
6
|
+
export default function versionCompare(v1, v2) {
|
|
7
|
+
// vnum stores each numeric
|
|
8
|
+
// part of version
|
|
9
|
+
var vnum1 = 0,
|
|
10
|
+
vnum2 = 0;
|
|
11
|
+
|
|
12
|
+
// loop until both string are
|
|
13
|
+
// processed
|
|
14
|
+
for (var i = 0, j = 0; i < v1.length || j < v2.length; ) {
|
|
15
|
+
// storing numeric part of
|
|
16
|
+
// version 1 in vnum1
|
|
17
|
+
while (i < v1.length && v1[i] !== ".") {
|
|
18
|
+
vnum1 = vnum1 * 10 + (v1[i] - "0");
|
|
19
|
+
i++;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// storing numeric part of
|
|
23
|
+
// version 2 in vnum2
|
|
24
|
+
while (j < v2.length && v2[j] !== ".") {
|
|
25
|
+
vnum2 = vnum2 * 10 + (v2[j] - "0");
|
|
26
|
+
j++;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (vnum1 > vnum2) return true;
|
|
30
|
+
if (vnum2 > vnum1) return false;
|
|
31
|
+
|
|
32
|
+
// if equal, reset variables and
|
|
33
|
+
// go for next numeric part
|
|
34
|
+
vnum1 = vnum2 = 0;
|
|
35
|
+
i++;
|
|
36
|
+
j++;
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import React, { createContext, useState, useEffect, useCallback } from "react";
|
|
2
|
+
import versionCompare from "./components/versionCompare";
|
|
3
|
+
import getDeviceFingerprint from "./components/FingerPrint";
|
|
4
|
+
// Notifications
|
|
5
|
+
import { toast } from "react-toastify";
|
|
6
|
+
|
|
7
|
+
export const SessionManager = createContext({
|
|
8
|
+
isLoggedIn: null,
|
|
9
|
+
header: null,
|
|
10
|
+
isAdmin: null,
|
|
11
|
+
userInfo: null,
|
|
12
|
+
refreshData: null,
|
|
13
|
+
setHeader: null,
|
|
14
|
+
setLoggedin: null,
|
|
15
|
+
setRefreshData: null,
|
|
16
|
+
hasRole: null,
|
|
17
|
+
deviceUID: null,
|
|
18
|
+
loadingUser: null,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const SessionManagerProvider = ({
|
|
22
|
+
refreshTimer,
|
|
23
|
+
dataRefresh,
|
|
24
|
+
userLoader,
|
|
25
|
+
refreshToken,
|
|
26
|
+
AuthenticatedAxiosObject,
|
|
27
|
+
customeUpdateIcon,
|
|
28
|
+
appVersion,
|
|
29
|
+
children,
|
|
30
|
+
}) => {
|
|
31
|
+
// Set deivce UID
|
|
32
|
+
const [deviceUID, setDeviceUID] = useState(
|
|
33
|
+
localStorage.getItem("deviceUID") || false
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!deviceUID) {
|
|
38
|
+
const uid = getDeviceFingerprint();
|
|
39
|
+
setDeviceUID(uid);
|
|
40
|
+
AuthenticatedAxiosObject.defaults.headers.common["deviceUID"] = uid;
|
|
41
|
+
}
|
|
42
|
+
}, [deviceUID, AuthenticatedAxiosObject]);
|
|
43
|
+
|
|
44
|
+
// State to hold the selected header name
|
|
45
|
+
const [current, setCurrent] = useState("");
|
|
46
|
+
|
|
47
|
+
AuthenticatedAxiosObject.defaults.withCredentials = true;
|
|
48
|
+
AuthenticatedAxiosObject.defaults.headers.common["Authorization"] = current;
|
|
49
|
+
AuthenticatedAxiosObject.defaults.headers.common["deviceUID"] = deviceUID;
|
|
50
|
+
AuthenticatedAxiosObject.defaults.headers.common["appVersion"] = appVersion;
|
|
51
|
+
|
|
52
|
+
const fromPrevious = useCallback(
|
|
53
|
+
(auth, remember) => {
|
|
54
|
+
setCurrent(auth);
|
|
55
|
+
setTimeout(() => {
|
|
56
|
+
refreshToken()
|
|
57
|
+
.then((data) => {
|
|
58
|
+
if (data.refreshed) {
|
|
59
|
+
const token = `Bearer ${data.access_token}`;
|
|
60
|
+
setCurrent(token);
|
|
61
|
+
AuthenticatedAxiosObject.defaults.headers.common[
|
|
62
|
+
"Authorization"
|
|
63
|
+
] = token;
|
|
64
|
+
if (remember) localStorage.setItem("Authorization", token);
|
|
65
|
+
sessionStorage.setItem("Authorization", token);
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
.catch((err) => {
|
|
69
|
+
console.log(err);
|
|
70
|
+
console.log("Missing/Invalid Token");
|
|
71
|
+
localStorage.removeItem("Authorization");
|
|
72
|
+
sessionStorage.removeItem("Authorization");
|
|
73
|
+
});
|
|
74
|
+
}, 100);
|
|
75
|
+
},
|
|
76
|
+
[AuthenticatedAxiosObject, refreshToken]
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
const local_auth = localStorage.getItem("Authorization");
|
|
81
|
+
const sess_auth = sessionStorage.getItem("Authorization");
|
|
82
|
+
|
|
83
|
+
if (local_auth) fromPrevious(local_auth, true);
|
|
84
|
+
else if (sess_auth) fromPrevious(sess_auth, false);
|
|
85
|
+
return () => clearInterval(fromPrevious);
|
|
86
|
+
}, [current, fromPrevious]);
|
|
87
|
+
|
|
88
|
+
// Wrap setHeader to store new header names in localStorage
|
|
89
|
+
const setHeader = (header) => {
|
|
90
|
+
setCurrent(header);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const [currentLoggin, setCurrentLoggedIn] = useState(false);
|
|
94
|
+
const [isAdmin, setIsAdmin] = useState(false);
|
|
95
|
+
const [userInfo, setUserInfo] = useState({});
|
|
96
|
+
const [loadingUser, setLoadingUser] = useState(true);
|
|
97
|
+
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
setTimeout(() => {
|
|
100
|
+
userLoader()
|
|
101
|
+
.then((res) => {
|
|
102
|
+
const data = res.data;
|
|
103
|
+
setCurrentLoggedIn(data.logged_in);
|
|
104
|
+
setIsAdmin(data.is_admin);
|
|
105
|
+
setUserInfo(data.Info);
|
|
106
|
+
})
|
|
107
|
+
.catch((err) => {
|
|
108
|
+
console.log(err);
|
|
109
|
+
})
|
|
110
|
+
.finally(() => {
|
|
111
|
+
setLoadingUser(false);
|
|
112
|
+
});
|
|
113
|
+
}, 100);
|
|
114
|
+
}, [current, currentLoggin, userLoader]);
|
|
115
|
+
|
|
116
|
+
const setLoggedin = (status) => {
|
|
117
|
+
setCurrentLoggedIn(status);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
const tokenRefreshTimer = () => {
|
|
122
|
+
const mins = refreshTimer || 60;
|
|
123
|
+
return mins * 60 * 1000 || 10000;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
let interval = null;
|
|
127
|
+
if (currentLoggin) {
|
|
128
|
+
const remember = localStorage.getItem("Authorization") ? true : false;
|
|
129
|
+
interval = setInterval(() => {
|
|
130
|
+
fromPrevious(sessionStorage.getItem("Authorization"), remember);
|
|
131
|
+
}, tokenRefreshTimer());
|
|
132
|
+
} else {
|
|
133
|
+
clearInterval(interval);
|
|
134
|
+
}
|
|
135
|
+
return () => clearInterval(interval);
|
|
136
|
+
}, [current, fromPrevious, currentLoggin, refreshTimer]);
|
|
137
|
+
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
const customInterceptor = () => {
|
|
140
|
+
AuthenticatedAxiosObject.interceptors.response.use(
|
|
141
|
+
(response) => {
|
|
142
|
+
return response;
|
|
143
|
+
},
|
|
144
|
+
(error) => {
|
|
145
|
+
if (error?.response?.status === 455) {
|
|
146
|
+
try {
|
|
147
|
+
const status = error.response.data.logged_in || false;
|
|
148
|
+
if (currentLoggin && !status) {
|
|
149
|
+
setCurrentLoggedIn(false);
|
|
150
|
+
AuthenticatedAxiosObject.defaults.headers.common[
|
|
151
|
+
"Authorization"
|
|
152
|
+
] = ``;
|
|
153
|
+
toast.info(
|
|
154
|
+
"Your session in no longer valid, please login again.",
|
|
155
|
+
{ toastId: "Forced_log_out" }
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
} catch (err) {
|
|
159
|
+
throw err;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (error?.response?.status === 426) {
|
|
163
|
+
sessionStorage.setItem("appVersionOld", true);
|
|
164
|
+
sessionStorage.setItem(
|
|
165
|
+
"requiredVersion",
|
|
166
|
+
error.response.data.minVersion
|
|
167
|
+
);
|
|
168
|
+
let reloads = sessionStorage.getItem("appReloads") || 0;
|
|
169
|
+
if (reloads < 2) {
|
|
170
|
+
sessionStorage.setItem("appReloads", reloads + 1);
|
|
171
|
+
setTimeout(() => {
|
|
172
|
+
window.location.reload();
|
|
173
|
+
}, 1000 * reloads);
|
|
174
|
+
} else {
|
|
175
|
+
toast.warning(
|
|
176
|
+
"The application needs to be updated pleaese wait for some time then reload the page.",
|
|
177
|
+
{ toastId: "appReloadError", icon: customeUpdateIcon }
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (!error?.response?.status) {
|
|
183
|
+
if (error?.code !== "ERR_CANCELED" && error?.message !== "canceled")
|
|
184
|
+
toast.error(
|
|
185
|
+
"The server is not responding, please reload or try again later.",
|
|
186
|
+
{ toastId: "ERR_CONNECTION_REFUSED" }
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
};
|
|
193
|
+
return customInterceptor;
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// We will use the below to refresh our data about the user when ever we flag refreshData as true
|
|
197
|
+
const [refreshData, setRefreshFlag] = useState(false);
|
|
198
|
+
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
const refreshDelay = () => {
|
|
201
|
+
const mins = dataRefresh || 60;
|
|
202
|
+
return mins * 60 * 1000 || 10000;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const timer = setTimeout(() => setRefreshFlag(true), refreshDelay());
|
|
206
|
+
return () => clearTimeout(timer);
|
|
207
|
+
}, [dataRefresh]);
|
|
208
|
+
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
if (refreshData) {
|
|
211
|
+
userLoader().then((res) => {
|
|
212
|
+
const data = res.data;
|
|
213
|
+
setUserInfo(data.Info);
|
|
214
|
+
setRefreshData(false);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}, [refreshData, userLoader]);
|
|
218
|
+
|
|
219
|
+
const setRefreshData = (status) => {
|
|
220
|
+
setRefreshFlag(status);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// Check if user has specific role
|
|
224
|
+
|
|
225
|
+
const hasRole = (roles) => {
|
|
226
|
+
const found = roles.some((r) => userInfo?.roles?.indexOf(r) >= 0);
|
|
227
|
+
return found;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const contextValue = {
|
|
231
|
+
isLoggedIn: currentLoggin,
|
|
232
|
+
header: current,
|
|
233
|
+
isAdmin: isAdmin,
|
|
234
|
+
userInfo: userInfo,
|
|
235
|
+
refreshData: refreshData,
|
|
236
|
+
setHeader: setHeader,
|
|
237
|
+
setLoggedin: setLoggedin,
|
|
238
|
+
setRefreshData: setRefreshData,
|
|
239
|
+
hasRole: hasRole,
|
|
240
|
+
deviceUID: deviceUID,
|
|
241
|
+
loadingUser: loadingUser,
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
return (
|
|
245
|
+
<SessionManager.Provider value={contextValue}>
|
|
246
|
+
<VersionProtection />
|
|
247
|
+
{children}
|
|
248
|
+
</SessionManager.Provider>
|
|
249
|
+
);
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
function VersionProtection() {
|
|
253
|
+
const oldVersion = sessionStorage.getItem("appVersionOld") || false;
|
|
254
|
+
|
|
255
|
+
useEffect(() => {
|
|
256
|
+
if (
|
|
257
|
+
oldVersion &&
|
|
258
|
+
sessionStorage.getItem("requiredVersion") &&
|
|
259
|
+
versionCompare(appVersion, sessionStorage.getItem("requiredVersion"))
|
|
260
|
+
) {
|
|
261
|
+
toast.success("Your application has been updated", {
|
|
262
|
+
toastId: "appReload",
|
|
263
|
+
});
|
|
264
|
+
sessionStorage.removeItem("appVersionOld");
|
|
265
|
+
sessionStorage.removeItem("requiredVersion");
|
|
266
|
+
sessionStorage.removeItem("appReloads");
|
|
267
|
+
}
|
|
268
|
+
}, [oldVersion]);
|
|
269
|
+
|
|
270
|
+
return <></>;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export default SessionManagerProvider;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
entry: "./src/index.js",
|
|
5
|
+
output: {
|
|
6
|
+
path: path.resolve(__dirname, "dist"),
|
|
7
|
+
filename: "index.js",
|
|
8
|
+
library: "MyComponent",
|
|
9
|
+
libraryTarget: "umd",
|
|
10
|
+
umdNamedDefine: true,
|
|
11
|
+
},
|
|
12
|
+
externals: {
|
|
13
|
+
react: "react", // Use 'react' from the environment (do not bundle)
|
|
14
|
+
"react-dom": "react-dom", // Use 'react-dom' from the environment (do not bundle)
|
|
15
|
+
},
|
|
16
|
+
module: {
|
|
17
|
+
rules: [
|
|
18
|
+
{
|
|
19
|
+
test: /\.jsx?$/,
|
|
20
|
+
exclude: /node_modules/,
|
|
21
|
+
use: {
|
|
22
|
+
loader: "babel-loader",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
resolve: {
|
|
28
|
+
extensions: [".js", ".jsx"],
|
|
29
|
+
},
|
|
30
|
+
};
|