andoncloud-sdk 1.3.3 → 1.3.6

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.
@@ -2,11 +2,11 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
2
2
 
3
3
  var React = require('react');
4
4
  var React__default = _interopDefault(React);
5
- var mobx = require('mobx');
6
5
  var reactRouterDom = require('react-router-dom');
7
6
  var propTypes = require('prop-types');
8
7
  var CssBaseline = _interopDefault(require('@mui/material/CssBaseline'));
9
8
  var styles = require('@mui/material/styles');
9
+ var mobx = require('mobx');
10
10
  var material = require('@mui/material');
11
11
  var loader = _interopDefault(require('./images/loader.svg'));
12
12
  var mobxReactLite = require('mobx-react-lite');
@@ -28,7 +28,7 @@ var Menu = _interopDefault(require('@mui/material/Menu'));
28
28
  var AccessTimeIcon = _interopDefault(require('@mui/icons-material/AccessTime'));
29
29
  var backdropPattern = _interopDefault(require('./images/backdropPattern.svg'));
30
30
 
31
- let e={data:""},t=t=>"object"==typeof window?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||e,l=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,a=/\/\*[^]*?\*\/|\s\s+|\n/g,n=(e,t)=>{let r="",l="",a="";for(let o in e){let s=e[o];"@"==o[0]?"i"==o[1]?r=o+" "+s+";":l+="f"==o[1]?n(s,o):o+"{"+n(s,"k"==o[1]?"":t)+"}":"object"==typeof s?l+=n(s,t?t.replace(/([^,])+/g,e=>o.replace(/(^:.*)|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):o):null!=s&&(o=/^--/.test(o)?o:o.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=n.p?n.p(o,s):o+":"+s+";");}return r+(t&&a?t+"{"+a+"}":a)+l},o={},s=e=>{if("object"==typeof e){let t="";for(let r in e)t+=r+s(e[r]);return t}return e},c=(e,t,r,c,i)=>{let u=s(e),p=o[u]||(o[u]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(u));if(!o[p]){let t=u!==e?e:(e=>{let t,r=[{}];for(;t=l.exec(e.replace(a,""));)t[4]?r.shift():t[3]?r.unshift(r[0][t[3]]=r[0][t[3]]||{}):r[0][t[1]]=t[2];return r[0]})(e);o[p]=n(i?{["@keyframes "+p]:t}:t,r?"":"."+p);}return ((e,t,r)=>{-1==t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(o[p],t,c),p},i=(e,t,r)=>e.reduce((e,l,a)=>{let o=t[a];if(o&&o.call){let e=o(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;o=t?"."+t:e&&"object"==typeof e?e.props?"":n(e,""):!1===e?"":e;}return e+l+(null==o?"":o)},"");function u(e){let r=this||{},l=e.call?e(r.p):e;return c(l.unshift?l.raw?i(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>Object.assign(e,t&&t.call?t(r.p):t),{}):l,t(r.target),r.g,r.o,r.k)}let p,d,f,g=u.bind({g:1}),b=u.bind({k:1});function h(e,t,r,l){n.p=t,p=e,d=r,f=l;}function m(e,t){let r=this||{};return function(){let l=arguments;function a(n,o){let s=Object.assign({},n),c=s.className||a.className;r.p=Object.assign({theme:d&&d()},s),r.o=/ *go\d+/.test(c),s.className=u.apply(r,l)+(c?" "+c:""),t&&(s.ref=o);let i=e;return e[0]&&(i=s.as||e,delete s.as),f&&i[0]&&f(s),p(i,s)}return t?t(a):a}}
31
+ let e={data:""},t=t=>"object"==typeof window?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||e,l=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,a=/\/\*[^]*?\*\/| +/g,n=/\n+/g,o=(e,t)=>{let r="",l="",a="";for(let n in e){let c=e[n];"@"==n[0]?"i"==n[1]?r=n+" "+c+";":l+="f"==n[1]?o(c,n):n+"{"+o(c,"k"==n[1]?"":t)+"}":"object"==typeof c?l+=o(c,t?t.replace(/([^,])+/g,e=>n.replace(/(^:.*)|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):n):null!=c&&(n=/^--/.test(n)?n:n.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=o.p?o.p(n,c):n+":"+c+";");}return r+(t&&a?t+"{"+a+"}":a)+l},c={},s=e=>{if("object"==typeof e){let t="";for(let r in e)t+=r+s(e[r]);return t}return e},i=(e,t,r,i,p)=>{let u=s(e),d=c[u]||(c[u]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(u));if(!c[d]){let t=u!==e?e:(e=>{let t,r,o=[{}];for(;t=l.exec(e.replace(a,""));)t[4]?o.shift():t[3]?(r=t[3].replace(n," ").trim(),o.unshift(o[0][r]=o[0][r]||{})):o[0][t[1]]=t[2].replace(n," ").trim();return o[0]})(e);c[d]=o(p?{["@keyframes "+d]:t}:t,r?"":"."+d);}return ((e,t,r)=>{-1==t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(c[d],t,i),d},p=(e,t,r)=>e.reduce((e,l,a)=>{let n=t[a];if(n&&n.call){let e=n(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;n=t?"."+t:e&&"object"==typeof e?e.props?"":o(e,""):!1===e?"":e;}return e+l+(null==n?"":n)},"");function u(e){let r=this||{},l=e.call?e(r.p):e;return i(l.unshift?l.raw?p(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>Object.assign(e,t&&t.call?t(r.p):t),{}):l,t(r.target),r.g,r.o,r.k)}let d,f,g,b=u.bind({g:1}),h=u.bind({k:1});function m(e,t,r,l){o.p=t,d=e,f=r,g=l;}function j(e,t){let r=this||{};return function(){let l=arguments;function a(n,o){let c=Object.assign({},n),s=c.className||a.className;r.p=Object.assign({theme:f&&f()},c),r.o=/ *go\d+/.test(s),c.className=u.apply(r,l)+(s?" "+s:""),t&&(c.ref=o);let i=e;return e[0]&&(i=c.as||e,delete c.as),g&&i[0]&&g(c),d(i,c)}return t?t(a):a}}
32
32
 
33
33
  function _extends() {
34
34
  _extends = Object.assign || function (target) {
@@ -467,10 +467,10 @@ function _templateObject() {
467
467
 
468
468
  return data;
469
469
  }
470
- var circleAnimation = /*#__PURE__*/b( /*#__PURE__*/_templateObject());
471
- var firstLineAnimation = /*#__PURE__*/b( /*#__PURE__*/_templateObject2());
472
- var secondLineAnimation = /*#__PURE__*/b( /*#__PURE__*/_templateObject3());
473
- var ErrorIcon = /*#__PURE__*/m('div')( /*#__PURE__*/_templateObject4(), function (p) {
470
+ var circleAnimation = /*#__PURE__*/h( /*#__PURE__*/_templateObject());
471
+ var firstLineAnimation = /*#__PURE__*/h( /*#__PURE__*/_templateObject2());
472
+ var secondLineAnimation = /*#__PURE__*/h( /*#__PURE__*/_templateObject3());
473
+ var ErrorIcon = /*#__PURE__*/j('div')( /*#__PURE__*/_templateObject4(), function (p) {
474
474
  return p.primary || '#ff4b4b';
475
475
  }, circleAnimation, firstLineAnimation, function (p) {
476
476
  return p.secondary || '#fff';
@@ -495,8 +495,8 @@ function _templateObject$1() {
495
495
 
496
496
  return data;
497
497
  }
498
- var rotate = /*#__PURE__*/b( /*#__PURE__*/_templateObject$1());
499
- var LoaderIcon = /*#__PURE__*/m('div')( /*#__PURE__*/_templateObject2$1(), function (p) {
498
+ var rotate = /*#__PURE__*/h( /*#__PURE__*/_templateObject$1());
499
+ var LoaderIcon = /*#__PURE__*/j('div')( /*#__PURE__*/_templateObject2$1(), function (p) {
500
500
  return p.secondary || '#e0e0e0';
501
501
  }, function (p) {
502
502
  return p.primary || '#616161';
@@ -531,9 +531,9 @@ function _templateObject$2() {
531
531
 
532
532
  return data;
533
533
  }
534
- var circleAnimation$1 = /*#__PURE__*/b( /*#__PURE__*/_templateObject$2());
535
- var checkmarkAnimation = /*#__PURE__*/b( /*#__PURE__*/_templateObject2$2());
536
- var CheckmarkIcon = /*#__PURE__*/m('div')( /*#__PURE__*/_templateObject3$1(), function (p) {
534
+ var circleAnimation$1 = /*#__PURE__*/h( /*#__PURE__*/_templateObject$2());
535
+ var checkmarkAnimation = /*#__PURE__*/h( /*#__PURE__*/_templateObject2$2());
536
+ var CheckmarkIcon = /*#__PURE__*/j('div')( /*#__PURE__*/_templateObject3$1(), function (p) {
537
537
  return p.primary || '#61d345';
538
538
  }, circleAnimation$1, checkmarkAnimation, function (p) {
539
539
  return p.secondary || '#fff';
@@ -578,10 +578,10 @@ function _templateObject$3() {
578
578
 
579
579
  return data;
580
580
  }
581
- var StatusWrapper = /*#__PURE__*/m('div')( /*#__PURE__*/_templateObject$3());
582
- var IndicatorWrapper = /*#__PURE__*/m('div')( /*#__PURE__*/_templateObject2$3());
583
- var enter = /*#__PURE__*/b( /*#__PURE__*/_templateObject3$2());
584
- var AnimatedIconWrapper = /*#__PURE__*/m('div')( /*#__PURE__*/_templateObject4$1(), enter);
581
+ var StatusWrapper = /*#__PURE__*/j('div')( /*#__PURE__*/_templateObject$3());
582
+ var IndicatorWrapper = /*#__PURE__*/j('div')( /*#__PURE__*/_templateObject2$3());
583
+ var enter = /*#__PURE__*/h( /*#__PURE__*/_templateObject3$2());
584
+ var AnimatedIconWrapper = /*#__PURE__*/j('div')( /*#__PURE__*/_templateObject4$1(), enter);
585
585
  var ToastIcon = function ToastIcon(_ref) {
586
586
  var toast = _ref.toast;
587
587
  var icon = toast.icon,
@@ -633,8 +633,8 @@ var exitAnimation = function exitAnimation(factor) {
633
633
 
634
634
  var fadeInAnimation = "0%{opacity:0;} 100%{opacity:1;}";
635
635
  var fadeOutAnimation = "0%{opacity:1;} 100%{opacity:0;}";
636
- var ToastBarBase = /*#__PURE__*/m('div', React.forwardRef)( /*#__PURE__*/_templateObject$4());
637
- var Message = /*#__PURE__*/m('div')( /*#__PURE__*/_templateObject2$4());
636
+ var ToastBarBase = /*#__PURE__*/j('div', React.forwardRef)( /*#__PURE__*/_templateObject$4());
637
+ var Message = /*#__PURE__*/j('div')( /*#__PURE__*/_templateObject2$4());
638
638
 
639
639
  var getAnimationStyle = function getAnimationStyle(position, visible) {
640
640
  var top = position.includes('top');
@@ -645,7 +645,7 @@ var getAnimationStyle = function getAnimationStyle(position, visible) {
645
645
  exit = _ref[1];
646
646
 
647
647
  return {
648
- animation: visible ? b(enter) + " 0.35s cubic-bezier(.21,1.02,.73,1) forwards" : b(exit) + " 0.4s forwards cubic-bezier(.06,.71,.55,1)"
648
+ animation: visible ? h(enter) + " 0.35s cubic-bezier(.21,1.02,.73,1) forwards" : h(exit) + " 0.4s forwards cubic-bezier(.06,.71,.55,1)"
649
649
  };
650
650
  };
651
651
 
@@ -679,7 +679,7 @@ function _templateObject$5() {
679
679
 
680
680
  return data;
681
681
  }
682
- h(React.createElement);
682
+ m(React.createElement);
683
683
 
684
684
  var getPositionStyle = function getPositionStyle(position, offset) {
685
685
  var top = position.includes('top');
@@ -775,7 +775,7 @@ function _createClass(Constructor, protoProps, staticProps) {
775
775
  }
776
776
 
777
777
  function _extends$1() {
778
- _extends$1 = Object.assign || function (target) {
778
+ _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
779
779
  for (var i = 1; i < arguments.length; i++) {
780
780
  var source = arguments[i];
781
781
 
@@ -788,108 +788,9 @@ function _extends$1() {
788
788
 
789
789
  return target;
790
790
  };
791
-
792
791
  return _extends$1.apply(this, arguments);
793
792
  }
794
793
 
795
- var ModalContext = React__default.createContext({
796
- showModal: null,
797
- hideModal: null,
798
- isOpenedModal: false
799
- });
800
-
801
- var ModalProvider = function ModalProvider(_ref) {
802
- var children = _ref.children;
803
-
804
- var _useState = React.useState({}),
805
- modalsConfig = _useState[0],
806
- setConfig = _useState[1];
807
-
808
- var hideModal = React.useCallback(function (modalKey, onClose) {
809
- setConfig(function (prevConfig) {
810
- var _extends2;
811
-
812
- return _extends$1({}, prevConfig, (_extends2 = {}, _extends2[modalKey] = _extends$1({}, prevConfig[modalKey], {
813
- isOpen: false
814
- }), _extends2));
815
- });
816
-
817
- if (onClose) {
818
- onClose();
819
- }
820
- }, [setConfig]);
821
- var showModal = React.useCallback(function (modalKey, component, modalData) {
822
- setConfig(function (prevConfig) {
823
- var _extends3;
824
-
825
- return _extends$1({}, prevConfig, (_extends3 = {}, _extends3[modalKey] = {
826
- isOpen: true,
827
- component: component,
828
- data: modalData
829
- }, _extends3));
830
- });
831
- }, [setConfig]);
832
- var contextValue = React.useMemo(function () {
833
- return {
834
- showModal: showModal,
835
- hideModal: hideModal,
836
- isOpenedModal: Object.values(modalsConfig).some(function (_ref2) {
837
- var isOpen = _ref2.isOpen;
838
- return isOpen;
839
- })
840
- };
841
- }, [hideModal, showModal, modalsConfig]);
842
- return /*#__PURE__*/React__default.createElement(ModalContext.Provider, {
843
- value: contextValue
844
- }, children, Object.keys(modalsConfig).map(function (modalKey) {
845
- var _modalsConfig$modalKe = modalsConfig[modalKey],
846
- Component = _modalsConfig$modalKe.component,
847
- isOpen = _modalsConfig$modalKe.isOpen,
848
- data = _modalsConfig$modalKe.data;
849
- return isOpen && /*#__PURE__*/React__default.createElement(Component, _extends$1({
850
- onClose: function onClose() {
851
- return hideModal(modalKey);
852
- },
853
- key: modalKey,
854
- isOpen: isOpen
855
- }, data));
856
- }));
857
- };
858
-
859
- var generateModalKey = function () {
860
- var count = 0;
861
- return function () {
862
- return "" + ++count;
863
- };
864
- }();
865
-
866
- function useModal(component, data, onClose) {
867
- var key = React.useMemo(generateModalKey, []);
868
- var context = React.useContext(ModalContext);
869
- var showModal = React.useCallback(function (modalData) {
870
- return context.showModal(key, component, modalData instanceof Event ? data : _extends$1({}, data, modalData));
871
- }, [data, context.showModal]);
872
- var hideModal = React.useCallback(function () {
873
- return context.hideModal(key, onClose);
874
- }, [context.hideModal, onClose, key]);
875
- return [showModal, hideModal];
876
- }
877
-
878
- useModal.ModalContext = ModalContext;
879
- useModal.ModalProvider = ModalProvider;
880
-
881
- var AuthConfigContext = React.createContext();
882
- var AuthConfigProvider = function AuthConfigProvider(_ref) {
883
- var children = _ref.children,
884
- config = _ref.config;
885
- return /*#__PURE__*/React__default.createElement(AuthConfigContext.Provider, {
886
- value: config
887
- }, children);
888
- };
889
- var useAuthConfig = function useAuthConfig() {
890
- return React.useContext(AuthConfigContext);
891
- };
892
-
893
794
  // A type of promise-like that resolves synchronously and supports only one observer
894
795
 
895
796
  const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
@@ -1434,19 +1335,26 @@ var SessionStore = /*#__PURE__*/function () {
1434
1335
  function SessionStore() {
1435
1336
  this.loading = false;
1436
1337
  this.loginStatus = {
1437
- status: "not_authorized"
1338
+ status: "unknown"
1438
1339
  };
1439
1340
  this.api = new SessionAPI();
1440
1341
  this.networkError = null;
1441
1342
  mobx.makeObservable(this, {
1442
1343
  loading: mobx.observable,
1443
- loginStatus: mobx.observable.deep
1344
+ setLoading: mobx.action,
1345
+ loginStatus: mobx.observable.deep,
1346
+ setConnectedLoginStatus: mobx.action,
1347
+ setNotAuthorizedLoginStatus: mobx.action
1444
1348
  });
1445
1349
  }
1446
1350
 
1447
1351
  var _proto2 = SessionStore.prototype;
1448
1352
 
1449
- _proto2.updateLoginStatus = function updateLoginStatus() {
1353
+ _proto2.setLoading = function setLoading(value) {
1354
+ this.loading = value;
1355
+ };
1356
+
1357
+ _proto2.setConnectedLoginStatus = function setConnectedLoginStatus() {
1450
1358
  this.loginStatus = {
1451
1359
  status: "connected",
1452
1360
  authResponse: {
@@ -1458,6 +1366,12 @@ var SessionStore = /*#__PURE__*/function () {
1458
1366
  };
1459
1367
  };
1460
1368
 
1369
+ _proto2.setNotAuthorizedLoginStatus = function setNotAuthorizedLoginStatus() {
1370
+ this.loginStatus = {
1371
+ status: "not_authorized"
1372
+ };
1373
+ };
1374
+
1461
1375
  _proto2.setAuthConfig = function setAuthConfig(config) {
1462
1376
  this.api.setAuthConfig(config);
1463
1377
  };
@@ -1491,9 +1405,10 @@ var SessionStore = /*#__PURE__*/function () {
1491
1405
  try {
1492
1406
  var _this8 = this;
1493
1407
 
1494
- _this8.loading = true;
1408
+ _this8.setLoading(true);
1409
+
1495
1410
  return Promise.resolve(_this8.api.authorize(credentials)).then(function (session) {
1496
- _this8.loading = false;
1411
+ _this8.setLoading(false);
1497
1412
 
1498
1413
  if (!session) {
1499
1414
  return null;
@@ -1506,7 +1421,7 @@ var SessionStore = /*#__PURE__*/function () {
1506
1421
 
1507
1422
  _this8.setCurrentUser(session.user);
1508
1423
 
1509
- _this8.updateLoginStatus();
1424
+ _this8.setConnectedLoginStatus();
1510
1425
  }
1511
1426
 
1512
1427
  return session;
@@ -1530,8 +1445,10 @@ var SessionStore = /*#__PURE__*/function () {
1530
1445
  return Promise.resolve(_this10.api.getUserData()).then(function (user) {
1531
1446
  _this10.setCurrentUser(user);
1532
1447
 
1533
- _this10.updateLoginStatus();
1448
+ _this10.setConnectedLoginStatus();
1534
1449
  });
1450
+ } else {
1451
+ _this10.setNotAuthorizedLoginStatus();
1535
1452
  }
1536
1453
  }();
1537
1454
 
@@ -1553,9 +1470,7 @@ var SessionStore = /*#__PURE__*/function () {
1553
1470
 
1554
1471
  _this12.removeCurrentUser();
1555
1472
 
1556
- _this12.loginStatus = {
1557
- status: "not_authorized"
1558
- };
1473
+ _this12.setNotAuthorizedLoginStatus();
1559
1474
  });
1560
1475
  }
1561
1476
  }();
@@ -1624,6 +1539,119 @@ var SessionStore = /*#__PURE__*/function () {
1624
1539
 
1625
1540
  var sessionStore = new SessionStore();
1626
1541
 
1542
+ var useLoginStatus = function useLoginStatus() {
1543
+ var _useState = React.useState(sessionStore.loginStatus),
1544
+ loginStatus = _useState[0],
1545
+ setLoginStatus = _useState[1];
1546
+
1547
+ React.useEffect(function () {
1548
+ return mobx.reaction(function () {
1549
+ return mobx.toJS(sessionStore.loginStatus);
1550
+ }, function () {
1551
+ setLoginStatus(sessionStore.loginStatus);
1552
+ });
1553
+ }, []);
1554
+ return loginStatus;
1555
+ };
1556
+
1557
+ var ModalContext = React__default.createContext({
1558
+ showModal: null,
1559
+ hideModal: null,
1560
+ isOpenedModal: false
1561
+ });
1562
+
1563
+ var ModalProvider = function ModalProvider(_ref) {
1564
+ var children = _ref.children;
1565
+
1566
+ var _useState = React.useState({}),
1567
+ modalsConfig = _useState[0],
1568
+ setConfig = _useState[1];
1569
+
1570
+ var hideModal = React.useCallback(function (modalKey, onClose) {
1571
+ setConfig(function (prevConfig) {
1572
+ var _extends2;
1573
+
1574
+ return _extends$1({}, prevConfig, (_extends2 = {}, _extends2[modalKey] = _extends$1({}, prevConfig[modalKey], {
1575
+ isOpen: false
1576
+ }), _extends2));
1577
+ });
1578
+
1579
+ if (onClose) {
1580
+ onClose();
1581
+ }
1582
+ }, [setConfig]);
1583
+ var showModal = React.useCallback(function (modalKey, component, modalData) {
1584
+ setConfig(function (prevConfig) {
1585
+ var _extends3;
1586
+
1587
+ return _extends$1({}, prevConfig, (_extends3 = {}, _extends3[modalKey] = {
1588
+ isOpen: true,
1589
+ component: component,
1590
+ data: modalData
1591
+ }, _extends3));
1592
+ });
1593
+ }, [setConfig]);
1594
+ var contextValue = React.useMemo(function () {
1595
+ return {
1596
+ showModal: showModal,
1597
+ hideModal: hideModal,
1598
+ isOpenedModal: Object.values(modalsConfig).some(function (_ref2) {
1599
+ var isOpen = _ref2.isOpen;
1600
+ return isOpen;
1601
+ })
1602
+ };
1603
+ }, [hideModal, showModal, modalsConfig]);
1604
+ return /*#__PURE__*/React__default.createElement(ModalContext.Provider, {
1605
+ value: contextValue
1606
+ }, children, Object.keys(modalsConfig).map(function (modalKey) {
1607
+ var _modalsConfig$modalKe = modalsConfig[modalKey],
1608
+ Component = _modalsConfig$modalKe.component,
1609
+ isOpen = _modalsConfig$modalKe.isOpen,
1610
+ data = _modalsConfig$modalKe.data;
1611
+ return isOpen && /*#__PURE__*/React__default.createElement(Component, _extends$1({
1612
+ onClose: function onClose() {
1613
+ return hideModal(modalKey);
1614
+ },
1615
+ key: modalKey,
1616
+ isOpen: isOpen
1617
+ }, data));
1618
+ }));
1619
+ };
1620
+
1621
+ var generateModalKey = function () {
1622
+ var count = 0;
1623
+ return function () {
1624
+ return "" + ++count;
1625
+ };
1626
+ }();
1627
+
1628
+ function useModal(component, data, onClose) {
1629
+ var key = React.useMemo(generateModalKey, []);
1630
+ var context = React.useContext(ModalContext);
1631
+ var showModal = React.useCallback(function (modalData) {
1632
+ return context.showModal(key, component, modalData instanceof Event ? data : _extends$1({}, data, modalData));
1633
+ }, [data, context.showModal]);
1634
+ var hideModal = React.useCallback(function () {
1635
+ return context.hideModal(key, onClose);
1636
+ }, [context.hideModal, onClose, key]);
1637
+ return [showModal, hideModal];
1638
+ }
1639
+
1640
+ useModal.ModalContext = ModalContext;
1641
+ useModal.ModalProvider = ModalProvider;
1642
+
1643
+ var AuthConfigContext = React.createContext();
1644
+ var AuthConfigProvider = function AuthConfigProvider(_ref) {
1645
+ var children = _ref.children,
1646
+ config = _ref.config;
1647
+ return /*#__PURE__*/React__default.createElement(AuthConfigContext.Provider, {
1648
+ value: config
1649
+ }, children);
1650
+ };
1651
+ var useAuthConfig = function useAuthConfig() {
1652
+ return React.useContext(AuthConfigContext);
1653
+ };
1654
+
1627
1655
  var defaultTheme = styles.createTheme(styles.adaptV4Theme({
1628
1656
  props: {
1629
1657
  MuiButton: {
@@ -3392,6 +3420,9 @@ var App = mobxReactLite.observer(function (_ref) {
3392
3420
  authProps = _ref.authProps,
3393
3421
  muiTheme = _ref.muiTheme;
3394
3422
 
3423
+ var _useLoginStatus = useLoginStatus(),
3424
+ status = _useLoginStatus.status;
3425
+
3395
3426
  var _useState = React.useState(false),
3396
3427
  appReady = _useState[0],
3397
3428
  setAppReady = _useState[1];
@@ -3415,24 +3446,29 @@ var App = mobxReactLite.observer(function (_ref) {
3415
3446
  React.useEffect(function () {
3416
3447
  var recoverSession = function recoverSession() {
3417
3448
  try {
3418
- if (authEnabled) {
3419
- return Promise.resolve(sessionStore.recover());
3420
- }
3449
+ var _temp2 = function () {
3450
+ if (authEnabled) {
3451
+ return Promise.resolve(sessionStore.recover()).then(function () {});
3452
+ }
3453
+ }();
3421
3454
 
3422
- return Promise.resolve();
3455
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
3423
3456
  } catch (e) {
3424
3457
  return Promise.reject(e);
3425
3458
  }
3426
3459
  };
3427
3460
 
3428
3461
  if (authEnabled) {
3429
- recoverSession().then(function () {
3430
- return setAppReady(true);
3431
- });
3462
+ recoverSession();
3432
3463
  } else {
3433
3464
  setAppReady(true);
3434
3465
  }
3435
3466
  }, [authEnabled]);
3467
+ React.useEffect(function () {
3468
+ if (authEnabled && status !== "unknown") {
3469
+ setAppReady(true);
3470
+ }
3471
+ }, [authEnabled, status]);
3436
3472
  return /*#__PURE__*/React__default.createElement(styles.ThemeProvider, {
3437
3473
  theme: styles.createTheme(muiTheme)
3438
3474
  }, /*#__PURE__*/React__default.createElement(CssBaseline, null), /*#__PURE__*/React__default.createElement(Toaster, null), /*#__PURE__*/React__default.createElement(AuthConfigProvider, {
@@ -3465,21 +3501,6 @@ App.defaultProps = {
3465
3501
  muiTheme: defaultTheme
3466
3502
  };
3467
3503
 
3468
- var useLoginStatus = function useLoginStatus() {
3469
- var _useState = React.useState(sessionStore.loginStatus),
3470
- loginStatus = _useState[0],
3471
- setLoginStatus = _useState[1];
3472
-
3473
- React.useEffect(function () {
3474
- return mobx.reaction(function () {
3475
- return mobx.toJS(sessionStore.loginStatus);
3476
- }, function () {
3477
- setLoginStatus(sessionStore.loginStatus);
3478
- });
3479
- }, []);
3480
- return loginStatus;
3481
- };
3482
-
3483
3504
  var logout = function logout() {
3484
3505
  return sessionStore.logout();
3485
3506
  };