acsi-core 1.2.6 → 1.2.7

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,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";
@@ -31,4 +31,4 @@ import utcToLocalTime from "./utils/utcToLocalTime";
31
31
  import getTimeZoneId from "./utils/getTimeZoneId";
32
32
  import timeSpanToLocalMoment from "./utils/timeSpanToLocalMoment";
33
33
  import Cookies from "js-cookie";
34
- export { setLoading, setLoadingPage, setIsFirstCalendar, BASE_URL, OPENSALT_BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, ORGANIZATION_TEAM, ORGANIZATION_TENANT, firstCheckToken, getImageUrl, Login, utcToLocalTime, 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, CustomSelect, CustomAsyncSelect, CustomCreatable, CustomSelectOption, GoogleOAuthProvider, useAmplitude, AmplitudeEvent, initializeAmplitude, initSentry };
34
+ 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, 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, 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: '/',
@@ -3464,8 +3466,23 @@ var CustomSelectOption = function CustomSelectOption(_ref) {
3464
3466
 
3465
3467
  var utcToLocalTime = (function (time, FORMAT) {
3466
3468
  if (time === DATE_MIN_VALUE || time == null) return "";
3469
+ var timezone = localStorage.getItem(TIMEZONE_ID) || "";
3467
3470
  try {
3468
- 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");
3469
3486
  } catch (_unused) {
3470
3487
  return "";
3471
3488
  }
@@ -3475,14 +3492,30 @@ var getTimeZoneId = (function () {
3475
3492
  return moment$1.tz.guess();
3476
3493
  });
3477
3494
 
3478
- var timeSpanToLocalMoment = (function (time) {
3495
+ var timeSpanToLocalMoment = (function (time, timezone) {
3479
3496
  if (!time) return null;
3480
- var times = time.split(":");
3481
- if (times.length !== 3) return null;
3482
- var totalSeconds = +times[0] * 60 * 60 + +times[1] * 60 + +times[2];
3483
- var startOfDay = moment.utc().startOf("day");
3484
- var dateTime = startOfDay.add(totalSeconds, "seconds");
3485
- return dateTime.local();
3497
+ if (time.split(":").length !== 3) return null;
3498
+ if (!timezone) {
3499
+ var totalSeconds = +time.split(":")[0] * 60 * 60 + +time.split(":")[1] * 60 + +time.split(":")[2];
3500
+ var startOfDay = moment$1.utc().startOf("day");
3501
+ var _dateTime = startOfDay.add(totalSeconds, "seconds");
3502
+ return _dateTime.local();
3503
+ }
3504
+ var dateTime;
3505
+ var isOffset = /^(UTC|GMT)?[+-]/.test(timezone);
3506
+ if (isOffset) {
3507
+ var cleanOffset = timezone.replace(/UTC|GMT/gi, '').trim();
3508
+ var offsetMinutes;
3509
+ if (/^[+-]?\d+$/.test(cleanOffset)) {
3510
+ offsetMinutes = parseInt(cleanOffset, 10) * 60;
3511
+ } else {
3512
+ offsetMinutes = cleanOffset;
3513
+ }
3514
+ dateTime = moment$1.utc(time, "HH:mm:ss").utcOffset(offsetMinutes);
3515
+ } else {
3516
+ dateTime = moment$1.utc(time, "HH:mm:ss").tz(timezone);
3517
+ }
3518
+ return dateTime;
3486
3519
  });
3487
3520
 
3488
3521
  var historyCore = history.createBrowserHistory();
@@ -3538,6 +3571,7 @@ exports.NotFound = NotFound;
3538
3571
  exports.OPENSALT_BASE_URL = OPENSALT_BASE_URL;
3539
3572
  exports.ORGANIZATION_TEAM = ORGANIZATION_TEAM;
3540
3573
  exports.ORGANIZATION_TENANT = ORGANIZATION_TENANT;
3574
+ exports.TIMEZONE_ID = TIMEZONE_ID;
3541
3575
  exports.api = api;
3542
3576
  exports.apiUpload = apiUpload;
3543
3577
  exports.firstCheckToken = firstCheckToken;