acsi-core 0.1.34 → 0.1.36

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/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  declare const historyCore: import("history").History<unknown>;
2
2
  import { setLoading, setAlert, setTenant, setAddTenant, setTeam, setUser, setMenuCollapse, setIsRefetchSidebar } from "./redux/commons/action";
3
- import { BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, OPENSALT_BASE_URL } from "./utils/constants";
3
+ import { BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, OPENSALT_BASE_URL, ORGANIZATION_TEAM, ORGANIZATION_TENANT } from "./utils/constants";
4
4
  import Login from "./containers/Login/views/Login";
5
5
  import store from "./store";
6
6
  import getAccessToken from "./utils/getAccessToken";
7
+ import firstCheckToken from "./utils/firstCheckToken";
7
8
  import NotFound from "./components/Commons/NotFound";
8
9
  import Loading from "./components/Loading/Loading";
9
10
  import LayoutContext from "./layouts/LayoutContext";
@@ -21,4 +22,4 @@ import CustomSelect from "./components/Selects/CustomSelect";
21
22
  import CustomAsyncSelect from "./components/Selects/CustomAsyncSelect";
22
23
  import CustomCreatable from "./components/Selects/CustomCreatable";
23
24
  import CustomSelectOption from "./components/Selects/CustomSelectOption";
24
- export { setLoading, BASE_URL, OPENSALT_BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, Login, getAccessToken, store, historyCore, setAlert, setUser, setTenant, setAddTenant, setTeam, setMenuCollapse, setIsRefetchSidebar, Loading, NotFound, LayoutContext, api, apiUpload, ConfirmDialog, CommonDialog, ToastContainer, toast, Role, CustomPagination, useGoogleSignOut, CoreButton, CoreInput, CoreSelect, CoreCheckbox, CoreRadio, CoreError, CoreModal, CoreRange, CoreTextArea, CoreSearch, CoreSelectCompact, CoreInputCompact, CoreTitleInput, getErrorMessage, CustomSelect, CustomAsyncSelect, CustomCreatable, CustomSelectOption, GoogleOAuthProvider };
25
+ export { setLoading, BASE_URL, OPENSALT_BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, ORGANIZATION_TEAM, ORGANIZATION_TENANT, firstCheckToken, Login, getAccessToken, store, historyCore, setAlert, setUser, setTenant, setAddTenant, setTeam, setMenuCollapse, setIsRefetchSidebar, Loading, NotFound, LayoutContext, api, apiUpload, ConfirmDialog, CommonDialog, ToastContainer, toast, Role, CustomPagination, useGoogleSignOut, CoreButton, CoreInput, CoreSelect, CoreCheckbox, CoreRadio, CoreError, CoreModal, CoreRange, CoreTextArea, CoreSearch, CoreSelectCompact, CoreInputCompact, CoreTitleInput, getErrorMessage, CustomSelect, CustomAsyncSelect, CustomCreatable, CustomSelectOption, GoogleOAuthProvider };
package/dist/index.js CHANGED
@@ -82,6 +82,8 @@ var COLORS = {
82
82
  red: "#ce3636",
83
83
  lightYellow: "#fff5ce"
84
84
  };
85
+ var ORGANIZATION_TENANT = "ORGANIZATION_TENANT";
86
+ var ORGANIZATION_TEAM = "ORGANIZATION_TEAM";
85
87
 
86
88
  var styleGlobal = {"signup_wrap":"_1KLz9","box-signin":"_2Jo1o","signin_title":"_3egBO","signup_link":"_1DoIT","google_button":"_34hK_","box-field":"_2e9xO","box-input":"_3zXRp","box-button-email":"_21FPk","box-signin-container":"_1QERu","box-signin-text":"_2-znH","box-signin-logo":"_1aB2m","box-right":"_3qndF","box-right-body":"_JzdCr","box-right-footer":"_19aCA","pr-30":"_2HB5r"};
87
89
 
@@ -603,49 +605,6 @@ var getAccessToken$1 = (function () {
603
605
  }
604
606
  });
605
607
 
