acsi-core 1.2.28 → 1.2.31
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/containers/Login/apiClient/index.d.ts +5 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +33 -17
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +34 -17
- package/dist/index.modern.js.map +1 -1
- package/dist/services/accountService.d.ts +6 -6
- package/dist/utils/constants.d.ts +0 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const getGoogleClientId: () => Promise<import("axios").AxiosResponse<any, any>>;
|
|
2
|
-
export declare const apiLoginGoogle: (body: any) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
3
|
-
export declare const apiSendEmailCode: (body: any) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
4
|
-
export declare const apiCheckEmailCode: (params: any) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
5
|
-
export declare const apiGetImage: () => Promise<import("axios").AxiosResponse<any, any>>;
|
|
1
|
+
export declare const getGoogleClientId: () => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
2
|
+
export declare const apiLoginGoogle: (body: any) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
3
|
+
export declare const apiSendEmailCode: (body: any) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
4
|
+
export declare const apiCheckEmailCode: (params: any) => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
5
|
+
export declare const apiGetImage: () => Promise<import("axios").AxiosResponse<any, any, {}>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const historyCore: import("history").History<unknown>;
|
|
2
2
|
import { setLoading, setAlert, setTenant, setAddTenant, setTeam, setUser, setMenuCollapse, setIsRefetchSidebar, setLoadingPage, setIsFirstCalendar } from "./redux/commons/action";
|
|
3
|
-
import { BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, OPENSALT_BASE_URL, ORGANIZATION_TEAM, ORGANIZATION_TENANT, TIMEZONE_ID
|
|
3
|
+
import { BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, OPENSALT_BASE_URL, ORGANIZATION_TEAM, ORGANIZATION_TENANT, TIMEZONE_ID } 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";
|
|
@@ -32,4 +32,4 @@ import getTimeZoneId from "./utils/getTimeZoneId";
|
|
|
32
32
|
import timeSpanToLocalMoment from "./utils/timeSpanToLocalMoment";
|
|
33
33
|
import timeSpanToUtc from "./utils/timeSpanToUtc";
|
|
34
34
|
import Cookies from "js-cookie";
|
|
35
|
-
export { setLoading, setLoadingPage, setIsFirstCalendar, BASE_URL, OPENSALT_BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, ORGANIZATION_TEAM, ORGANIZATION_TENANT, TIMEZONE_ID,
|
|
35
|
+
export { setLoading, setLoadingPage, setIsFirstCalendar, BASE_URL, OPENSALT_BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, ORGANIZATION_TEAM, ORGANIZATION_TENANT, TIMEZONE_ID, firstCheckToken, getImageUrl, Login, utcToLocalTime, timeSpanToUtc, getTimeZoneId, timeSpanToLocalMoment, getAccessToken, store, historyCore, setAlert, setUser, setTenant, setAddTenant, setTeam, setMenuCollapse, setIsRefetchSidebar, Loading, NotFound, LayoutContext, api, apiUpload, ConfirmDialog, CommonDialog, ToastContainer, toast, Role, Cookies, CustomPagination, useGoogleSignOut, CoreButton, CoreInput, CoreSelect, CoreCheckbox, CoreRadio, CoreError, CoreModal, CoreRange, CoreTextArea, CoreSearch, CoreSelectCompact, CoreInputCompact, CoreTitleInput, CoreTooltip, getErrorMessage, MarkdownLatexRender, RichContentRenderer, CustomSelect, CustomAsyncSelect, CustomCreatable, CustomSelectOption, GoogleOAuthProvider, useAmplitude, AmplitudeEvent, initializeAmplitude, initSentry };
|
package/dist/index.js
CHANGED
|
@@ -89,7 +89,6 @@ var COLORS = {
|
|
|
89
89
|
var ORGANIZATION_TENANT = "ORGANIZATION_TENANT";
|
|
90
90
|
var ORGANIZATION_TEAM = "ORGANIZATION_TEAM";
|
|
91
91
|
var TIMEZONE_ID = "TIMEZONE_ID";
|
|
92
|
-
var UID_TENANT = "uid";
|
|
93
92
|
|
|
94
93
|
var styleGlobal = {"signup_wrap":"_1KLz9","box-signin":"_2Jo1o","signin_title":"_3egBO","signup_link":"_1DoIT","google_button":"_34hK_","microsoft_button":"_19ESb","box-field":"_2e9xO","box-input":"_3zXRp","box-text":"_8NJga","box-button-email":"_21FPk","box-signin-container":"_1QERu","box-signin-text":"_2-znH","box-signin-logo":"_1aB2m","box-right":"_3qndF","image-slideshow":"_1aM7m","active":"_Vx1zf","box-right-body":"_JzdCr","box-right-footer":"_19aCA","pr-30":"_2HB5r","width-400":"_4ehXP"};
|
|
95
94
|
|
|
@@ -1722,7 +1721,6 @@ var apiUpload = axios.create({
|
|
|
1722
1721
|
[api, apiUpload].forEach(function (i) {
|
|
1723
1722
|
return i.interceptors.request.use(function (config) {
|
|
1724
1723
|
var token = getAccessToken();
|
|
1725
|
-
var organizationTenant = localStorage.getItem(ORGANIZATION_TENANT);
|
|
1726
1724
|
if (token) {
|
|
1727
1725
|
config.headers.Authorization = "Bearer " + token;
|
|
1728
1726
|
localStorage.setItem("LAST_TIME_REQUETST", moment().utc().format("YYYY-MM-DD HH:mm:ss"));
|
|
@@ -1731,8 +1729,9 @@ var apiUpload = axios.create({
|
|
|
1731
1729
|
if (imPersonate) {
|
|
1732
1730
|
config.headers.ImPersonate = imPersonate;
|
|
1733
1731
|
}
|
|
1734
|
-
|
|
1735
|
-
|
|
1732
|
+
var tenantId = localStorage.getItem(ORGANIZATION_TENANT);
|
|
1733
|
+
if (tenantId) {
|
|
1734
|
+
config.headers["X-TenantID"] = tenantId;
|
|
1736
1735
|
}
|
|
1737
1736
|
return config;
|
|
1738
1737
|
}, function (error) {
|
|
@@ -1743,7 +1742,10 @@ var apiUpload = axios.create({
|
|
|
1743
1742
|
return i.interceptors.response.use(function (response) {
|
|
1744
1743
|
return response;
|
|
1745
1744
|
}, function (error) {
|
|
1746
|
-
if (
|
|
1745
|
+
if (error.response.status === 401) {
|
|
1746
|
+
window.location.href = "/login";
|
|
1747
|
+
}
|
|
1748
|
+
if (error.response.status == 403) {
|
|
1747
1749
|
var hostname = window.location.hostname;
|
|
1748
1750
|
var parts = hostname.split('.');
|
|
1749
1751
|
var domain = parts.slice(-2).join('.');
|
|
@@ -1751,7 +1753,6 @@ var apiUpload = axios.create({
|
|
|
1751
1753
|
localStorage.removeItem(ORGANIZATION_TENANT);
|
|
1752
1754
|
localStorage.removeItem(TIMEZONE_ID);
|
|
1753
1755
|
localStorage.removeItem(ORGANIZATION_TEAM);
|
|
1754
|
-
localStorage.removeItem(UID_TENANT);
|
|
1755
1756
|
Cookies.remove('auth', {
|
|
1756
1757
|
path: '/',
|
|
1757
1758
|
domain: "." + domain
|
|
@@ -1837,8 +1838,7 @@ var msalConfig = function msalConfig(clientId, redirectUri) {
|
|
|
1837
1838
|
};
|
|
1838
1839
|
|
|
1839
1840
|
var BlockLogin = function BlockLogin(_ref) {
|
|
1840
|
-
var
|
|
1841
|
-
role = _ref.role,
|
|
1841
|
+
var role = _ref.role,
|
|
1842
1842
|
hiddenSignup = _ref.hiddenSignup,
|
|
1843
1843
|
email = _ref.email,
|
|
1844
1844
|
setEmail = _ref.setEmail,
|
|
@@ -1954,9 +1954,15 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
|
1954
1954
|
var redirectUrl = getRedirectUrl(authResult.data.role);
|
|
1955
1955
|
window.location.href = redirectUrl + "/dashboard";
|
|
1956
1956
|
dispatch(setLoading(false));
|
|
1957
|
+
} else {
|
|
1958
|
+
var _authResult$data2, _authResult$data2$rol, _authResult$data3;
|
|
1959
|
+
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
1960
|
+
var domain = "/teacher";
|
|
1961
|
+
if ((_authResult$data2 = authResult.data) !== null && _authResult$data2 !== void 0 && (_authResult$data2$rol = _authResult$data2.roles) !== null && _authResult$data2$rol !== void 0 && _authResult$data2$rol.includes("Admin") || ((_authResult$data3 = authResult.data) === null || _authResult$data3 === void 0 ? void 0 : _authResult$data3.role) === "Admin") {
|
|
1962
|
+
domain = "/admin";
|
|
1963
|
+
}
|
|
1964
|
+
window.location.href = domain + "/dashboard";
|
|
1957
1965
|
}
|
|
1958
|
-
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
1959
|
-
onNavigate("/dashboard");
|
|
1960
1966
|
dispatch(setLoading(false));
|
|
1961
1967
|
});
|
|
1962
1968
|
}
|
|
@@ -2005,8 +2011,8 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
|
2005
2011
|
};
|
|
2006
2012
|
dispatch(setLoading(true));
|
|
2007
2013
|
return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (authResult) {
|
|
2008
|
-
var _authResult$
|
|
2009
|
-
if (((_authResult$
|
|
2014
|
+
var _authResult$data4;
|
|
2015
|
+
if (((_authResult$data4 = authResult.data) === null || _authResult$data4 === void 0 ? void 0 : _authResult$data4.id) == null) {
|
|
2010
2016
|
dispatch(setLoading(false));
|
|
2011
2017
|
alert("Please contact admin.");
|
|
2012
2018
|
return;
|
|
@@ -2041,9 +2047,15 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
|
2041
2047
|
var redirectUrl = getRedirectUrl(authResult.data.role);
|
|
2042
2048
|
window.location.href = redirectUrl + "/dashboard";
|
|
2043
2049
|
dispatch(setLoading(false));
|
|
2050
|
+
} else {
|
|
2051
|
+
var _authResult$data5, _authResult$data5$rol, _authResult$data6;
|
|
2052
|
+
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
2053
|
+
var domain = "/teacher";
|
|
2054
|
+
if ((_authResult$data5 = authResult.data) !== null && _authResult$data5 !== void 0 && (_authResult$data5$rol = _authResult$data5.roles) !== null && _authResult$data5$rol !== void 0 && _authResult$data5$rol.includes("Admin") || ((_authResult$data6 = authResult.data) === null || _authResult$data6 === void 0 ? void 0 : _authResult$data6.role) === "Admin") {
|
|
2055
|
+
domain = "/admin";
|
|
2056
|
+
}
|
|
2057
|
+
window.location.href = domain + "/dashboard";
|
|
2044
2058
|
}
|
|
2045
|
-
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
2046
|
-
onNavigate("/dashboard");
|
|
2047
2059
|
dispatch(setLoading(false));
|
|
2048
2060
|
});
|
|
2049
2061
|
}
|
|
@@ -2508,9 +2520,14 @@ var useLogin = function useLogin(onNavigate, trackEvent) {
|
|
|
2508
2520
|
if ((_data$data$roles = data.data.roles) !== null && _data$data$roles !== void 0 && _data$data$roles.includes("Admin")) {
|
|
2509
2521
|
domain = ADMIN_ORIGIN;
|
|
2510
2522
|
}
|
|
2511
|
-
|
|
2523
|
+
onNavigate(domain + "/dashboard");
|
|
2512
2524
|
} else {
|
|
2513
|
-
|
|
2525
|
+
var _data$data$roles2;
|
|
2526
|
+
var _domain = "/teacher";
|
|
2527
|
+
if ((_data$data$roles2 = data.data.roles) !== null && _data$data$roles2 !== void 0 && _data$data$roles2.includes("Admin")) {
|
|
2528
|
+
_domain = "/admin";
|
|
2529
|
+
}
|
|
2530
|
+
onNavigate(_domain + "/dashboard");
|
|
2514
2531
|
}
|
|
2515
2532
|
} else {
|
|
2516
2533
|
reactToastify.toast.error("The code is not correct. Please check again.");
|
|
@@ -3677,7 +3694,6 @@ exports.ORGANIZATION_TEAM = ORGANIZATION_TEAM;
|
|
|
3677
3694
|
exports.ORGANIZATION_TENANT = ORGANIZATION_TENANT;
|
|
3678
3695
|
exports.RichContentRenderer = RichContentRenderer;
|
|
3679
3696
|
exports.TIMEZONE_ID = TIMEZONE_ID;
|
|
3680
|
-
exports.UID_TENANT = UID_TENANT;
|
|
3681
3697
|
exports.api = api;
|
|
3682
3698
|
exports.apiUpload = apiUpload;
|
|
3683
3699
|
exports.firstCheckToken = firstCheckToken;
|