acsi-core 1.1.3 → 1.2.1

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.
@@ -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 } from "./utils/constants";
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";
@@ -30,4 +30,4 @@ import CustomSelectOption from "./components/Selects/CustomSelectOption";
30
30
  import utcToLocalTime from "./utils/utcToLocalTime";
31
31
  import timeSpanToLocalMoment from "./utils/timeSpanToLocalMoment";
32
32
  import Cookies from "js-cookie";
33
- export { setLoading, setLoadingPage, setIsFirstCalendar, BASE_URL, OPENSALT_BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, ORGANIZATION_TEAM, ORGANIZATION_TENANT, firstCheckToken, getImageUrl, Login, utcToLocalTime, 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, CustomSelect, CustomAsyncSelect, CustomCreatable, CustomSelectOption, GoogleOAuthProvider, useAmplitude, AmplitudeEvent, initializeAmplitude, initSentry };
33
+ 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, 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, CustomSelect, CustomAsyncSelect, CustomCreatable, CustomSelectOption, GoogleOAuthProvider, useAmplitude, AmplitudeEvent, initializeAmplitude, initSentry };
package/dist/index.js CHANGED
@@ -87,6 +87,7 @@ var COLORS = {
87
87
  };
88
88
  var ORGANIZATION_TENANT = "ORGANIZATION_TENANT";
89
89
  var ORGANIZATION_TEAM = "ORGANIZATION_TEAM";
90
+ var TIMEZONE_ID = "TIMEZONE_ID";
90
91
 
91
92
  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"};
92
93
 
@@ -1712,6 +1713,7 @@ var apiUpload = axios.create({
1712
1713
  var domain = parts.slice(-2).join('.');
1713
1714
  localStorage.removeItem(ACCESS_TOKEN);
1714
1715
  localStorage.removeItem(ORGANIZATION_TENANT);
1716
+ localStorage.removeItem(TIMEZONE_ID);
1715
1717
  localStorage.removeItem(ORGANIZATION_TEAM);
1716
1718
  Cookies.remove('auth', {
1717
1719
  path: '/',
@@ -1933,7 +1935,8 @@ var BlockLogin = function BlockLogin(_ref) {
1933
1935
  });
1934
1936
  var fnLoginMicrosoft = function fnLoginMicrosoft() {
1935
1937
  try {
1936
- var msalInstance = new msalBrowser.PublicClientApplication(msalConfig(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT));
1938
+ var redirectUri = window.location.origin + "/auth-redirect.html";
1939
+ var msalInstance = new msalBrowser.PublicClientApplication(msalConfig(MICROSOFT_CLIENT_ID, redirectUri));
1937
1940
  if (!msalInstance) {
1938
1941
  console.error("MSAL instance not initialized");
1939
1942
  return Promise.resolve();
@@ -1941,7 +1944,8 @@ var BlockLogin = function BlockLogin(_ref) {
1941
1944
  return Promise.resolve(_catch(function () {
1942
1945
  return Promise.resolve(msalInstance.initialize()).then(function () {
1943
1946
  var loginRequest = {
1944
- scopes: ["openid", "profile", "email"]
1947
+ scopes: ["openid", "profile", "email"],
1948
+ redirectUri: redirectUri
1945
1949
  };
1946
1950
  var silentRequest = _extends({}, loginRequest, {
1947
1951
  prompt: "select_account"
@@ -3462,8 +3466,23 @@ var CustomSelectOption = function CustomSelectOption(_ref) {
3462
3466
 
3463
3467
  var utcToLocalTime = (function (time, FORMAT) {
3464
3468
  if (time === DATE_MIN_VALUE || time == null) return "";
3469
+ var timezone = localStorage.getItem(TIMEZONE_ID) || "";
3465
3470
  try {
3466
- return moment.utc(time).local().format(FORMAT || "yyyy-MM-DD");
3471
+ if (!timezone) {
3472
+ return moment.utc(time).local().format(FORMAT || "yyyy-MM-DD");
3473
+ }
3474
+ var isOffset = /^(UTC|GMT)?[+-]/.test(timezone);
3475
+ if (isOffset) {
3476
+ var cleanOffset = timezone.replace(/UTC|GMT/gi, "").trim();
3477
+ var offsetMinutes;
3478
+ if (/^[+-]?\d+$/.test(cleanOffset)) {
3479
+ offsetMinutes = parseInt(cleanOffset, 10) * 60;
3480
+ } else {
3481
+ offsetMinutes = cleanOffset;
3482
+ }
3483
+ return moment.utc(time).utcOffset(offsetMinutes).format(FORMAT || "yyyy-MM-DD");
3484
+ }
3485
+ return moment.utc(time).tz(timezone).format(FORMAT || "yyyy-MM-DD");
3467
3486
  } catch (_unused) {
3468
3487
  return "";
3469
3488
  }
@@ -3480,19 +3499,18 @@ var timeSpanToLocalMoment = (function (time, timezone) {
3480
3499
  }
3481
3500
  var dateTime;
3482
3501
  var isOffset = /^(UTC|GMT)?[+-]/.test(timezone);
3483
- console.log({
3484
- isOffset: isOffset
3485
- });
3486
3502
  if (isOffset) {
3487
3503
  var cleanOffset = timezone.replace(/UTC|GMT/gi, '').trim();
3488
- console.log({
3489
- cleanOffset: cleanOffset
3490
- });
3491
- dateTime = moment$1.utc(time, "HH:mm:ss").utcOffset(cleanOffset, true);
3504
+ var offsetMinutes;
3505
+ if (/^[+-]?\d+$/.test(cleanOffset)) {
3506
+ offsetMinutes = parseInt(cleanOffset, 10) * 60;
3507
+ } else {
3508
+ offsetMinutes = cleanOffset;
3509
+ }
3510
+ dateTime = moment$1.utc(time, "HH:mm:ss").utcOffset(offsetMinutes);
3492
3511
  } else {
3493
- dateTime = moment$1.tz(time, "HH:mm:ss", timezone);
3512
+ dateTime = moment$1.utc(time, "HH:mm:ss").tz(timezone);
3494
3513
  }
3495
- console.log("run time", dateTime.format("HH:mm:ss"), timezone);
3496
3514
  return dateTime;
3497
3515
  });
3498
3516
 
@@ -3549,6 +3567,7 @@ exports.NotFound = NotFound;
3549
3567
  exports.OPENSALT_BASE_URL = OPENSALT_BASE_URL;
3550
3568
  exports.ORGANIZATION_TEAM = ORGANIZATION_TEAM;
3551
3569
  exports.ORGANIZATION_TENANT = ORGANIZATION_TENANT;
3570
+ exports.TIMEZONE_ID = TIMEZONE_ID;
3552
3571
  exports.api = api;
3553
3572
  exports.apiUpload = apiUpload;
3554
3573
  exports.firstCheckToken = firstCheckToken;