606
- var NotFound = function NotFound() {
607
- return React__default.createElement("div", {
608
- className: "not-found"
609
- }, React__default.createElement("div", {
610
- className: "clearfix"
611
- }, React__default.createElement("h1", {
612
- className: "float-left display-3 mr-4"
613
- }, "404"), React__default.createElement("div", {
614
- className: "float-left"
615
- }, React__default.createElement("h4", {
616
- className: "pt-3"
617
- }, "Oops! You are lost."), React__default.createElement("p", {
618
- className: "text-muted mb-2"
619
- }, "The page you are looking for was not found."), React__default.createElement("div", null))));
620
- };
621
-
622
- var loadingStyle = {
623
- minWidth: "100vw",
624
- minHeight: "100vh",
625
- position: "fixed",
626
- top: 0,
627
- left: 0,
628
- zIndex: 999999999,
629
- backgroundColor: "rgba(0, 0, 0, 0.4)",
630
- display: "flex",
631
- justifyContent: "center",
632
- alignItems: "center"
633
- };
634
- var Loading = function Loading() {
635
- var isLoading = reactRedux.useSelector(function (state) {
636
- return state.common.isLoading;
637
- });
638
- localStorage.setItem("LAST_TIME_REQUETST", moment().utc().format("YYYY-MM-DD HH:mm:ss"));
639
- return isLoading ? React__default.createElement("div", {
640
- style: loadingStyle
641
- }, React__default.createElement("div", {
642
- className: "spinner-border text-secondary",
643
- role: "status"
644
- }, React__default.createElement("span", {
645
- className: "sr-only"
646
- }))) : null;
647
- };
648
-
649
608
  // A type of promise-like that resolves synchronously and supports only one observer
650
609
 
651
610
  const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
@@ -722,9 +681,69 @@ var apiUpload$1 = axios.create({
722
681
  });
723
682
  });
724
683
 
684
+ var AUTH_URL = BASE_URL + "/api/auth";
725
685
  var getInfo = function getInfo(role) {
726
686
  return api$1.get(BASE_URL + "/api/Auth/info?role=" + role);
727
687
  };
688
+ var checkToken = function checkToken(token) {
689
+ return api$1.post(AUTH_URL + "/checktoken", {
690
+ token: token
691
+ });
692
+ };
693
+
694
+ var firstCheckToken = function firstCheckToken() {
695
+ return Promise.resolve(_catch(function () {
696
+ var token = getAccessToken$1();
697
+ return token ? Promise.resolve(checkToken(token)).then(function (tokenStatus) {
698
+ return tokenStatus.data ? true : false;
699
+ }) : false;
700
+ }, function () {
701
+ return false;
702
+ }));
703
+ };
704
+
705
+ var NotFound = function NotFound() {
706
+ return React__default.createElement("div", {
707
+ className: "not-found"
708
+ }, React__default.createElement("div", {
709
+ className: "clearfix"
710
+ }, React__default.createElement("h1", {
711
+ className: "float-left display-3 mr-4"
712
+ }, "404"), React__default.createElement("div", {
713
+ className: "float-left"
714
+ }, React__default.createElement("h4", {
715
+ className: "pt-3"
716
+ }, "Oops! You are lost."), React__default.createElement("p", {
717
+ className: "text-muted mb-2"
718
+ }, "The page you are looking for was not found."), React__default.createElement("div", null))));
719
+ };
720
+
721
+ var loadingStyle = {
722
+ minWidth: "100vw",
723
+ minHeight: "100vh",
724
+ position: "fixed",
725
+ top: 0,
726
+ left: 0,
727
+ zIndex: 999999999,
728
+ backgroundColor: "rgba(0, 0, 0, 0.4)",
729
+ display: "flex",
730
+ justifyContent: "center",
731
+ alignItems: "center"
732
+ };
733
+ var Loading = function Loading() {
734
+ var isLoading = reactRedux.useSelector(function (state) {
735
+ return state.common.isLoading;
736
+ });
737
+ localStorage.setItem("LAST_TIME_REQUETST", moment().utc().format("YYYY-MM-DD HH:mm:ss"));
738
+ return isLoading ? React__default.createElement("div", {
739
+ style: loadingStyle
740
+ }, React__default.createElement("div", {
741
+ className: "spinner-border text-secondary",
742
+ role: "status"
743
+ }, React__default.createElement("span", {
744
+ className: "sr-only"
745
+ }))) : null;
746
+ };
728
747
 
729
748
  var useGoogleSignOut = function useGoogleSignOut(props) {
730
749
  var dispatch = reactRedux.useDispatch();
@@ -2096,8 +2115,11 @@ exports.Loading = Loading;
2096
2115
  exports.Login = Login;
2097
2116
  exports.NotFound = NotFound;
2098
2117
  exports.OPENSALT_BASE_URL = OPENSALT_BASE_URL;
2118
+ exports.ORGANIZATION_TEAM = ORGANIZATION_TEAM;
2119
+ exports.ORGANIZATION_TENANT = ORGANIZATION_TENANT;
2099
2120
  exports.api = api$1;
2100
2121
  exports.apiUpload = apiUpload$1;
2122
+ exports.firstCheckToken = firstCheckToken;
2101
2123
  exports.getAccessToken = getAccessToken$1;
2102
2124
  exports.getErrorMessage = getErrorMessage;
2103
2125
  exports.historyCore = historyCore;