acsi-core 0.1.26 → 0.1.29

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/README.md CHANGED
@@ -1,46 +1,46 @@
1
- # Getting Started with Create React App
2
-
3
- This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4
-
5
- ## Available Scripts
6
-
7
- In the project directory, you can run:
8
-
9
- ### `npm start`
10
-
11
- Runs the app in the development mode.\
12
- Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13
-
14
- The page will reload if you make edits.\
15
- You will also see any lint errors in the console.
16
-
17
- ### `npm test`
18
-
19
- Launches the test runner in the interactive watch mode.\
20
- See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21
-
22
- ### `npm run build`
23
-
24
- Builds the app for production to the `build` folder.\
25
- It correctly bundles React in production mode and optimizes the build for the best performance.
26
-
27
- The build is minified and the filenames include the hashes.\
28
- Your app is ready to be deployed!
29
-
30
- See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31
-
32
- ### `npm run eject`
33
-
34
- **Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35
-
36
- If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37
-
38
- Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39
-
40
- You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41
-
42
- ## Learn More
43
-
44
- You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45
-
46
- To learn React, check out the [React documentation](https://reactjs.org/).
1
+ # Getting Started with Create React App
2
+
3
+ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4
+
5
+ ## Available Scripts
6
+
7
+ In the project directory, you can run:
8
+
9
+ ### `npm start`
10
+
11
+ Runs the app in the development mode.\
12
+ Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13
+
14
+ The page will reload if you make edits.\
15
+ You will also see any lint errors in the console.
16
+
17
+ ### `npm test`
18
+
19
+ Launches the test runner in the interactive watch mode.\
20
+ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21
+
22
+ ### `npm run build`
23
+
24
+ Builds the app for production to the `build` folder.\
25
+ It correctly bundles React in production mode and optimizes the build for the best performance.
26
+
27
+ The build is minified and the filenames include the hashes.\
28
+ Your app is ready to be deployed!
29
+
30
+ See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31
+
32
+ ### `npm run eject`
33
+
34
+ **Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35
+
36
+ If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37
+
38
+ Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39
+
40
+ You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41
+
42
+ ## Learn More
43
+
44
+ You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45
+
46
+ To learn React, check out the [React documentation](https://reactjs.org/).
@@ -6,6 +6,7 @@ interface IProps {
6
6
  icon?: JSX.Element | string;
7
7
  disabled?: boolean;
8
8
  htmlType?: "button" | "submit";
9
+ [key: string]: any;
9
10
  }
10
11
  declare const CoreButton: (props: IProps) => React.JSX.Element;
11
12
  export default CoreButton;
@@ -4,6 +4,7 @@ interface Props {
4
4
  cancelText?: string;
5
5
  okText?: string;
6
6
  onConfirm: () => void;
7
+ onClose?: () => void;
7
8
  open: boolean;
8
9
  toggle: () => void;
9
10
  isDelete?: boolean;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  declare const historyCore: import("history").History<unknown>;
2
- import { setLoading, setAlert, setUser, setMenuCollapse, setIsRefetchSidebar } from "./redux/commons/action";
2
+ import { setLoading, setAlert, setTenant, setAddTenant, setTeam, setUser, setMenuCollapse, setIsRefetchSidebar } from "./redux/commons/action";
3
3
  import { BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, OPENSALT_BASE_URL } from "./utils/constants";
4
4
  import Login from "./containers/Login/views/Login";
5
5
  import store from "./store";
@@ -20,4 +20,4 @@ import CustomSelect from "./components/Selects/CustomSelect";
20
20
  import CustomAsyncSelect from "./components/Selects/CustomAsyncSelect";
21
21
  import CustomCreatable from "./components/Selects/CustomCreatable";
22
22
  import CustomSelectOption from "./components/Selects/CustomSelectOption";
23
- export { setLoading, BASE_URL, OPENSALT_BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, Login, store, historyCore, setAlert, setUser, 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 };
23
+ export { setLoading, BASE_URL, OPENSALT_BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, Login, 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
@@ -26,6 +26,9 @@ var setLanguage = toolkit.createAction("common/setLanguage");
26
26
  var reset = toolkit.createAction("common/reset");
27
27
  var setMenuCollapse = toolkit.createAction("common/setMenuCollapse");
28
28
  var setIsRefetchSidebar = toolkit.createAction("common/setIsRefetchSidebar");
29
+ var setTenant = toolkit.createAction("common/setTenant");
30
+ var setAddTenant = toolkit.createAction("common/setAddTenant");
31
+ var setTeam = toolkit.createAction("common/setTeam");
29
32
 
30
33
  var GOOGLE_RECAPTCHA_KEY = process.env.REACT_APP_GOOGLE_RECAPTCHA_KEY || "";
31
34
  var GOOGLE_CLIENT_ID = process.env.REACT_APP_GOOGLE_CLIENT_ID || "";
@@ -40,7 +43,6 @@ var PUSHER_CONFIG = {
40
43
  var OPENSALT_BASE_URL = process.env.REACT_APP_OPENSALT || "";
41
44
  var REACT_KEY_TINYMCE = "pko716e6i67met1af7d98ygkma5u38citul7ch78y6pz8bvr";
42
45
  var ACCESS_TOKEN = "ACCESS_TOKEN";
43
- var ACADEMY_DOMAIN = "ACADEMY_DOMAIN";
44
46
  var DATE_TIME_MIN_VALUE = "0001-01-01T00:00:00";
45
47
  var DefaultErrorMessage = "an_unexpected_error_has_occurred";
46
48
  var getAccessToken = function getAccessToken() {
@@ -573,6 +575,12 @@ var commonReducer = toolkit.createReducer(initialState, function (builder) {
573
575
  state.menuCollapse = action.payload;
574
576
  }).addCase(setIsRefetchSidebar, function (state) {
575
577
  state.isRefetchSidebar = !state.isRefetchSidebar;
578
+ }).addCase(setTenant, function (state, action) {
579
+ state.user.currentTenantId = action.payload;
580
+ }).addCase(setAddTenant, function (state, action) {
581
+ state.user.tenantInfo = action.payload;
582
+ }).addCase(setTeam, function (state, action) {
583
+ state.user.currentTeamId = action.payload;
576
584
  });
577
585
  });
578
586
 
@@ -716,8 +724,8 @@ var apiUpload$1 = axios.create({
716
724
  });
717
725
  });
718
726
 
719
- var getInfo = function getInfo() {
720
- return api$1.get(BASE_URL + "/api/Auth/info");
727
+ var getInfo = function getInfo(role) {
728
+ return api$1.get(BASE_URL + "/api/Auth/info?role=" + role);
721
729
  };
722
730
 
723
731
  var useGoogleSignOut = function useGoogleSignOut(props) {
@@ -737,15 +745,9 @@ var useGoogleSignOut = function useGoogleSignOut(props) {
737
745
  }),
738
746
  signOut = _useGoogleLogout.signOut,
739
747
  loaded = _useGoogleLogout.loaded;
740
- var handleSignOut = function handleSignOut(isRemoveDomainStorage) {
741
- if (isRemoveDomainStorage === void 0) {
742
- isRemoveDomainStorage = false;
743
- }
748
+ var handleSignOut = function handleSignOut() {
744
749
  localStorage.removeItem("USER_INFORMATION");
745
750
  localStorage.removeItem(ACCESS_TOKEN);
746
- if (isRemoveDomainStorage) {
747
- localStorage.removeItem(ACADEMY_DOMAIN);
748
- }
749
751
  try {
750
752
  signOut();
751
753
  } catch (error) {
@@ -771,11 +773,6 @@ var LayoutContext = function LayoutContext(_ref) {
771
773
  }),
772
774
  handleSignOut = _useGoogleSignOut.handleSignOut;
773
775
  var dispatch = reactRedux.useDispatch();
774
- var user = reactRedux.useSelector(function (state) {
775
- var _state$common;
776
- return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
777
- });
778
- var roles = (user === null || user === void 0 ? void 0 : user.roles) || [];
779
776
  var resetAuth = function resetAuth() {
780
777
  handleSignOut();
781
778
  };
@@ -791,7 +788,7 @@ var LayoutContext = function LayoutContext(_ref) {
791
788
  }
792
789
  dispatch(setLoading(true));
793
790
  var _temp = _catch(function () {
794
- return Promise.resolve(getInfo()).then(function (info) {
791
+ return Promise.resolve(getInfo(role)).then(function (info) {
795
792
  if (!info) {}
796
793
  dispatch(setUser(info.data));
797
794
  });
@@ -801,17 +798,9 @@ var LayoutContext = function LayoutContext(_ref) {
801
798
  return Promise.reject(e);
802
799
  }
803
800
  };
804
- var checkRoleUser = React.useCallback(function () {
805
- if (!user) return;
806
- if (!roles.includes(role) && !!user.academyDomain) {
807
- alert(user.email + " not allow to register " + role);
808
- resetAuth();
809
- }
810
- }, [role, JSON.stringify(user)]);
811
801
  React.useEffect(function () {
812
- !user && loadInfo();
813
- !!user && checkRoleUser();
814
- }, [JSON.stringify(user)]);
802
+ loadInfo();
803
+ }, []);
815
804
  return React__default.createElement(React.Fragment, null, children);
816
805
  };
817
806
 
@@ -824,10 +813,11 @@ var ConfirmDialog = function ConfirmDialog(_ref) {
824
813
  okText = _ref$okText === void 0 ? "Yes" : _ref$okText,
825
814
  isDelete = _ref.isDelete,
826
815
  toggle = _ref.toggle,
816
+ onClose = _ref.onClose,
827
817
  onConfirm = _ref.onConfirm;
828
818
  return React__default.createElement(reactstrap.Modal, {
829
819
  isOpen: open,
830
- toggle: toggle,
820
+ toggle: !!onClose ? onClose : toggle,
831
821
  centered: true
832
822
  }, React__default.createElement(reactstrap.ModalHeader, {
833
823
  toggle: toggle
@@ -972,8 +962,28 @@ var CustomPagination = function CustomPagination(_ref) {
972
962
  })));
973
963
  };
974
964
 
965
+ function _extends() {
966
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
967
+ for (var e = 1; e < arguments.length; e++) {
968
+ var t = arguments[e];
969
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
970
+ }
971
+ return n;
972
+ }, _extends.apply(null, arguments);
973
+ }
974
+ function _objectWithoutPropertiesLoose(r, e) {
975
+ if (null == r) return {};
976
+ var t = {};
977
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
978
+ if (-1 !== e.indexOf(n)) continue;
979
+ t[n] = r[n];
980
+ }
981
+ return t;
982
+ }
983
+
975
984
  var styles = {"core-button":"_xvNBN","primary":"_U9Qyp","secondary":"_1VzMy","text":"_pZNuj","danger":"_2uYm1","light":"_wxH5S"};
976
985
 
986
+ var _excluded = ["type", "children", "onClick", "icon", "disabled", "htmlType"];
977
987
  var CoreButton = function CoreButton(props) {
978
988
  var _props$type = props.type,
979
989
  type = _props$type === void 0 ? "primary" : _props$type,
@@ -983,13 +993,14 @@ var CoreButton = function CoreButton(props) {
983
993
  _props$disabled = props.disabled,
984
994
  disabled = _props$disabled === void 0 ? false : _props$disabled,
985
995
  _props$htmlType = props.htmlType,
986
- htmlType = _props$htmlType === void 0 ? "button" : _props$htmlType;
987
- return React__default.createElement("button", {
996
+ htmlType = _props$htmlType === void 0 ? "button" : _props$htmlType,
997
+ rest = _objectWithoutPropertiesLoose(props, _excluded);
998
+ return React__default.createElement("button", Object.assign({
988
999
  className: styles["core-button"] + " " + styles[type],
989
1000
  onClick: onClick,
990
1001
  disabled: disabled,
991
1002
  type: htmlType
992
- }, icon && icon, children);
1003
+ }, rest), icon && icon, children);
993
1004
  };
994
1005
 
995
1006
  var styles$1 = {"core-input":"_1WdX2","outline":"_3X2RJ","no-outline":"_bVYtv","error":"_n7n3Q"};
@@ -1056,25 +1067,6 @@ var CoreInput = function CoreInput(props) {
1056
1067
  }));
1057
1068
  };
1058
1069
 
1059
- function _extends() {
1060
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
1061
- for (var e = 1; e < arguments.length; e++) {
1062
- var t = arguments[e];
1063
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1064
- }
1065
- return n;
1066
- }, _extends.apply(null, arguments);
1067
- }
1068
- function _objectWithoutPropertiesLoose(r, e) {
1069
- if (null == r) return {};
1070
- var t = {};
1071
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
1072
- if (e.includes(n)) continue;
1073
- t[n] = r[n];
1074
- }
1075
- return t;
1076
- }
1077
-
1078
1070
  var styles$3 = {"core-select":"_2sg12","label":"_1-XBo"};
1079
1071
 
1080
1072
  var Option = function Option(props) {
@@ -1780,7 +1772,7 @@ var CoreSelectCompact = function CoreSelectCompact(props) {
1780
1772
 
1781
1773
  var styles$b = {"core-input-compact":"_1qmXW","label":"_1argp","icon":"_3DPRG"};
1782
1774
 
1783
- var _excluded = ["name", "value", "onChange", "disabled", "label", "width", "placeholder", "error", "tooltip", "onKeyDown"];
1775
+ var _excluded$1 = ["name", "value", "onChange", "disabled", "label", "width", "placeholder", "error", "tooltip", "onKeyDown"];
1784
1776
  var CoreInputCompact = function CoreInputCompact(props) {
1785
1777
  var _props$name = props.name,
1786
1778
  name = _props$name === void 0 ? "" : _props$name,
@@ -1795,7 +1787,7 @@ var CoreInputCompact = function CoreInputCompact(props) {
1795
1787
  error = props.error,
1796
1788
  tooltip = props.tooltip,
1797
1789
  _onKeyDown = props.onKeyDown,
1798
- rest = _objectWithoutPropertiesLoose(props, _excluded);
1790
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1);
1799
1791
  var _useState = React.useState(false),
1800
1792
  isOpenTooltip = _useState[0],
1801
1793
  setIsOpenTooltip = _useState[1];
@@ -1935,7 +1927,7 @@ var CustomOption = function CustomOption(props) {
1935
1927
  }, props.data.label));
1936
1928
  };
1937
1929
 
1938
- var _excluded$1 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1930
+ var _excluded$2 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1939
1931
  var CustomSelect = function CustomSelect(_ref) {
1940
1932
  var isDefault = _ref.isDefault,
1941
1933
  options = _ref.options,
@@ -1943,7 +1935,7 @@ var CustomSelect = function CustomSelect(_ref) {
1943
1935
  scrollBottom = _ref.scrollBottom,
1944
1936
  value = _ref.value,
1945
1937
  isMulti = _ref.isMulti,
1946
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
1938
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
1947
1939
  var initialValues = Array.isArray(value) ? options.filter(function (i) {
1948
1940
  return value.includes(i.value);
1949
1941
  }) : isMulti ? options === null || options === void 0 ? void 0 : options.filter(function (i) {
@@ -1970,7 +1962,7 @@ var CustomSelect = function CustomSelect(_ref) {
1970
1962
  }, rest));
1971
1963
  };
1972
1964
 
1973
- var _excluded$2 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1965
+ var _excluded$3 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1974
1966
  var CustomAsyncSelect = function CustomAsyncSelect(_ref) {
1975
1967
  var isDefault = _ref.isDefault,
1976
1968
  options = _ref.options,
@@ -1978,7 +1970,7 @@ var CustomAsyncSelect = function CustomAsyncSelect(_ref) {
1978
1970
  scrollBottom = _ref.scrollBottom,
1979
1971
  value = _ref.value,
1980
1972
  isMulti = _ref.isMulti,
1981
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
1973
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
1982
1974
  var initialValues = Array.isArray(value) ? options.filter(function (i) {
1983
1975
  return value.includes(i.value);
1984
1976
  }) : isMulti ? options.filter(function (i) {
@@ -2005,14 +1997,14 @@ var CustomAsyncSelect = function CustomAsyncSelect(_ref) {
2005
1997
  }, rest));
2006
1998
  };
2007
1999
 
2008
- var _excluded$3 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
2000
+ var _excluded$4 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
2009
2001
  var CustomCreatable = function CustomCreatable(_ref) {
2010
2002
  var options = _ref.options,
2011
2003
  isDisabled = _ref.isDisabled,
2012
2004
  scrollBottom = _ref.scrollBottom,
2013
2005
  value = _ref.value,
2014
2006
  isMulti = _ref.isMulti,
2015
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
2007
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
2016
2008
  var initialValues = Array.isArray(value) ? options.filter(function (i) {
2017
2009
  return value.includes(i.value);
2018
2010
  }) : isMulti ? options.filter(function (i) {
@@ -2039,7 +2031,7 @@ var CustomCreatable = function CustomCreatable(_ref) {
2039
2031
  }, rest));
2040
2032
  };
2041
2033
 
2042
- var _excluded$4 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
2034
+ var _excluded$5 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
2043
2035
  var CustomSelectOption = function CustomSelectOption(_ref) {
2044
2036
  var defaultValue = _ref.defaultValue,
2045
2037
  options = _ref.options,
@@ -2047,7 +2039,7 @@ var CustomSelectOption = function CustomSelectOption(_ref) {
2047
2039
  scrollBottom = _ref.scrollBottom,
2048
2040
  value = _ref.value,
2049
2041
  isMulti = _ref.isMulti,
2050
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
2042
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
2051
2043
  var initialValues = defaultValue !== null && typeof defaultValue !== "undefined" ? options.find(function (option) {
2052
2044
  return option.value === defaultValue;
2053
2045
  }) || null : null;
@@ -2122,10 +2114,13 @@ exports.api = api$1;
2122
2114
  exports.apiUpload = apiUpload$1;
2123
2115
  exports.getErrorMessage = getErrorMessage;
2124
2116
  exports.historyCore = historyCore;
2117
+ exports.setAddTenant = setAddTenant;
2125
2118
  exports.setAlert = setAlert;
2126
2119
  exports.setIsRefetchSidebar = setIsRefetchSidebar;
2127
2120
  exports.setLoading = setLoading;
2128
2121
  exports.setMenuCollapse = setMenuCollapse;
2122
+ exports.setTeam = setTeam;
2123
+ exports.setTenant = setTenant;
2129
2124
  exports.setUser = setUser;
2130
2125
  exports.store = store;
2131
2126
  exports.useGoogleSignOut = useGoogleSignOut;